From 5aa1b4d92a1698da7bcdcc954ac61b778095f35e Mon Sep 17 00:00:00 2001 From: Ivan Shynkarenka Date: Mon, 21 Oct 2019 11:28:06 +0300 Subject: [PATCH] format-inl.h(444,1): warning C4804: '>>': unsafe use of type 'bool' in operation format.h(2808,1): warning C4127: conditional expression is constant --- include/fmt/format-inl.h | 2 +- include/fmt/format.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 582c6193..fb4b4b1c 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -441,7 +441,7 @@ class fp { std::numeric_limits::digits - 1); if (min_normal_e > e) half_ulp <<= min_normal_e - e; upper = normalize<0>(fp(f + half_ulp, e)); - lower = fp(f - (half_ulp >> (f == implicit_bit && e > min_normal_e)), e); + lower = fp(f - (half_ulp >> ((f == implicit_bit && e > min_normal_e) ? 1 : 0)), e); lower.f <<= lower.e - upper.e; lower.e = upper.e; } diff --git a/include/fmt/format.h b/include/fmt/format.h index 9ca0be18..5ff4c86f 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2805,7 +2805,7 @@ void internal::basic_writer::write_fp(T value, int precision = specs.precision >= 0 || !specs.type ? specs.precision : 6; unsigned options = 0; if (handler.fixed) options |= grisu_options::fixed; - if (sizeof(value) == sizeof(float)) options |= grisu_options::binary32; + if constexpr (sizeof(value) == sizeof(float)) options |= grisu_options::binary32; bool use_grisu = USE_GRISU && (specs.type != 'a' && specs.type != 'A' && specs.type != 'e' &&