mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-10 05:10:05 +00:00
Workaround broken numeric_limits (#1725)
This commit is contained in:
parent
2b7a146fa1
commit
229ee9b469
@ -283,6 +283,9 @@ template <typename T> constexpr T max_value() {
|
||||
template <typename T> constexpr int num_bits() {
|
||||
return std::numeric_limits<T>::digits;
|
||||
}
|
||||
// std::numeric_limits<T>::digits may return 0 for 128-bit ints.
|
||||
template <> constexpr int num_bits<int128_t>() { return 128; }
|
||||
template <> constexpr int num_bits<uint128_t>() { return 128; }
|
||||
template <> constexpr int num_bits<fallback_uintptr>() {
|
||||
return static_cast<int>(sizeof(void*) *
|
||||
std::numeric_limits<unsigned char>::digits);
|
||||
@ -743,8 +746,8 @@ FMT_CONSTEXPR bool is_supported_floating_point(T) {
|
||||
// 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>>;
|
||||
num_bits<T>() <= 32, uint32_t,
|
||||
conditional_t<num_bits<T>() <= 64, uint64_t, uint128_t>>;
|
||||
|
||||
// Static data is placed in this class template for the header-only config.
|
||||
template <typename T = void> struct FMT_EXTERN_TEMPLATE_API basic_data {
|
||||
|
Loading…
Reference in New Issue
Block a user