aboutsummaryrefslogtreecommitdiffstats
path: root/libj2.h.0
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-12-14 16:28:56 +0100
committerMattias Andrée <m@maandree.se>2025-12-14 16:28:56 +0100
commit276ceee498d9dda587207ec51a86c6d094db9e46 (patch)
tree71e3b1e8f7bb57bd8095a2bf59f890d4f178c582 /libj2.h.0
parentDocument the macros, structs, and enum (diff)
downloadlibj2-276ceee498d9dda587207ec51a86c6d094db9e46.tar.gz
libj2-276ceee498d9dda587207ec51a86c6d094db9e46.tar.bz2
libj2-276ceee498d9dda587207ec51a86c6d094db9e46.tar.xz
Add negative overflow to enum libj2_overflow
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--libj2.h.039
1 files changed, 32 insertions, 7 deletions
diff --git a/libj2.h.0 b/libj2.h.0
index b9e434e..3c677af 100644
--- a/libj2.h.0
+++ b/libj2.h.0
@@ -23,9 +23,13 @@ libj2.h \- Double-max precision integers header file
\fBenum libj2_overflow\fP {
\fBLIBJ2_NO_OVERFLOW\fP = 0,
- \fBLIBJ2_OVERFLOW\fP = 1,
- \fBLIBJ2_OVERFLOW_UNKNOWN\fP = 2
+ \fBLIBJ2_POSITIVE_OVERFLOW\fP = 1,
+ \fBLIBJ2_POSITIVE_OVERFLOW_UNKNOWN\fP = 2,
+ \fBLIBJ2_NEGATIVE_OVERFLOW\fP = -1,
+ \fBLIBJ2_NEGATIVE_OVERFLOW_UNKNOWN\fP = -2
};
+#define \fBLIBJ2_POSITIVE_OVERFLOW\fP LIBJ2_OVERFLOW
+#define \fBLIBJ2_POSITIVE_OVERFLOW_UNKNOWN\fP LIBJ2_OVERFLOW_UNKNOWNP
.fi
.PP
@@ -70,7 +74,7 @@ Each half stores
bits, for a sum of
.B LIBJ2_J2U_BIT
bits for the entire
-.I struct .
+.IR struct .
.PP
.B LIBJ2_J2I_BIT
is a synonym for
@@ -102,12 +106,24 @@ is used as the return-type by some
overflow-prediction functions.
.B LIBJ2_NO_OVERFLOW
signifies that the result is fully representable.
-.B LIBJ2_OVERFLOW
+.B LIBJ2_POSITIVE_OVERFLOW
signifies that the result is positive but too large
-to be fully represented.
+to be fully represented; for unsigned operations,
+the synonym
+.B LIBJ2_OVERFLOW
+is documented as the return value.
+.B LIBJ2_POSITIVE_OVERFLOW_UNKNOWN
+signifies that the function bailed out making the
+overflow prediction, but that the result is positive;
+for unsigned operations, the synonym
.B LIBJ2_OVERFLOW_UNKNOWN
+is documented as the return value.
+.B LIBJ2_NEGATIVE_OVERFLOW
+signifies that the result is negative but too large
+to be fully represented.
+.B LIBJ2_NEGATIVE_OVERFLOW_UNKNOWN
signifies that the function bailed out making the
-overflow prediction, but that the result is positive.
+overflow prediction, but that the result is negative.
.PP
See
.BR libj2 (7)
@@ -120,13 +136,22 @@ header file.
.BR struct\ libj2_j2u ,
and
.B enum\ libj2_overflow
+with
+.BR LIBJ2_NO_OVERFLOW ,
+.BR LIBJ2_OVERFLOW ,
+and
+.B LIBJ2_OVERFLOW_UNKNOWN
where added in version 1.0 of
.BR libj2 .
.PP
.BR LIBJ2_J2I_BIT ,
.BR LIBJ2_J2I_VBIT ,
+.BR struct\ libj2_j2i ,
+.BR LIBJ2_POSITIVE_OVERFLOW ,
+.BR LIBJ2_POSITIVE_OVERFLOW_UNKNOWN ,
+.BR LIBJ2_NEGATIVE_OVERFLOW ,
and
-.B struct\ libj2_j2i
+.B LIBJ2_NEGATIVE_OVERFLOW_UNKNOWN
where added in version 1.1 of
.BR libj2 .