mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-30 15:32:36 +00:00
Merge branch 'MathewBensonCode-master'
This commit is contained in:
commit
c9efd8968c
@ -369,8 +369,6 @@ class uint128_fallback {
|
|||||||
private:
|
private:
|
||||||
uint64_t lo_, hi_;
|
uint64_t lo_, hi_;
|
||||||
|
|
||||||
friend uint128_fallback umul128(uint64_t x, uint64_t y) noexcept;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr uint128_fallback(uint64_t hi, uint64_t lo) : lo_(lo), hi_(hi) {}
|
constexpr uint128_fallback(uint64_t hi, uint64_t lo) : lo_(lo), hi_(hi) {}
|
||||||
constexpr uint128_fallback(uint64_t value = 0) : lo_(value), hi_(0) {}
|
constexpr uint128_fallback(uint64_t value = 0) : lo_(value), hi_(0) {}
|
||||||
@ -1488,9 +1486,9 @@ inline uint128_fallback umul128(uint64_t x, uint64_t y) noexcept {
|
|||||||
auto p = static_cast<uint128_opt>(x) * static_cast<uint128_opt>(y);
|
auto p = static_cast<uint128_opt>(x) * static_cast<uint128_opt>(y);
|
||||||
return {static_cast<uint64_t>(p >> 64), static_cast<uint64_t>(p)};
|
return {static_cast<uint64_t>(p >> 64), static_cast<uint64_t>(p)};
|
||||||
#elif defined(_MSC_VER) && defined(_M_X64)
|
#elif defined(_MSC_VER) && defined(_M_X64)
|
||||||
auto result = uint128_fallback();
|
auto hi = uint64_t{};
|
||||||
result.lo_ = _umul128(x, y, &result.hi_);
|
auto lo = _umul128(x, y, &hi);
|
||||||
return result;
|
return {hi, lo};
|
||||||
#else
|
#else
|
||||||
const uint64_t mask = static_cast<uint64_t>(max_value<uint32_t>());
|
const uint64_t mask = static_cast<uint64_t>(max_value<uint32_t>());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user