Skip to content

Commit 6fc8adf

Browse files
committed
replace libcpp_ctz by countr_zero
1 parent 0d3ba08 commit 6fc8adf

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

libcxx/include/__algorithm/sort.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos(
359359
// Swap one pair on each iteration as long as both bitsets have at least one
360360
// element for swapping.
361361
while (__left_bitset != 0 && __right_bitset != 0) {
362-
difference_type __tz_left = __libcpp_ctz(__left_bitset);
362+
difference_type __tz_left = __countr_zero(__left_bitset);
363363
__left_bitset = __libcpp_blsr(__left_bitset);
364-
difference_type __tz_right = __libcpp_ctz(__right_bitset);
364+
difference_type __tz_right = __countr_zero(__right_bitset);
365365
__right_bitset = __libcpp_blsr(__right_bitset);
366366
_Ops::iter_swap(__first + __tz_left, __last - __tz_right);
367367
}

libcxx/include/__cxx03/__algorithm/find.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ __find_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
108108
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
109109
__storage_type __b = std::__invert_if<!_ToFind>(*__first.__seg_) & __m;
110110
if (__b)
111-
return _It(__first.__seg_, static_cast<unsigned>(std::__libcpp_ctz(__b)));
111+
return _It(__first.__seg_, static_cast<unsigned>(std::__countr_zero(__b)));
112112
if (__n == __dn)
113113
return __first + __n;
114114
__n -= __dn;
@@ -118,14 +118,14 @@ __find_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
118118
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) {
119119
__storage_type __b = std::__invert_if<!_ToFind>(*__first.__seg_);
120120
if (__b)
121-
return _It(__first.__seg_, static_cast<unsigned>(std::__libcpp_ctz(__b)));
121+
return _It(__first.__seg_, static_cast<unsigned>(std::__countr_zero(__b)));
122122
}
123123
// do last partial word
124124
if (__n > 0) {
125125
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
126126
__storage_type __b = std::__invert_if<!_ToFind>(*__first.__seg_) & __m;
127127
if (__b)
128-
return _It(__first.__seg_, static_cast<unsigned>(std::__libcpp_ctz(__b)));
128+
return _It(__first.__seg_, static_cast<unsigned>(std::__countr_zero(__b)));
129129
}
130130
return _It(__first.__seg_, static_cast<unsigned>(__n));
131131
}

libcxx/include/__cxx03/__algorithm/sort.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,9 @@ inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos(
399399
// Swap one pair on each iteration as long as both bitsets have at least one
400400
// element for swapping.
401401
while (__left_bitset != 0 && __right_bitset != 0) {
402-
difference_type __tz_left = __libcpp_ctz(__left_bitset);
402+
difference_type __tz_left = __countr_zero(__left_bitset);
403403
__left_bitset = __libcpp_blsr(__left_bitset);
404-
difference_type __tz_right = __libcpp_ctz(__right_bitset);
404+
difference_type __tz_right = __countr_zero(__right_bitset);
405405
__right_bitset = __libcpp_blsr(__right_bitset);
406406
_Ops::iter_swap(__first + __tz_left, __last - __tz_right);
407407
}

0 commit comments

Comments
 (0)