Add checked int32 arithmetic #5
Loading…
Reference in a new issue
No description provided.
Delete branch "fputs/i32-arith"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds
lf_i32_add,lf_i32_sub, andlf_i32_mulonlfmath.h. They return0and write*outonly on success. NULLoutand signed overflow return-1and leave*outunchanged.Overflow is detected with
__builtin_add_overflow,__builtin_sub_overflow, and__builtin_mul_overflow. The builtin result is staged so a wrapped value is never stored in*out.Tested with
-DCMAKE_BUILD_TYPE=Debug -DFLINT_SANITIZE=ON -DCMAKE_C_EXTENSIONS=OFF.ctest --label-exclude slow: 25/25 passed.3efa917d1681857f7455