@@ -3259,21 +3259,15 @@ FMT_CONSTEXPR20 void format_hexfloat(Float value, int precision,
3259
3259
format_hexfloat (static_cast <double >(value), precision, specs, buf);
3260
3260
}
3261
3261
3262
- FMT_CONSTEXPR inline uint32_t fractional_part_rounding_thresholds (int index) {
3262
+ constexpr uint32_t fractional_part_rounding_thresholds (int index) {
3263
3263
// For checking rounding thresholds.
3264
3264
// The kth entry is chosen to be the smallest integer such that the
3265
3265
// upper 32-bits of 10^(k+1) times it is strictly bigger than 5 * 10^k.
3266
- constexpr uint32_t thresholds[8 ] = {
3267
- 2576980378U , // ceil(2^31 + 2^32/10^1)
3268
- 2190433321U , // ceil(2^31 + 2^32/10^2)
3269
- 2151778616U , // ceil(2^31 + 2^32/10^3)
3270
- 2147913145U , // ceil(2^31 + 2^32/10^4)
3271
- 2147526598U , // ceil(2^31 + 2^32/10^5)
3272
- 2147487943U , // ceil(2^31 + 2^32/10^6)
3273
- 2147484078U , // ceil(2^31 + 2^32/10^7)
3274
- 2147483691U // ceil(2^31 + 2^32/10^8)
3275
- };
3276
- return thresholds[index ];
3266
+ // It is equal to ceil(2^31 + 2^32/10^(k + 1)).
3267
+ // These are stored in a string literal because we cannot have static arrays
3268
+ // in constexpr functions and non-static ones are poorly optimized.
3269
+ return U" \x9999999a\x828f5c29\x80418938\x80068db9\x8000a7c6\x800010c7 "
3270
+ U" \x800001ae\x8000002b " [index ];
3277
3271
}
3278
3272
3279
3273
template <typename Float>
0 commit comments