mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-10 06:20:09 +00:00
Remove data::hex_digits
This commit is contained in:
parent
ad77331c04
commit
3a04481485
@ -154,7 +154,6 @@ static constexpr uint64_t log10_2_significand = 0x4d104d427de7fbcc;
|
||||
|
||||
#if __cplusplus < 201703L
|
||||
template <typename T> constexpr const char basic_data<T>::digits[][2];
|
||||
template <typename T> constexpr const char basic_data<T>::hex_digits[];
|
||||
template <typename T> constexpr const unsigned basic_data<T>::prefixes[];
|
||||
#endif
|
||||
|
||||
@ -916,8 +915,7 @@ inline uint64_t umul96_lower64(uint32_t x, uint64_t y) FMT_NOEXCEPT {
|
||||
inline int floor_log10_pow2(int e) FMT_NOEXCEPT {
|
||||
FMT_ASSERT(e <= 1700 && e >= -1700, "too large exponent");
|
||||
const int shift = 22;
|
||||
return (e * static_cast<int>(log10_2_significand >> (64 - shift))) >>
|
||||
shift;
|
||||
return (e * static_cast<int>(log10_2_significand >> (64 - shift))) >> shift;
|
||||
}
|
||||
|
||||
// Various fast log computations.
|
||||
@ -935,8 +933,7 @@ inline int floor_log10_pow2_minus_log10_4_over_3(int e) FMT_NOEXCEPT {
|
||||
FMT_ASSERT(e <= 1700 && e >= -1700, "too large exponent");
|
||||
const uint64_t log10_4_over_3_fractional_digits = 0x1ffbfc2bbc780375;
|
||||
const int shift_amount = 22;
|
||||
return (e * static_cast<int>(log10_2_significand >>
|
||||
(64 - shift_amount)) -
|
||||
return (e * static_cast<int>(log10_2_significand >> (64 - shift_amount)) -
|
||||
static_cast<int>(log10_4_over_3_fractional_digits >>
|
||||
(64 - shift_amount))) >>
|
||||
shift_amount;
|
||||
|
@ -905,7 +905,6 @@ template <typename T = void> struct basic_data {
|
||||
{'9', '0'}, {'9', '1'}, {'9', '2'}, {'9', '3'}, {'9', '4'}, {'9', '5'},
|
||||
{'9', '6'}, {'9', '7'}, {'9', '8'}, {'9', '9'}};
|
||||
|
||||
FMT_API static constexpr const char hex_digits[] = "0123456789abcdef";
|
||||
FMT_API static constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+',
|
||||
0x1000000u | ' '};
|
||||
};
|
||||
@ -1135,7 +1134,7 @@ FMT_CONSTEXPR auto format_uint(Char* buffer, UInt value, int num_digits,
|
||||
buffer += num_digits;
|
||||
Char* end = buffer;
|
||||
do {
|
||||
const char* digits = upper ? "0123456789ABCDEF" : data::hex_digits;
|
||||
const char* digits = upper ? "0123456789ABCDEF" : "0123456789abcdef";
|
||||
unsigned digit = (value & ((1 << BASE_BITS) - 1));
|
||||
*--buffer = static_cast<Char>(BASE_BITS < 4 ? static_cast<char>('0' + digit)
|
||||
: digits[digit]);
|
||||
@ -1158,7 +1157,7 @@ auto format_uint(Char* buffer, detail::fallback_uintptr n, int num_digits,
|
||||
auto p = buffer;
|
||||
for (int i = 0; i < char_digits; ++i) {
|
||||
unsigned digit = (value & ((1 << BASE_BITS) - 1));
|
||||
*--p = static_cast<Char>(data::hex_digits[digit]);
|
||||
*--p = static_cast<Char>("0123456789abcdef"[digit]);
|
||||
value >>= BASE_BITS;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user