From 276ceee498d9dda587207ec51a86c6d094db9e46 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 14 Dec 2025 16:28:56 +0100 Subject: Add negative overflow to enum libj2_overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libj2.h | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'libj2.h') diff --git a/libj2.h b/libj2.h index c351e43..07c251b 100644 --- a/libj2.h +++ b/libj2.h @@ -114,7 +114,9 @@ struct libj2_j2i { * is costly in edge cases, and thus stopped * as soon as such an edge case is detected * - * @since 1.0 + * @since 1.0 LIBJ2_NO_OVERFLOW, LIBJ2_OVERFLOW, LIBJ2_OVERFLOW_UNKNOWN + * @since 1.1 LIBJ2_POSITIVE_OVERFLOW, LIBJ2_POSITIVE_OVERFLOW_UNKNOWN, + * LIBJ2_NEGATIVE_OVERFLOW, LIBJ2_NEGATIVE_OVERFLOW_UNKNOWN */ enum libj2_overflow { /** @@ -123,15 +125,30 @@ enum libj2_overflow { LIBJ2_NO_OVERFLOW = 0, /** - * Where will be an overflow + * Where will be a positive overflow + */ + LIBJ2_POSITIVE_OVERFLOW = 1, +#define LIBJ2_OVERFLOW LIBJ2_POSITIVE_OVERFLOW + + /** + * Overflow prediction stopped + * (due to high cost); + * result is positive + */ + LIBJ2_POSITIVE_OVERFLOW_UNKNOWN = 2, +#define LIBJ2_OVERFLOW_UNKNOWN LIBJ2_POSITIVE_OVERFLOW_UNKNOWN + + /** + * Where will be a positive overflow */ - LIBJ2_OVERFLOW = 1, + LIBJ2_NEGATIVE_OVERFLOW = -1, /** * Overflow prediction stopped - * (due to high cost) + * (due to high cost); + * result is positive */ - LIBJ2_OVERFLOW_UNKNOWN = 2 + LIBJ2_NEGATIVE_OVERFLOW_UNKNOWN = -2 }; -- cgit v1.2.3-70-g09d2