mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-02-08 18:56:45 +08:00
Minor optimization.
This commit is contained in:
parent
3d0e448940
commit
8b7a55a03c
@ -83,6 +83,7 @@ fastfloat_really_inline bool rounds_to_nearest() noexcept {
|
|||||||
// value so that 1 + x should round to 1 would do (after accounting for excess
|
// value so that 1 + x should round to 1 would do (after accounting for excess
|
||||||
// precision, as in 387).
|
// precision, as in 387).
|
||||||
static volatile float fmin = std::numeric_limits<float>::min();
|
static volatile float fmin = std::numeric_limits<float>::min();
|
||||||
|
float fmini = fmin; // we copy it so that it gets loaded at most once.
|
||||||
//
|
//
|
||||||
// Explanation:
|
// Explanation:
|
||||||
// Only when fegetround() == FE_TONEAREST do we have that
|
// Only when fegetround() == FE_TONEAREST do we have that
|
||||||
@ -105,7 +106,7 @@ fastfloat_really_inline bool rounds_to_nearest() noexcept {
|
|||||||
//
|
//
|
||||||
// Note: This may fail to be accurate if fast-math has been
|
// Note: This may fail to be accurate if fast-math has been
|
||||||
// enabled, as rounding conventions may not apply.
|
// enabled, as rounding conventions may not apply.
|
||||||
return (fmin + 1.0f == 1.0f - fmin);
|
return (fmini + 1.0f == 1.0f - fmini);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user