mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-09-14 14:42:26 +08:00
More cleanup by FASTFLOAT_ONLY_ROUNDS_TO_NEAREST_SUPPORTED.
This commit is contained in:
parent
24093f4152
commit
bc1316970c
@ -1186,7 +1186,7 @@ template <>
|
||||
inline constexpr am_mant_t
|
||||
binary_format<double>::max_mantissa_fast_path(am_pow_t power) {
|
||||
// caller is responsible to ensure that
|
||||
FASTFLOAT_ASSUME(power >= 0 && power <= 22);
|
||||
// FASTFLOAT_ASSUME(power >= 0 && power <= 22);
|
||||
#if defined(__clang__)
|
||||
// Work around clang bug https://godbolt.org/z/zedh7rrhc
|
||||
return (void)max_mantissa[0], max_mantissa[power];
|
||||
@ -1199,7 +1199,7 @@ template <>
|
||||
inline constexpr am_mant_t
|
||||
binary_format<float>::max_mantissa_fast_path(am_pow_t power) {
|
||||
// caller is responsible to ensure that
|
||||
FASTFLOAT_ASSUME(power >= 0 && power <= 10);
|
||||
// FASTFLOAT_ASSUME(power >= 0 && power <= 10);
|
||||
#if defined(__clang__)
|
||||
// Work around clang bug https://godbolt.org/z/zedh7rrhc
|
||||
return (void)max_mantissa[0], max_mantissa[power];
|
||||
@ -1212,7 +1212,7 @@ template <>
|
||||
inline constexpr double
|
||||
binary_format<double>::exact_power_of_ten(am_pow_t power) {
|
||||
// caller is responsible to ensure that
|
||||
FASTFLOAT_ASSUME(power >= 0 && power <= 22);
|
||||
// FASTFLOAT_ASSUME(power >= 0 && power <= 22);
|
||||
#if defined(__clang__)
|
||||
// Work around clang bug https://godbolt.org/z/zedh7rrhc
|
||||
return (void)powers_of_ten[0], powers_of_ten[power];
|
||||
@ -1225,7 +1225,7 @@ template <>
|
||||
inline constexpr float
|
||||
binary_format<float>::exact_power_of_ten(am_pow_t power) {
|
||||
// caller is responsible to ensure that
|
||||
FASTFLOAT_ASSUME(power >= 0 && power <= 10);
|
||||
// FASTFLOAT_ASSUME(power >= 0 && power <= 10);
|
||||
#if defined(__clang__)
|
||||
// Work around clang bug https://godbolt.org/z/zedh7rrhc
|
||||
return (void)powers_of_ten[0], powers_of_ten[power];
|
||||
|
||||
@ -218,11 +218,9 @@ clinger_fast_path_impl(am_mant_t const mantissa, am_pow_t const exponent,
|
||||
// We could check it first (before the previous branch), but
|
||||
// there might be performance advantages at having the check
|
||||
// be last.
|
||||
if (!is_constant_evaluated()
|
||||
#ifndef FASTFLOAT_ONLY_ROUNDS_TO_NEAREST_SUPPORTED
|
||||
&& detail::rounds_to_nearest()
|
||||
if (detail::rounds_to_nearest()) {
|
||||
#endif
|
||||
) {
|
||||
// We have that fegetround() == FE_TONEAREST.
|
||||
// Next is Clinger's fast path.
|
||||
if (mantissa <= binary_format<T>::max_mantissa_fast_path()) {
|
||||
@ -238,6 +236,7 @@ clinger_fast_path_impl(am_mant_t const mantissa, am_pow_t const exponent,
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
#ifndef FASTFLOAT_ONLY_ROUNDS_TO_NEAREST_SUPPORTED
|
||||
}
|
||||
} else {
|
||||
// We do not have that fegetround() == FE_TONEAREST.
|
||||
@ -265,6 +264,7 @@ clinger_fast_path_impl(am_mant_t const mantissa, am_pow_t const exponent,
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user