From 1436fc76e9db6259c01640481c8219d53e95c401 Mon Sep 17 00:00:00 2001 From: Laurent GIORELLO Date: Fri, 10 Nov 2023 03:45:30 +0000 Subject: [PATCH] Update umul128_upper64 to use optimised x64 version of umul128 --- include/fmt/format.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index fbdd06c2..ecfbbb6a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -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(x) * static_cast(y); return static_cast(p >> 64); #elif defined(_MSC_VER) && defined(_M_X64)