On Mon, Nov 9, 2026 at 12:26 PM Jakub Jelinek <[email protected]> wrote:
> On Mon, Nov 09, 2026 at 10:49:09AM +0000, Jonathan Wakely wrote: > > We don't need the full genericity of the __make_unsigned_selector_base > > template from <type_traits> because we have a hardcoded list of three or > > four integral types. We can just use a constexpr if-else ladder. This > > avoids recursive class template instantiations and partial > > specialization matching. > > > > libstdc++-v3/ChangeLog: > > > > * include/std/charconv (__to_chars_unsigned_type): Remove. > > (__to_chars_unsigned_type): New constexpr function. > > (__unsigned_least_t): Use __to_chars_unsigned_type. > > --- > > > > Tested 20_util/to_chars/* and testing the rest now, on x86_64-linux. > The changes LGTM. > > Thanks, this looks cleaner. Once you commit it, I can tweak my patch > not to define __make_unsigned_selector_base when using the trait. > > Wonder what to do for _BitInt, if we should instantiate for all possible > widths used in the code or do something similar, use the unsigned int/long > long/__int128 if that is wider or same precision and/or say round up > _BitInt precision to multiples of 128 or something like that. I think we want to reduce the number of instantiations, so upgrading to standard types, and then rounding bits seem like good choice. > > Jakub > >
