@@ -291,13 +291,13 @@ inline auto is_big_endian() -> bool {
291291#endif
292292}
293293
294- class uint128_fallback {
294+ class uint128 {
295295 private:
296296 uint64_t lo_, hi_;
297297
298298 public:
299- constexpr uint128_fallback (uint64_t hi, uint64_t lo) : lo_(lo), hi_(hi) {}
300- constexpr uint128_fallback (uint64_t value = 0 ) : lo_(value), hi_(0 ) {}
299+ constexpr uint128 (uint64_t hi, uint64_t lo) : lo_(lo), hi_(hi) {}
300+ constexpr uint128 (uint64_t value = 0 ) : lo_(value), hi_(0 ) {}
301301
302302 constexpr auto high () const noexcept -> uint64_t { return hi_; }
303303 constexpr auto low () const noexcept -> uint64_t { return lo_; }
@@ -307,77 +307,69 @@ class uint128_fallback {
307307 return static_cast <T>(lo_);
308308 }
309309
310- friend constexpr auto operator ==(const uint128_fallback & lhs,
311- const uint128_fallback& rhs) -> bool {
310+ friend constexpr auto operator ==(const uint128 & lhs, const uint128& rhs)
311+ -> bool {
312312 return lhs.hi_ == rhs.hi_ && lhs.lo_ == rhs.lo_ ;
313313 }
314- friend constexpr auto operator !=(const uint128_fallback & lhs,
315- const uint128_fallback& rhs) -> bool {
314+ friend constexpr auto operator !=(const uint128 & lhs, const uint128& rhs)
315+ -> bool {
316316 return !(lhs == rhs);
317317 }
318- friend constexpr auto operator >(const uint128_fallback & lhs,
319- const uint128_fallback& rhs) -> bool {
318+ friend constexpr auto operator >(const uint128 & lhs, const uint128& rhs)
319+ -> bool {
320320 return lhs.hi_ != rhs.hi_ ? lhs.hi_ > rhs.hi_ : lhs.lo_ > rhs.lo_ ;
321321 }
322- friend constexpr auto operator |(const uint128_fallback& lhs,
323- const uint128_fallback& rhs)
324- -> uint128_fallback {
322+ friend constexpr auto operator |(const uint128& lhs, const uint128& rhs)
323+ -> uint128 {
325324 return {lhs.hi_ | rhs.hi_ , lhs.lo_ | rhs.lo_ };
326325 }
327- friend constexpr auto operator &(const uint128_fallback& lhs,
328- const uint128_fallback& rhs)
329- -> uint128_fallback {
326+ friend constexpr auto operator &(const uint128& lhs, const uint128& rhs)
327+ -> uint128 {
330328 return {lhs.hi_ & rhs.hi_ , lhs.lo_ & rhs.lo_ };
331329 }
332- friend constexpr auto operator ~(const uint128_fallback& n)
333- -> uint128_fallback {
334- return {~n.hi_ , ~n.lo_ };
335- }
336- friend FMT_CONSTEXPR auto operator +(const uint128_fallback& lhs,
337- const uint128_fallback& rhs)
338- -> uint128_fallback {
339- auto result = uint128_fallback (lhs);
330+ friend FMT_CONSTEXPR auto operator +(const uint128& lhs, const uint128& rhs)
331+ -> uint128 {
332+ auto result = uint128 (lhs);
340333 result += rhs;
341334 return result;
342335 }
343- friend FMT_CONSTEXPR auto operator *(const uint128_fallback & lhs, uint32_t rhs)
344- -> uint128_fallback {
336+ friend FMT_CONSTEXPR auto operator *(const uint128 & lhs, uint32_t rhs)
337+ -> uint128 {
345338 FMT_ASSERT (lhs.hi_ == 0 , " " );
346339 uint64_t hi = (lhs.lo_ >> 32 ) * rhs;
347340 uint64_t lo = (lhs.lo_ & ~uint32_t ()) * rhs;
348341 uint64_t new_lo = (hi << 32 ) + lo;
349342 return {(hi >> 32 ) + (new_lo < lo ? 1 : 0 ), new_lo};
350343 }
351- friend constexpr auto operator -(const uint128_fallback& lhs, uint64_t rhs)
352- -> uint128_fallback {
344+ friend constexpr auto operator -(const uint128& lhs, uint64_t rhs) -> uint128 {
353345 return {lhs.hi_ - (lhs.lo_ < rhs ? 1 : 0 ), lhs.lo_ - rhs};
354346 }
355- FMT_CONSTEXPR auto operator >>(int shift) const -> uint128_fallback {
347+ FMT_CONSTEXPR auto operator >>(int shift) const -> uint128 {
356348 if (shift == 64 ) return {0 , hi_};
357- if (shift > 64 ) return uint128_fallback (0 , hi_) >> (shift - 64 );
349+ if (shift > 64 ) return uint128 (0 , hi_) >> (shift - 64 );
358350 return {hi_ >> shift, (hi_ << (64 - shift)) | (lo_ >> shift)};
359351 }
360- FMT_CONSTEXPR auto operator <<(int shift) const -> uint128_fallback {
352+ FMT_CONSTEXPR auto operator <<(int shift) const -> uint128 {
361353 if (shift == 64 ) return {lo_, 0 };
362- if (shift > 64 ) return uint128_fallback (lo_, 0 ) << (shift - 64 );
354+ if (shift > 64 ) return uint128 (lo_, 0 ) << (shift - 64 );
363355 return {hi_ << shift | (lo_ >> (64 - shift)), (lo_ << shift)};
364356 }
365- FMT_CONSTEXPR auto operator >>=(int shift) -> uint128_fallback & {
357+ FMT_CONSTEXPR auto operator >>=(int shift) -> uint128 & {
366358 return *this = *this >> shift;
367359 }
368- FMT_CONSTEXPR void operator +=(uint128_fallback n) {
360+ FMT_CONSTEXPR void operator +=(uint128 n) {
369361 uint64_t new_lo = lo_ + n.lo_ ;
370362 uint64_t new_hi = hi_ + n.hi_ + (new_lo < lo_ ? 1 : 0 );
371363 FMT_ASSERT (new_hi >= hi_, " " );
372364 lo_ = new_lo;
373365 hi_ = new_hi;
374366 }
375- FMT_CONSTEXPR void operator &=(uint128_fallback n) {
367+ FMT_CONSTEXPR void operator &=(uint128 n) {
376368 lo_ &= n.lo_ ;
377369 hi_ &= n.hi_ ;
378370 }
379371
380- FMT_CONSTEXPR20 auto operator +=(uint64_t n) noexcept -> uint128_fallback & {
372+ FMT_CONSTEXPR20 auto operator +=(uint64_t n) noexcept -> uint128 & {
381373 if (is_constant_evaluated ()) {
382374 lo_ += n;
383375 hi_ += (lo_ < n ? 1 : 0 );
@@ -403,8 +395,7 @@ class uint128_fallback {
403395 }
404396};
405397
406- using uint128_t =
407- conditional_t <FMT_USE_INT128, native_uint128, uint128_fallback>;
398+ using uint128_t = conditional_t <FMT_USE_INT128, native_uint128, uint128>;
408399
409400#ifdef UINTPTR_MAX
410401using uintptr_t = ::uintptr_t ;
@@ -423,10 +414,10 @@ template <typename T> constexpr auto num_bits() -> int {
423414// std::numeric_limits<T>::digits may return 0 for 128-bit ints.
424415template <> constexpr auto num_bits<native_int128>() -> int { return 128 ; }
425416template <> constexpr auto num_bits<native_uint128>() -> int { return 128 ; }
426- template <> constexpr auto num_bits<uint128_fallback >() -> int { return 128 ; }
417+ template <> constexpr auto num_bits<uint128 >() -> int { return 128 ; }
427418
428419// A heterogeneous bit_cast used for converting 96-bit long double to uint128_t
429- // and 128-bit pointers to uint128_fallback .
420+ // and 128-bit pointers to uint128 .
430421template <typename To, typename From, FMT_ENABLE_IF(sizeof (To) > sizeof (From))>
431422inline auto bit_cast (const From& from) -> To {
432423 constexpr auto size = static_cast <int >(sizeof (From) / sizeof (unsigned short ));
@@ -1472,7 +1463,7 @@ template <typename WChar, typename Buffer = memory_buffer> class to_utf8 {
14721463};
14731464
14741465// Computes 128-bit result of multiplication of two 64-bit unsigned integers.
1475- FMT_INLINE auto umul128 (uint64_t x, uint64_t y) noexcept -> uint128_fallback {
1466+ FMT_INLINE auto umul128 (uint64_t x, uint64_t y) noexcept -> uint128 {
14761467#if FMT_USE_INT128
14771468 auto p = static_cast <native_uint128>(x) * static_cast <native_uint128>(y);
14781469 return {static_cast <uint64_t >(p >> 64 ), static_cast <uint64_t >(p)};
@@ -1528,14 +1519,13 @@ inline auto umul128_upper64(uint64_t x, uint64_t y) noexcept -> uint64_t {
15281519
15291520// Computes upper 128 bits of multiplication of a 64-bit unsigned integer and a
15301521// 128-bit unsigned integer.
1531- inline auto umul192_upper128 (uint64_t x, uint128_fallback y) noexcept
1532- -> uint128_fallback {
1533- uint128_fallback r = umul128 (x, y.high ());
1522+ inline auto umul192_upper128 (uint64_t x, uint128 y) noexcept -> uint128 {
1523+ uint128 r = umul128 (x, y.high ());
15341524 r += umul128_upper64 (x, y.low ());
15351525 return r;
15361526}
15371527
1538- FMT_API auto get_cached_power (int k) noexcept -> uint128_fallback ;
1528+ FMT_API auto get_cached_power (int k) noexcept -> uint128 ;
15391529
15401530// Type-specific information that Dragonbox uses.
15411531template <typename T, typename Enable = void > struct float_info ;
0 commit comments