diff --git a/libc/src/__support/CPP/type_traits.h b/libc/src/__support/CPP/type_traits.h index 5808e92f6816..1b58c95cf29f 100644 --- a/libc/src/__support/CPP/type_traits.h +++ b/libc/src/__support/CPP/type_traits.h @@ -163,6 +163,25 @@ template <> struct make_unsigned<__uint128_t> : type_identity<__uint128_t> {}; #endif template using make_unsigned_t = typename make_unsigned::type; +template struct make_signed; +template <> struct make_signed : type_identity {}; +template <> struct make_signed : type_identity {}; +template <> struct make_signed : type_identity {}; +template <> struct make_signed : type_identity {}; +template <> struct make_signed : type_identity {}; +template <> struct make_signed : type_identity {}; +template <> struct make_signed : type_identity {}; +template <> struct make_signed : type_identity {}; +template <> struct make_signed : type_identity {}; +template <> struct make_signed : type_identity {}; +template <> +struct make_signed : type_identity {}; +#ifdef __SIZEOF_INT128__ +template <> struct make_signed<__int128_t> : type_identity<__int128_t> {}; +template <> struct make_signed<__uint128_t> : type_identity<__int128_t> {}; +#endif +template using make_signed_t = typename make_signed::type; + // Compile time type selection. template struct conditional : type_identity {}; diff --git a/libc/src/__support/UInt.h b/libc/src/__support/UInt.h index 2b187586c3ba..ffb3a12e2a8d 100644 --- a/libc/src/__support/UInt.h +++ b/libc/src/__support/UInt.h @@ -909,6 +909,24 @@ struct make_unsigned> : type_identity> { "Number of bits in Int should be a multiple of 64."); }; +template +struct make_unsigned> : type_identity> { + static_assert(Bits > 0 && Bits % 64 == 0, + "Number of bits in Int should be a multiple of 64."); +}; + +template +struct make_signed> : type_identity> { + static_assert(Bits > 0 && Bits % 64 == 0, + "Number of bits in Int should be a multiple of 64."); +}; + +template +struct make_signed> : type_identity> { + static_assert(Bits > 0 && Bits % 64 == 0, + "Number of bits in Int should be a multiple of 64."); +}; + } // namespace __llvm_libc::cpp #endif // LLVM_LIBC_SRC_SUPPORT_UINT_H