File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,25 @@ template <> struct make_unsigned<__uint128_t> : type_identity<__uint128_t> {};
163
163
#endif
164
164
template <typename T> using make_unsigned_t = typename make_unsigned<T>::type;
165
165
166
+ template <typename T> struct make_signed ;
167
+ template <> struct make_signed <char > : type_identity<char > {};
168
+ template <> struct make_signed <signed char > : type_identity<char > {};
169
+ template <> struct make_signed <short > : type_identity<short > {};
170
+ template <> struct make_signed <int > : type_identity<int > {};
171
+ template <> struct make_signed <long > : type_identity<long > {};
172
+ template <> struct make_signed <long long > : type_identity<long long > {};
173
+ template <> struct make_signed <unsigned char > : type_identity<char > {};
174
+ template <> struct make_signed <unsigned short > : type_identity<short > {};
175
+ template <> struct make_signed <unsigned int > : type_identity<int > {};
176
+ template <> struct make_signed <unsigned long > : type_identity<long > {};
177
+ template <>
178
+ struct make_signed <unsigned long long > : type_identity<long long > {};
179
+ #ifdef __SIZEOF_INT128__
180
+ template <> struct make_signed <__int128_t > : type_identity<__int128_t > {};
181
+ template <> struct make_signed <__uint128_t > : type_identity<__int128_t > {};
182
+ #endif
183
+ template <typename T> using make_signed_t = typename make_signed<T>::type;
184
+
166
185
// Compile time type selection.
167
186
template <bool B, typename T, typename F>
168
187
struct conditional : type_identity<T> {};
Original file line number Diff line number Diff line change @@ -909,6 +909,24 @@ struct make_unsigned<Int<Bits>> : type_identity<UInt<Bits>> {
909
909
" Number of bits in Int should be a multiple of 64." );
910
910
};
911
911
912
+ template <size_t Bits>
913
+ struct make_unsigned <UInt<Bits>> : type_identity<UInt<Bits>> {
914
+ static_assert (Bits > 0 && Bits % 64 == 0 ,
915
+ " Number of bits in Int should be a multiple of 64." );
916
+ };
917
+
918
+ template <size_t Bits>
919
+ struct make_signed <Int<Bits>> : type_identity<Int<Bits>> {
920
+ static_assert (Bits > 0 && Bits % 64 == 0 ,
921
+ " Number of bits in Int should be a multiple of 64." );
922
+ };
923
+
924
+ template <size_t Bits>
925
+ struct make_signed <UInt<Bits>> : type_identity<Int<Bits>> {
926
+ static_assert (Bits > 0 && Bits % 64 == 0 ,
927
+ " Number of bits in Int should be a multiple of 64." );
928
+ };
929
+
912
930
} // namespace __llvm_libc::cpp
913
931
914
932
#endif // LLVM_LIBC_SRC_SUPPORT_UINT_H
You can’t perform that action at this time.
0 commit comments