@@ -45,12 +45,12 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) <= sizeof(uin
4545 // /
4646 // / The algorithm is based on
4747 // / http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
48- // / Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that
49- // / function requires its input to have at least one bit set the value of
50- // / zero is set to one. This means the first element of the lookup table is
51- // / zero.
48+ // / Instead of using IntegerLogBase2 it uses __countl_zero. Previously, it
49+ // / used __libcpp_clz. Since that function requires its input to have at
50+ // / least one bit set the value of zero is set to one. This means the first
51+ // / element of the lookup table is zero.
5252 static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width (_Tp __v) {
53- auto __t = (32 - std::__libcpp_clz (static_cast <type>(__v | 1 ))) * 1233 >> 12 ;
53+ auto __t = (32 - std::__countl_zero (static_cast <type>(__v | 1 ))) * 1233 >> 12 ;
5454 return __t - (__v < __itoa::__pow10_32[__t ]) + 1 ;
5555 }
5656
@@ -71,12 +71,12 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(uin
7171 // /
7272 // / The algorithm is based on
7373 // / http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
74- // / Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that
75- // / function requires its input to have at least one bit set the value of
76- // / zero is set to one. This means the first element of the lookup table is
77- // / zero.
74+ // / Instead of using IntegerLogBase2 it uses __countl_zero. Previously, it
75+ // / used __libcpp_clz. Since that function requires its input to have at
76+ // / least one bit set the value of zero is set to one. This means the first
77+ // / element of the lookup table is zero.
7878 static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width (_Tp __v) {
79- auto __t = (64 - std::__libcpp_clz (static_cast <type>(__v | 1 ))) * 1233 >> 12 ;
79+ auto __t = (64 - std::__countl_zero (static_cast <type>(__v | 1 ))) * 1233 >> 12 ;
8080 return __t - (__v < __itoa::__pow10_64[__t ]) + 1 ;
8181 }
8282
@@ -98,15 +98,15 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(__u
9898 // /
9999 // / The algorithm is based on
100100 // / http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
101- // / Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that
102- // / function requires its input to have at least one bit set the value of
103- // / zero is set to one. This means the first element of the lookup table is
104- // / zero.
101+ // / Instead of using IntegerLogBase2 it uses __countl_zero. Previously, it
102+ // / used __libcpp_clz. Since that function requires its input to have at
103+ // / least one bit set the value of zero is set to one. This means the first
104+ // / element of the lookup table is zero.
105105 static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width (_Tp __v) {
106106 _LIBCPP_ASSERT_INTERNAL (
107107 __v > numeric_limits<uint64_t >::max (), " The optimizations for this algorithm fail when this isn't true." );
108108 // There's always a bit set in the upper 64-bits.
109- auto __t = (128 - std::__libcpp_clz (static_cast <uint64_t >(__v >> 64 ))) * 1233 >> 12 ;
109+ auto __t = (128 - std::__countl_zero (static_cast <uint64_t >(__v >> 64 ))) * 1233 >> 12 ;
110110 _LIBCPP_ASSERT_INTERNAL (__t >= __itoa::__pow10_128_offset, " Index out of bounds" );
111111 // __t is adjusted since the lookup table misses the lower entries.
112112 return __t - (__v < __itoa::__pow10_128[__t - __itoa::__pow10_128_offset]) + 1 ;
0 commit comments