[libc-commits] [libc] [libc][math][c23] adds `nanf128` (PR #85201)

via libc-commits libc-commits at lists.llvm.org
Thu Mar 14 07:04:26 PDT 2024


================
@@ -993,6 +993,15 @@ struct is_big_int<BigInt<Bits, Signed, T>> : cpp::true_type {};
 template <class T>
 LIBC_INLINE_VAR constexpr bool is_big_int_v = is_big_int<T>::value;
 
+// make_unsigned and make_signed type traits
+template <size_t Bits, bool Signed, typename T>
+struct cpp::make_unsigned<BigInt<Bits, Signed, T>>
+    : cpp::type_identity<BigInt<Bits, false, T>> {};
+
+template <size_t Bits, bool Signed, typename T>
+struct cpp::make_signed<BigInt<Bits, Signed, T>>
+    : cpp::type_identity<BigInt<Bits, true, T>> {};
+
----------------
lntue wrote:

We were getting away from specializing `make_signed` and `make_unsigned` for `BigInt` class.  For the context, see https://github.com/llvm/llvm-project/pull/84299

For getting signed and unsigned types of `BigInt`, you might refactor https://github.com/llvm/llvm-project/blob/main/libc/src/__support/integer_to_string.h#L153 to add something like: `is_integral_or_bigint`, `make_integral_or_bigint_signed`, `make_integral_or_bigint_unsigned`, together with their `_v` and `_t` templates.

https://github.com/llvm/llvm-project/pull/85201


More information about the libc-commits mailing list