mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Optimize handling of integer constants
This commit is contained in:
@ -244,11 +244,6 @@ const typename basic_data<T>::digit_pair basic_data<T>::digits[] = {
|
|||||||
{'9', '0'}, {'9', '1'}, {'9', '2'}, {'9', '3'}, {'9', '4'}, {'9', '5'},
|
{'9', '0'}, {'9', '1'}, {'9', '2'}, {'9', '3'}, {'9', '4'}, {'9', '5'},
|
||||||
{'9', '6'}, {'9', '7'}, {'9', '8'}, {'9', '9'}};
|
{'9', '6'}, {'9', '7'}, {'9', '8'}, {'9', '9'}};
|
||||||
|
|
||||||
#define FMT_POWERS_OF_10(factor) \
|
|
||||||
factor * 10, (factor)*100, (factor)*1000, (factor)*10000, (factor)*100000, \
|
|
||||||
(factor)*1000000, (factor)*10000000, (factor)*100000000, \
|
|
||||||
(factor)*1000000000
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const uint64_t basic_data<T>::powers_of_10_64[] = {
|
const uint64_t basic_data<T>::powers_of_10_64[] = {
|
||||||
1, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL),
|
1, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL),
|
||||||
@ -263,8 +258,7 @@ const uint64_t basic_data<T>::zero_or_powers_of_10_64[] = {
|
|||||||
10000000000000000000ULL};
|
10000000000000000000ULL};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const uint32_t basic_data<T>::zero_or_powers_of_10_32_new[] = {
|
constexpr uint32_t basic_data<T>::zero_or_powers_of_10_32_new[];
|
||||||
0, 0, FMT_POWERS_OF_10(1)};
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const uint64_t basic_data<T>::zero_or_powers_of_10_64_new[] = {
|
const uint64_t basic_data<T>::zero_or_powers_of_10_64_new[] = {
|
||||||
|
@ -1024,10 +1024,16 @@ template <typename T> struct FMT_EXTERN_TEMPLATE_API divtest_table_entry {
|
|||||||
T max_quotient;
|
T max_quotient;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define FMT_POWERS_OF_10(factor) \
|
||||||
|
factor * 10u, (factor)*100u, (factor)*1000u, (factor)*10000u, \
|
||||||
|
(factor)*100000u, (factor)*1000000u, (factor)*10000000u, \
|
||||||
|
(factor)*100000000u, (factor)*1000000000u
|
||||||
|
|
||||||
// Static data is placed in this class template for the header-only config.
|
// Static data is placed in this class template for the header-only config.
|
||||||
template <typename T = void> struct FMT_EXTERN_TEMPLATE_API basic_data {
|
template <typename T = void> struct FMT_EXTERN_TEMPLATE_API basic_data {
|
||||||
static const uint64_t powers_of_10_64[];
|
static const uint64_t powers_of_10_64[];
|
||||||
static const uint32_t zero_or_powers_of_10_32_new[];
|
static constexpr uint32_t zero_or_powers_of_10_32_new[] = {
|
||||||
|
0, 0, FMT_POWERS_OF_10(1)};
|
||||||
static const uint64_t zero_or_powers_of_10_64_new[];
|
static const uint64_t zero_or_powers_of_10_64_new[];
|
||||||
static const uint64_t grisu_pow10_significands[];
|
static const uint64_t grisu_pow10_significands[];
|
||||||
static const int16_t grisu_pow10_exponents[];
|
static const int16_t grisu_pow10_exponents[];
|
||||||
|
Reference in New Issue
Block a user