Skip to content

Commit 27d0c03

Browse files
committed
Minor cleanup
1 parent 03cfb86 commit 27d0c03

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

include/fmt/format.h

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,25 +3161,9 @@ constexpr auto fractional_part_rounding_thresholds(int index) -> uint32_t {
31613161
// It is equal to ceil(2^31 + 2^32/10^(k + 1)).
31623162
// These are stored in a string literal because we cannot have static arrays
31633163
// in constexpr functions and non-static ones are poorly optimized.
3164-
3165-
// while in C++23 we can use static constexpr, and in c++17 we can use out of
3166-
// function definition of inline constexpr, in C++11 we have to rely on string
3167-
// literals in order to avoid duplicating constant definitions across
3168-
// translation units. We take the following uint32 array definition:
3169-
// {0x9999999au, 0x828f5c29u, 0x80418938u, 0x80068db9,
3170-
// 0x8000a7c6u, 0x800010c7u, 0x800001aeu, 0x8000002b};
3171-
// and convert that into a series of char hexidecimal literals in a char16_t
3172-
// array:
3173-
// "\x9999\x999a \x828f\x5c29 \x8041\x8938 \x8006\x8db9
3174-
// \x8000\xa7c6 \x8000\x10c7 \x8000\x01ae \x8000\x002b";
3175-
// Then we split this up into two separate arrays of char16_ts, so they can
3176-
// be properly recombined into uint32_t.
3177-
3178-
return static_cast<uint32_t>(
3179-
u"\x9999\x828f\x8041\x8006\x8000\x8000\x8000\x8000"[index])
3164+
return uint32_t(u"\x9999\x828f\x8041\x8006\x8000\x8000\x8000\x8000"[index])
31803165
<< 16u |
3181-
static_cast<uint32_t>(
3182-
u"\x999a\x5c29\x8938\x8db9\xa7c6\x10c7\x01ae\x002b"[index]);
3166+
uint32_t(u"\x999a\x5c29\x8938\x8db9\xa7c6\x10c7\x01ae\x002b"[index]);
31833167
}
31843168

31853169
template <typename Float>

0 commit comments

Comments
 (0)