diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-17 14:28:21 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-17 15:06:44 +0200 |
| commit | c77deb9313ee3c4ca9885191f5cb8e07d8d68ad3 (patch) | |
| tree | 1de53628d7bffdac84992d8ae1e36d4bf0265c90 /libj2_j2i_add_ji.c | |
| parent | Fix usage of va_arg (diff) | |
| download | libj2-c77deb9313ee3c4ca9885191f5cb8e07d8d68ad3.tar.gz libj2-c77deb9313ee3c4ca9885191f5cb8e07d8d68ad3.tar.bz2 libj2-c77deb9313ee3c4ca9885191f5cb8e07d8d68ad3.tar.xz | |
Fix undefined behaviour
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | libj2_j2i_add_ji.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libj2_j2i_add_ji.c b/libj2_j2i_add_ji.c index d1e7e32..1fd5af9 100644 --- a/libj2_j2i_add_ji.c +++ b/libj2_j2i_add_ji.c @@ -65,7 +65,7 @@ self_check(uintmax_t a_high, uintmax_t a_low, uintmax_t b_high, uintmax_t b_low, static void check(uintmax_t a_high, uintmax_t a_low, uintmax_t ub) { - intmax_t b = ub > (uintmax_t)INTMAX_MAX ? (intmax_t)ub : -(intmax_t)~ub - 1; + intmax_t b = ub > (uintmax_t)INTMAX_MAX ? -(intmax_t)~ub - 1 : (intmax_t)ub; struct libj2_j2i a, r; uintmax_t expected_high, expected_low; int expected_overflow; |
