[libcxx-commits] [libcxx] [libc++] Replace __libcpp_{ctz, clz} with __builtin_{ctzg, clzg} (PR #133920)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 7 02:13:20 PDT 2025


================
@@ -45,12 +45,12 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) <= sizeof(uin
   ///
   /// The algorithm is based on
   /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
-  /// Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that
-  /// function requires its input to have at least one bit set the value of
-  /// zero is set to one. This means the first element of the lookup table is
-  /// zero.
+  /// Instead of using IntegerLogBase2 it uses __countl_zero. Previously, it
+  /// used __libcpp_clz. Since that function requires its input to have at
----------------
philnik777 wrote:

```suggestion
  /// Instead of using IntegerLogBase2 it uses __countl_zero. Since that function requires its input to have at
```
That's really not interesting IMO. Same below.

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


More information about the libcxx-commits mailing list