From 38139664979e4de480980f1fdf307d6e8b99d2c0 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 13 Sep 2020 11:27:34 -0700 Subject: [PATCH] Simplify fallback format --- include/fmt/format-inl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 7c58cfe2..42495300 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -1002,9 +1002,9 @@ void fallback_format(Double d, int num_digits, bool binary32, buffer& buf, // Shift numerator and denominator by an extra bit or two (if lower boundary // is closer) to make lower and upper integers. This eliminates multiplication // by 2 during later computations. - int shift = (binary32 ? value.assign(static_cast(d)) : value.assign(d)) - ? 2 - : 1; + const bool is_predecessor_closer = + binary32 ? value.assign(static_cast(d)) : value.assign(d); + int shift = is_predecessor_closer ? 2 : 1; uint64_t significand = value.f << shift; if (value.e >= 0) { numerator.assign(significand);