diff --git a/include/fmt/format.h b/include/fmt/format.h index 9e867606..9344ac0d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -254,11 +254,12 @@ inline fallback_uintptr to_uintptr(const void* p) { template constexpr T max_value() { return (std::numeric_limits::max)(); } -template constexpr int digits() { +template constexpr int num_bits() { return std::numeric_limits::digits; } -template <> constexpr int digits() { - return sizeof(void*) * std::numeric_limits::digits; +template <> constexpr int num_bits() { + return static_cast(sizeof(void*) * + std::numeric_limits::digits); } // An approximation of iterator_t for pre-C++20 systems. @@ -979,7 +980,7 @@ Char* format_uint(Char* buffer, internal::fallback_uintptr n, int num_digits, template inline It format_uint(It out, UInt value, int num_digits, bool upper = false) { // Buffer should be large enough to hold all digits (digits / BASE_BITS + 1). - char buffer[digits() / BASE_BITS + 1]; + char buffer[num_bits() / BASE_BITS + 1]; format_uint(buffer, value, num_digits, upper); return internal::copy_str(buffer, buffer + num_digits, out); }