From 2bf2dacb355af3632fd98b2f9e920f1e03722049 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 11 Oct 2019 16:29:50 +0100 Subject: [PATCH] Avoid warnings in * include/bits/charconv.h (__to_chars_len): Avoid -Wsign-compare warnings. From-SVN: r276889 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/include/bits/charconv.h | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6f04a6840ba..1459185de26 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2019-10-11 Jonathan Wakely + + * include/bits/charconv.h (__to_chars_len): Avoid -Wsign-compare + warnings. + 2019-10-10 Jonathan Wakely PR libstdc++/91057 diff --git a/libstdc++-v3/include/bits/charconv.h b/libstdc++-v3/include/bits/charconv.h index a5b6be567bc..7c0922fec21 100644 --- a/libstdc++-v3/include/bits/charconv.h +++ b/libstdc++-v3/include/bits/charconv.h @@ -50,16 +50,16 @@ namespace __detail static_assert(is_unsigned<_Tp>::value, "implementation bug"); unsigned __n = 1; - const int __b2 = __base * __base; - const int __b3 = __b2 * __base; - const int __b4 = __b3 * __base; + const unsigned __b2 = __base * __base; + const unsigned __b3 = __b2 * __base; + const unsigned long __b4 = __b3 * __base; for (;;) { - if (__value < __base) return __n; + if (__value < (unsigned)__base) return __n; if (__value < __b2) return __n + 1; if (__value < __b3) return __n + 2; if (__value < __b4) return __n + 3; - __value /= (unsigned)__b4; + __value /= __b4; __n += 4; } } -- 2.30.2