Update umul128_upper64 to use optimised x64 version of umul128

From the previous commit, we can use an improved version to calculate the product of two unsigned 64 bits integers.
umul128 will benefit from this update as well.
This commit is contained in:
Laurent GIORELLO 2023-11-10 04:24:17 +01:00 committed by GitHub
parent eb6085d99a
commit bf650ec32b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1535,7 +1535,9 @@ inline int floor_log2_pow10(int e) noexcept {
// Computes upper 64 bits of multiplication of two 64-bit unsigned integers.
inline uint64_t umul128_upper64(uint64_t x, uint64_t y) noexcept {
#if FMT_USE_INT128
#if __x86_64__ && (__GNUC__ || __clang__)
return umul128(x, y).high();
#elif FMT_USE_INT128
auto p = static_cast<uint128_opt>(x) * static_cast<uint128_opt>(y);
return static_cast<uint64_t>(p >> 64);
#elif defined(_MSC_VER) && defined(_M_X64)