[libcxx-commits] [libcxx] [libc++] std::abs support for _BitInt(N) and __int128 (PR #196532)

Xavier Roche via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 16 10:53:13 PDT 2026


================
@@ -63,6 +65,18 @@ template <class = int>
   return __builtin_llabs(__x);
 }
 
+// Covers __int128 and signed _BitInt(N) with sizeof >= sizeof(int).
+// The int/long/long long exclusions are load-bearing: _BitInt(33..64)
+// shares sizeof with long long and would otherwise compete with the
+// builtin overload.
+template <class _Tp,
+          __enable_if_t<__is_signed_integer_v<_Tp> && !is_same<_Tp, int>::value && !is_same<_Tp, long>::value &&
----------------
xroche wrote:

Done!

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


More information about the libcxx-commits mailing list