summaryrefslogtreecommitdiff
path: root/AK/Checked.h
AgeCommit message (Collapse)Author
2020-08-26AK: Demonstrate and fix CheckedBen Wiederhake
Specifically: - post-increment actually implemented pre-increment - helper-templates that provided operator{+,-,*,/}() couldn't possibly work, because the interface of add (etc) were incompatible (not taking a Checked<>, and returning void)
2020-05-31AK: Always inline some Checked methodsSergey Bugaev
Once again, we need to hint the compiler that it should inline the function, and then it is able to eliminate the assertion.
2020-05-20AK: Fix Checked::multiplication_would_overflow() signatureSergey Bugaev
The two-argument version doesn't need an extra template parameter.
2020-05-01AK: Make Checked.h work with ClangAndreas Kling
Apparently Clang does not have __builtin_foo_overflow_p() Fixes #2044.
2020-04-30AK: Add Checked::addition_would_overflow()Sergey Bugaev
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-15AK: Add Checked<T>::multiplication_would_overflow()Andreas Kling
This allows you to comfortably test if multiply 2 or 3 values would cause arithmetic overflow.
2020-04-15AK: Add a Checked<T> templateAndreas Kling
A Checked<T> is a boxed integer type that asserts if you try to use its value after an arithmetic overflow.