Inspired by #4776
There are Clang intrinsics used in _Mul_overflow and _Add_overflow
MSVC has its own _mul_full_overflow_u8 and others.
Using them would certainly result in a better codegen than the generic implementation.
Caveats:
- Only for x86 / x64, some are only for x64
- Not a complete set of all operations possible
- Not
constexpr, unlike the Clang one
- Need to include
<intrin.h>
These might warrant the need of another internal header for _Mul_overflow and _Add_overflow, used by <ranges>, <mdspan>, and <numeric> after #4776.
Inspired by #4776
There are Clang intrinsics used in
_Mul_overflowand_Add_overflowMSVC has its own
_mul_full_overflow_u8and others.Using them would certainly result in a better codegen than the generic implementation.
Caveats:
constexpr, unlike the Clang one<intrin.h>These might warrant the need of another internal header for
_Mul_overflowand_Add_overflow, used by<ranges>,<mdspan>, and<numeric>after #4776.