[libcxx-commits] [libcxx] [libcxx] Use generic builtins for popcount, clz and ctz (PR #86563)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 28 03:23:51 PDT 2024


================
@@ -49,9 +55,23 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x)
   //     zeros in the high 64-bits.
   return ((__x >> 64) == 0) ? (64 + __builtin_clzll(static_cast<unsigned long long>(__x)))
                             : __builtin_clzll(static_cast<unsigned long long>(__x >> 64));
+#  endif
 }
 #endif // _LIBCPP_HAS_NO_INT128
 
+#if __has_builtin(__builtin_clzg)
+
+template <class _Tp>
----------------
philnik777 wrote:

Why is this repeating the signature instead of just changing the body? Same for the other changes.

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


More information about the libcxx-commits mailing list