Skip to content

Add/multiply with overflow tweaks#4945

Merged
ethomson merged 5 commits intomasterfrom
ethomson/fix-intrinsics
Jan 20, 2019
Merged

Add/multiply with overflow tweaks#4945
ethomson merged 5 commits intomasterfrom
ethomson/fix-intrinsics

Conversation

@ethomson
Copy link
Copy Markdown
Member

This takes #4929 with a few additions: first, it simplifies the tests a bit on gcc/clang. Second, it starts using SizeTAdd and friends on MSVC, which may be faster than our fallback test. Third, it corrects an error in the docs for the fallback test. Finally, it removes an unused function.

lhchavez and others added 5 commits January 9, 2019 16:51
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 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.
Windows provides <intsafe.h> which provides "performant" add and
multiply with overflow operations.  Use them when possible.
Correct the documentation on the fallback add/multiply with overflow
functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants