From 8443e25c4507863f29e759e1378d33d8e28c501a Mon Sep 17 00:00:00 2001 From: Nick Gerrets Date: Wed, 28 Feb 2024 10:53:16 +0100 Subject: [PATCH] fix for hugeint --- third_party/fmt/include/fmt/format.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/third_party/fmt/include/fmt/format.h b/third_party/fmt/include/fmt/format.h index 7596d96703fa..fd64fa394660 100644 --- a/third_party/fmt/include/fmt/format.h +++ b/third_party/fmt/include/fmt/format.h @@ -249,11 +249,11 @@ template constexpr T max_value() { return duckdb::NumericLimits::Maximum(); } template constexpr int num_bits() { - return duckdb::NumericLimits::Digits(); + return duckdb::NumericLimits::Radix(); } template <> constexpr int num_bits() { return static_cast(sizeof(void*) * - duckdb::NumericLimits::Digits()); + duckdb::NumericLimits::Radix()); } // An approximation of iterator_t for pre-C++20 systems. @@ -698,8 +698,8 @@ FMT_CONSTEXPR bool is_negative(T) { // represent all values of T. template using uint32_or_64_or_128_t = conditional_t< - duckdb::NumericLimits::Digits() <= 32, uint32_t, - conditional_t::Digits() <= 64, uint64_t, uint128_t>>; + duckdb::NumericLimits::Radix() <= 32, uint32_t, + conditional_t::Radix() <= 64, uint64_t, uint128_t>>; // Static data is placed in this class template for the header-only config. template struct FMT_EXTERN_TEMPLATE_API basic_data { @@ -836,7 +836,7 @@ inline Char* format_decimal(Char* buffer, UInt value, int num_digits, add_thousands_sep(buffer); } if (value < 10) { - *--buffer = static_cast('0' + value); + *--buffer = '0' + static_cast(value); return end; } auto index = static_cast(value * 2); @@ -847,7 +847,7 @@ inline Char* format_decimal(Char* buffer, UInt value, int num_digits, } template constexpr int digits10() noexcept { - return std::numeric_limits::digits10; + return duckdb::NumericLimits::Digits(); } template <> constexpr int digits10() noexcept { return 38; } template <> constexpr int digits10() noexcept { return 38; } @@ -875,7 +875,7 @@ inline Char* format_uint(Char* buffer, UInt value, int num_digits, Char* end = buffer; do { const char* digits = upper ? "0123456789ABCDEF" : data::hex_digits; - unsigned digit = (value & ((1 << BASE_BITS) - 1)); + unsigned digit = static_cast(value & ((1 << BASE_BITS) - 1)); *--buffer = static_cast(BASE_BITS < 4 ? static_cast('0' + digit) : digits[digit]); } while ((value >>= BASE_BITS) != 0); @@ -885,7 +885,7 @@ inline Char* format_uint(Char* buffer, UInt value, int num_digits, template Char* format_uint(Char* buffer, internal::fallback_uintptr n, int num_digits, bool = false) { - auto char_digits = duckdb::NumericLimits::Digits() / 4; + auto char_digits = std::numeric_limits::digits / 4; int start = (num_digits + char_digits - 1) / char_digits - 1; if (int start_digits = num_digits % char_digits) { unsigned value = n.value[start--]; @@ -1412,7 +1412,7 @@ template class basic_writer { if (is_negative(value)) { prefix[0] = '-'; ++prefix_size; - abs_value = 0 - abs_value; + abs_value = unsigned_type(0) - abs_value; } else if (specs.sign != sign::none && specs.sign != sign::minus) { prefix[0] = specs.sign == sign::plus ? '+' : ' '; ++prefix_size;