Renam flag to FMT_REDUCE_INT_INSTANTIATIONS

Add comment above FMT_REDUCE_INT_INSTANTIATIONS definition describing
why a developer would use it.
This commit is contained in:
Khalil Estell 2020-07-19 09:23:36 -07:00
parent cb0a609280
commit e136a9dd88
2 changed files with 12 additions and 8 deletions

View File

@ -311,8 +311,12 @@ struct int128_t {};
struct uint128_t {};
#endif
#if !defined(FMT_USE_SMALLEST_INT)
#define FMT_USE_SMALLEST_INT 1
// Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of
// int_writer template instances to just one by only using the largest integer
// type. This results in a reduction in binary size but will cause a decrease in
// integer formatting performance.
#if !defined(FMT_REDUCE_INT_INSTANTIATIONS)
# define FMT_REDUCE_INT_INSTANTIATIONS 0
#endif
// Casts a nonnegative integer to unsigned.

View File

@ -726,18 +726,18 @@ FMT_CONSTEXPR bool is_supported_floating_point(T) {
(std::is_same<T, long double>::value && FMT_USE_LONG_DOUBLE);
}
#if FMT_USE_SMALLEST_INT
#if FMT_REDUCE_INT_INSTANTIATIONS
// Pick the largest integer container to represent all values of T.
template <typename T>
using uint32_or_64_or_128_t =
conditional_t<sizeof(uint128_t) < sizeof(uint64_t), uint64_t, uint128_t>;
#else
// Smallest of uint32_t, uint64_t, uint128_t that is large enough to
// represent all values of T.
template <typename T>
using uint32_or_64_or_128_t = conditional_t<
std::numeric_limits<T>::digits <= 32, uint32_t,
conditional_t<std::numeric_limits<T>::digits <= 64, uint64_t, uint128_t>>;
#else
// Pick the largest integer container to represent represent all values of T.
template <typename T>
using uint32_or_64_or_128_t =
conditional_t<sizeof(uint128_t) < sizeof(uint64_t), uint64_t, uint128_t>;
#endif
// Static data is placed in this class template for the header-only config.