| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
| |
Correct the documentation on the fallback add/multiply with overflow
functions.
|
| |
|
|
|
| |
Windows provides <intsafe.h> which provides "performant" add and
multiply with overflow operations. Use them when possible.
|
| | |
|
| |
|
|
|
|
| |
Use the smallest unsigned type that is equivalent to `size_t` to
simplify the conditionals. Error if we're on a system that we believe
offers builtins but we cannot determine which one to use.
|
| |
|
|
|
|
|
|
| |
This change tweaks the macros for git__{add,multiply}_sizet_overflow so
that GCC can use them.
It also stops using the uadd,umul versions since the add,mul can handle
way more cases.
|
| |
|
|
| |
use consistent names for the #include / #define header guard pattern.
|
| | |
|
| | |
|
| |
|
|
|
| |
gcc and clang support __builtin_add_overflow, use it whenever
possible, falling back to our naive routines.
|
| |
|
|
|
|
|
|
|
| |
Make our overflow checking look more like gcc and clang's, so that
we can substitute it out with the compiler instrinsics on platforms
that support it. This means dropping the ability to pass `NULL` as
an out parameter.
As a result, the macros also get updated to reflect this as well.
|
|
|
Add some helper functions to check for overflow in a type-specific
manner.
|