From 1ba69fb5a183ed0808123d849560abd19063f770 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 21 Feb 2022 07:47:14 -0800 Subject: [PATCH] Remove snprintf FP fallback --- include/fmt/core.h | 1 - include/fmt/format-inl.h | 10 +++------- include/fmt/format.h | 3 --- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index dbefe110..1c81bbd2 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -2728,7 +2728,6 @@ struct float_specs { bool upper : 1; bool locale : 1; bool binary32 : 1; - bool fallback : 1; bool showpoint : 1; }; diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index f8fa77e8..988e3a0d 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -239,7 +239,8 @@ template struct basic_fp { } template - using is_supported = bool_constant::digits <= 64>; + using is_supported = bool_constant::is_iec559 && + std::numeric_limits::digits <= 64>; // Assigns d to this and return true iff predecessor is closer than successor. template ::value)> @@ -268,10 +269,7 @@ template struct basic_fp { } template ::value)> - bool assign(Float) { - FMT_ASSERT(false, ""); - return false; - } + bool assign(Float) = delete; }; using fp = basic_fp; @@ -2207,8 +2205,6 @@ FMT_HEADER_ONLY_CONSTEXPR20 int format_float(Float value, int precision, return -precision; } - if (specs.fallback) return snprintf_float(value, precision, specs, buf); - int exp = 0; bool use_dragon = true; if (!is_fast_float()) { diff --git a/include/fmt/format.h b/include/fmt/format.h index 4b62b3c9..dae4d37e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2260,9 +2260,6 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value, precision = 1; } if (const_check(std::is_same())) fspecs.binary32 = true; - using limits = std::numeric_limits; - if (const_check(!limits::is_iec559 || limits::digits > 64)) - fspecs.fallback = true; int exp = format_float(convert_float(value), precision, fspecs, buffer); fspecs.precision = precision; auto fp = big_decimal_fp{buffer.data(), static_cast(buffer.size()), exp};