diff options
| author | Mattias Andrée <m@maandree.se> | 2025-12-06 10:21:36 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2025-12-06 10:21:36 +0100 |
| commit | c28859c3e10c84fd9f81ebf88336c9b693448eeb (patch) | |
| tree | 22f9804f4ba96474c23c93c021d293ba5959ccfa /libj2.h | |
| parent | Second commit (diff) | |
| download | libj2-c28859c3e10c84fd9f81ebf88336c9b693448eeb.tar.gz libj2-c28859c3e10c84fd9f81ebf88336c9b693448eeb.tar.bz2 libj2-c28859c3e10c84fd9f81ebf88336c9b693448eeb.tar.xz | |
Add overflow and underflow prediction functions
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'libj2.h')
| -rw-r--r-- | libj2.h | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -52,6 +52,32 @@ struct libj2_j2u { }; +/** + * Arithmetic overflow prediction result + * + * Use by some functions for which prediction + * is costly in edge cases, and thus stopped + * as soon as such an edge case is detected + */ +enum libj2_overflow { + /** + * Where will not be an overflow + */ + LIBJ2_NO_OVERFLOW = 0, + + /** + * Where will be an overflow + */ + LIBJ2_OVERFLOW = 1, + + /** + * Overflow prediction stopped + * (due to high cost) + */ + LIBJ2_OVERFLOW_UNKNOWN +}; + + #include "libj2/constants.h" #include "libj2/signum.h" #include "libj2/constructors.h" |
