Refactor To remove friend function private access
- Remove umul128 friend function from uint128_fallback class using non-const member access functions instead.
This commit is contained in:
parent
1f38ebbdb1
commit
2b20d7be6f
@ -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 <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||
constexpr explicit operator T() const {
|
||||
return static_cast<T>(lo_);
|
||||
@ -1491,7 +1490,7 @@ inline uint128_fallback umul128(uint64_t x, uint64_t y) noexcept {
|
||||
return {static_cast<uint64_t>(p >> 64), static_cast<uint64_t>(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<uint64_t>(max_value<uint32_t>());
|
||||
|
Loading…
Reference in New Issue
Block a user