@@ -43,12 +43,12 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) <= sizeof(uin
4343 // /
4444 // / The algorithm is based on
4545 // / http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
46- // / Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that
47- // / function requires its input to have at least one bit set the value of
48- // / zero is set to one. This means the first element of the lookup table is
49- // / zero.
46+ // / Instead of using IntegerLogBase2 it uses __countl_zero. Previously, it
47+ // / used __libcpp_clz. Since that function requires its input to have at
48+ // / least one bit set the value of zero is set to one. This means the first
49+ // / element of the lookup table is zero.
5050 static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width (_Tp __v) {
51- auto __t = (32 - std::__libcpp_clz (static_cast <type>(__v | 1 ))) * 1233 >> 12 ;
51+ auto __t = (32 - std::__countl_zero (static_cast <type>(__v | 1 ))) * 1233 >> 12 ;
5252 return __t - (__v < __itoa::__pow10_32[__t ]) + 1 ;
5353 }
5454
@@ -69,12 +69,12 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(uin
6969 // /
7070 // / The algorithm is based on
7171 // / http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
72- // / Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that
73- // / function requires its input to have at least one bit set the value of
74- // / zero is set to one. This means the first element of the lookup table is
75- // / zero.
72+ // / Instead of using IntegerLogBase2 it uses __countl_zero. Previously, it
73+ // / used __libcpp_clz. Since that function requires its input to have at
74+ // / least one bit set the value of zero is set to one. This means the first
75+ // / element of the lookup table is zero.
7676 static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width (_Tp __v) {
77- auto __t = (64 - std::__libcpp_clz (static_cast <type>(__v | 1 ))) * 1233 >> 12 ;
77+ auto __t = (64 - std::__countl_zero (static_cast <type>(__v | 1 ))) * 1233 >> 12 ;
7878 return __t - (__v < __itoa::__pow10_64[__t ]) + 1 ;
7979 }
8080
@@ -96,15 +96,15 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(__u
9696 // /
9797 // / The algorithm is based on
9898 // / http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
99- // / Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that
100- // / function requires its input to have at least one bit set the value of
101- // / zero is set to one. This means the first element of the lookup table is
102- // / zero.
99+ // / Instead of using IntegerLogBase2 it uses __countl_zero. Previously, it
100+ // / used __libcpp_clz. Since that function requires its input to have at
101+ // / least one bit set the value of zero is set to one. This means the first
102+ // / element of the lookup table is zero.
103103 static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width (_Tp __v) {
104104 _LIBCPP_ASSERT_INTERNAL (
105105 __v > numeric_limits<uint64_t >::max (), " The optimizations for this algorithm fail when this isn't true." );
106106 // There's always a bit set in the upper 64-bits.
107- auto __t = (128 - std::__libcpp_clz (static_cast <uint64_t >(__v >> 64 ))) * 1233 >> 12 ;
107+ auto __t = (128 - std::__countl_zero (static_cast <uint64_t >(__v >> 64 ))) * 1233 >> 12 ;
108108 _LIBCPP_ASSERT_INTERNAL (__t >= __itoa::__pow10_128_offset, " Index out of bounds" );
109109 // __t is adjusted since the lookup table misses the lower entries.
110110 return __t - (__v < __itoa::__pow10_128[__t - __itoa::__pow10_128_offset]) + 1 ;
0 commit comments