diff --git a/include/fmt/format.h b/include/fmt/format.h index e39bec68..9dda5662 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -369,10 +369,6 @@ class uint128_fallback { private: uint64_t lo_, hi_; -#ifdef _WIN32 - friend uint128_fallback umul128(uint64_t x, uint64_t y) noexcept; -#endif - public: constexpr uint128_fallback(uint64_t hi, uint64_t lo) : lo_(lo), hi_(hi) {} constexpr uint128_fallback(uint64_t value = 0) : lo_(value), hi_(0) {} @@ -380,6 +376,9 @@ class uint128_fallback { constexpr uint64_t high() const noexcept { return hi_; } constexpr uint64_t low() const noexcept { return lo_; } + uint64_t& high() { return hi_; } + uint64_t& low() { return lo_; } + template ::value)> constexpr explicit operator T() const { return static_cast(lo_); @@ -1491,7 +1490,7 @@ inline uint128_fallback umul128(uint64_t x, uint64_t y) noexcept { return {static_cast(p >> 64), static_cast(p)}; #elif defined(_MSC_VER) && defined(_M_X64) auto result = uint128_fallback(); - result.lo_ = _umul128(x, y, &result.hi_); + result.low() = _umul128(x, y, &result.high()); return result; #else const uint64_t mask = static_cast(max_value());