From 07d5a86a7c098b3712c107f055aba70005a55f7f Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 6 Apr 2019 22:10:10 -0700 Subject: [PATCH] Fix warnings --- include/fmt/format.h | 8 +++++--- test/format-impl-test.cc | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 3ee94722..b022292a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1018,10 +1018,12 @@ Char* format_uint(Char* buffer, internal::uintptr_t n, int num_digits, bool = false) { auto char_digits = std::numeric_limits::digits / 4; int start = (num_digits + char_digits - 1) / char_digits - 1; - if (int start_digits = num_digits % char_digits) - buffer = format_uint(buffer, n.value[start--], start_digits); + if (int start_digits = num_digits % char_digits) { + unsigned value = n.value[start--]; + buffer = format_uint(buffer, value, start_digits); + } for (; start >= 0; --start) { - auto value = n.value[start]; + unsigned value = n.value[start]; buffer += char_digits; auto p = buffer; for (int i = 0; i < char_digits; ++i) { diff --git a/test/format-impl-test.cc b/test/format-impl-test.cc index d1c2ecb6..6d35b204 100644 --- a/test/format-impl-test.cc +++ b/test/format-impl-test.cc @@ -94,7 +94,7 @@ TEST(FPTest, GetCachedPower) { EXPECT_LE(exp, fp.e); int dec_exp_step = 8; EXPECT_LE(fp.e, exp + dec_exp_step * log2(10)); - EXPECT_DOUBLE_EQ(pow(10, dec_exp), ldexp(fp.f, fp.e)); + EXPECT_DOUBLE_EQ(pow(10, dec_exp), ldexp(static_cast(fp.f), fp.e)); } }