From 3be0cc208717d13ca272d5faeab62d8127b789fc Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 13 May 2021 17:53:23 -0700 Subject: [PATCH] Fix handling of 128-bit ints --- include/fmt/format.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 089f042d..a27fcf70 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -815,6 +815,10 @@ class FMT_API format_error : public std::runtime_error { FMT_MODULE_EXPORT_END namespace detail { +template struct is_integral : std::is_integral {}; +template <> struct is_integral : std::true_type {}; +template <> struct is_integral : std::true_type {}; + template using is_signed = std::integral_constant::is_signed || @@ -1607,8 +1611,7 @@ FMT_CONSTEXPR inline void prefix_append(unsigned& prefix, unsigned value) { } template ::value && - !std::is_same::value)> + FMT_ENABLE_IF(is_integral::value && !std::is_same::value)> FMT_CONSTEXPR FMT_INLINE OutputIt write_int(OutputIt out, T value, const basic_format_specs& specs, locale_ref loc) { @@ -1674,7 +1677,7 @@ write_int(OutputIt out, T value, const basic_format_specs& specs, return out; } template ::value && + FMT_ENABLE_IF(is_integral::value && !std::is_same::value && std::is_same>::value)> FMT_CONSTEXPR OutputIt write(OutputIt out, T value, @@ -1682,9 +1685,9 @@ FMT_CONSTEXPR OutputIt write(OutputIt out, T value, locale_ref loc) { return write_int(out, value, specs, loc); } -// An inlined version of format_int used in format string compilation. +// An inlined version of write used in format string compilation. template ::value && + FMT_ENABLE_IF(is_integral::value && !std::is_same::value && !std::is_same>::value)> FMT_CONSTEXPR FMT_INLINE OutputIt write(OutputIt out, T value, @@ -1991,10 +1994,6 @@ OutputIt write_ptr(OutputIt out, UIntPtr value, : base_iterator(out, write(reserve(out, size))); } -template struct is_integral : std::is_integral {}; -template <> struct is_integral : std::true_type {}; -template <> struct is_integral : std::true_type {}; - template OutputIt write(OutputIt out, monostate) { FMT_ASSERT(false, "");