Commit 2bf2dacb by Jonathan Wakely Committed by Jonathan Wakely

Avoid warnings in <charconv>

	* include/bits/charconv.h (__to_chars_len): Avoid -Wsign-compare
	warnings.

From-SVN: r276889
parent 8b27c905
2019-10-11 Jonathan Wakely <jwakely@redhat.com>
* include/bits/charconv.h (__to_chars_len): Avoid -Wsign-compare
warnings.
2019-10-10 Jonathan Wakely <jwakely@redhat.com> 2019-10-10 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/91057 PR libstdc++/91057
......
...@@ -50,16 +50,16 @@ namespace __detail ...@@ -50,16 +50,16 @@ namespace __detail
static_assert(is_unsigned<_Tp>::value, "implementation bug"); static_assert(is_unsigned<_Tp>::value, "implementation bug");
unsigned __n = 1; unsigned __n = 1;
const int __b2 = __base * __base; const unsigned __b2 = __base * __base;
const int __b3 = __b2 * __base; const unsigned __b3 = __b2 * __base;
const int __b4 = __b3 * __base; const unsigned long __b4 = __b3 * __base;
for (;;) for (;;)
{ {
if (__value < __base) return __n; if (__value < (unsigned)__base) return __n;
if (__value < __b2) return __n + 1; if (__value < __b2) return __n + 1;
if (__value < __b3) return __n + 2; if (__value < __b3) return __n + 2;
if (__value < __b4) return __n + 3; if (__value < __b4) return __n + 3;
__value /= (unsigned)__b4; __value /= __b4;
__n += 4; __n += 4;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment