[libcxx-commits] [libcxx] [libcxx] Use generic builtins for popcount, clz and ctz (PR #86563)
Marc Auberer via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 29 10:59:06 PDT 2024
================
@@ -40,12 +40,11 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ct
template <class _Tp>
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countr_zero(_Tp __t) _NOEXCEPT {
- if (__t == 0)
- return numeric_limits<_Tp>::digits;
-
-#if __has_builtin(__builtin_ctzg)
+#if __has_builtin(__builtin_ctzg, numeric_limits<_Tp>::digits)
return __builtin_ctzg(__t);
----------------
marcauberer wrote:
Was just about to do that, along with a rebase ;)
https://github.com/llvm/llvm-project/pull/86563
More information about the libcxx-commits
mailing list