Sergey Bugaev
361a1b54d7
AK: Add Checked::addition_would_overflow()
...
And switch the two-argument version of Checked::multiplication_would_overflow()
to use __builtin_mul_overflow_p(). This helps GCC optimize the code better.
2020-04-30 11:30:27 +02:00
Andreas Kling
63b8c6913c
AK: Add Checked<T>::multiplication_would_overflow()
...
This allows you to comfortably test if multiply 2 or 3 values would
cause arithmetic overflow.
2020-04-15 17:14:18 +02:00
Andreas Kling
9c54bad241
AK: Add a Checked<T> template
...
A Checked<T> is a boxed integer type that asserts if you try to use its
value after an arithmetic overflow.
2020-04-15 16:58:46 +02:00