libstdc++: Fix <charconv> uses of signed types with <bit> functions
commit1c15303375f7089ff985b085ab877b11ebfbc4b7
authorJonathan Wakely <jwakely@redhat.com>
Tue, 14 Nov 2023 10:56:57 +0000 (14 10:56 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 14 Nov 2023 22:32:08 +0000 (14 22:32 +0000)
treeb6ab3ced8878832d2fc31a4e183e6c464f497252
parent6f2fc42d9e52e8322e718e0154cd235d00906f99
libstdc++: Fix <charconv> uses of signed types with <bit> functions

In <charconv> we pass the int __base parameter to our internal versions
of <bit> functions, __bit_width and __countr_zero. Those functions are
only defined for unsigned types, so we need to convert the base to
unsigned. The base must be in the range [2,36] so we can mask off the
low bits and then convert that to unsigned, so that we don't need to
care about negative values becoming large unsigned values.

libstdc++-v3/ChangeLog:

* include/std/charconv (__from_chars_pow2_base): Convert base to
unsigned for call to __countr_zero.
(__from_chars_alnum): Likewise for call to __bit_width.
libstdc++-v3/include/std/charconv