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

Nick Desaulniers via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 29 10:55:12 PDT 2024


================
@@ -40,6 +43,9 @@ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __coun
   if (__t == 0)
     return numeric_limits<_Tp>::digits;
 
+#if __has_builtin(__builtin_ctzg)
+  return __builtin_ctzg(__t);
+#else  // __has_builtin(__builtin_ctzg)
----------------
nickdesaulniers wrote:

my bad on this suggestion!

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


More information about the libcxx-commits mailing list