aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libj2.h27
-rw-r--r--libj2.h.039
2 files changed, 54 insertions, 12 deletions
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
};
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 .