mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-29 05:11:05 +00:00
Remove snprintf FP fallback
This commit is contained in:
parent
ea6f0bf0e5
commit
1ba69fb5a1
@ -2728,7 +2728,6 @@ struct float_specs {
|
||||
bool upper : 1;
|
||||
bool locale : 1;
|
||||
bool binary32 : 1;
|
||||
bool fallback : 1;
|
||||
bool showpoint : 1;
|
||||
};
|
||||
|
||||
|
@ -239,7 +239,8 @@ template <typename F> struct basic_fp {
|
||||
}
|
||||
|
||||
template <typename Float>
|
||||
using is_supported = bool_constant<std::numeric_limits<Float>::digits <= 64>;
|
||||
using is_supported = bool_constant<std::numeric_limits<Float>::is_iec559 &&
|
||||
std::numeric_limits<Float>::digits <= 64>;
|
||||
|
||||
// Assigns d to this and return true iff predecessor is closer than successor.
|
||||
template <typename Float, FMT_ENABLE_IF(is_supported<Float>::value)>
|
||||
@ -268,10 +269,7 @@ template <typename F> struct basic_fp {
|
||||
}
|
||||
|
||||
template <typename Float, FMT_ENABLE_IF(!is_supported<Float>::value)>
|
||||
bool assign(Float) {
|
||||
FMT_ASSERT(false, "");
|
||||
return false;
|
||||
}
|
||||
bool assign(Float) = delete;
|
||||
};
|
||||
|
||||
using fp = basic_fp<unsigned long long>;
|
||||
@ -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<Float>()) {
|
||||
|
@ -2260,9 +2260,6 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value,
|
||||
precision = 1;
|
||||
}
|
||||
if (const_check(std::is_same<T, float>())) fspecs.binary32 = true;
|
||||
using limits = std::numeric_limits<T>;
|
||||
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<int>(buffer.size()), exp};
|
||||
|
Loading…
Reference in New Issue
Block a user