[PATCH] c++, libstdc++: Add __make_signed and __make_unsigned intrinsic traits
Jakub Jelinek
jakub@redhat.com
Mon Nov 9 11:20:41 GMT 2026
On Mon, Nov 09, 2026 at 11:05:51AM +0000, Jonathan Wakely wrote:
> On Mon, 09 Nov 2026 at 10:46 +0000, Jonathan Wakely wrote:
> > On Sat, 07 Nov 2026 at 15:00 +0100, Jakub Jelinek wrote:
> > > Another complication is that simd_details.h was using __make_unsigned
> > > trait instead of make_unsigned and was doing that intentionally, seems
> > > it wants make_unsigned<_From>::type if the type is integral and
> > > _From otherwise. Dunno if what I wrote is the simplest.
> >
> > It looks good to me.
>
> I suppose an alternative would be:
>
> template<typename _Tp>
> using __maybe_make_unsigned
> = typename __conditional_t<integral<_Tp>, make_unsigned<_Tp>,
> type_identity<_Tp>>::type;
I was thinking about using conditional, but thought that the template
argument in that case (make_unsigned<_Tp>) is instantiated even
if the condition is false. Working on something else right now, so don't
have the _BitInt patches in my tree, but can verify that later.
And already the instantiation of it results in an error now I think (both
in the g++ implementation in the patch and in the clang++ implementation).
Jakub
More information about the Libstdc++
mailing list