@@ -95,9 +95,9 @@ __find(_Tp* __first, _Tp* __last, const _Up& __value, _Proj& __proj) {
9595}
9696
9797// __bit_iterator implementation
98- template <bool _ToFind, class _Cp , bool _IsConst>
98+ template <class _Cp , bool _IsConst>
9999_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, _IsConst>
100- __find_bool (__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) {
100+ __find_bool (__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n, bool __to_find ) {
101101 using _It = __bit_iterator<_Cp, _IsConst>;
102102 using __storage_type = typename _It::__storage_type;
103103
@@ -107,7 +107,7 @@ __find_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
107107 __storage_type __clz_f = static_cast <__storage_type>(__bits_per_word - __first.__ctz_ );
108108 __storage_type __dn = std::min (__clz_f, __n);
109109 __storage_type __m = (~__storage_type (0 ) << __first.__ctz_ ) & (~__storage_type (0 ) >> (__clz_f - __dn));
110- __storage_type __b = std::__invert_if<!_ToFind> (*__first.__seg_ ) & __m;
110+ __storage_type __b = std::__invert_if (*__first.__seg_ , !__to_find ) & __m;
111111 if (__b)
112112 return _It (__first.__seg_ , static_cast <unsigned >(std::__libcpp_ctz (__b)));
113113 if (__n == __dn)
@@ -117,14 +117,14 @@ __find_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
117117 }
118118 // do middle whole words
119119 for (; __n >= __bits_per_word; ++__first.__seg_ , __n -= __bits_per_word) {
120- __storage_type __b = std::__invert_if<!_ToFind> (*__first.__seg_ );
120+ __storage_type __b = std::__invert_if (*__first.__seg_ , !__to_find );
121121 if (__b)
122122 return _It (__first.__seg_ , static_cast <unsigned >(std::__libcpp_ctz (__b)));
123123 }
124124 // do last partial word
125125 if (__n > 0 ) {
126126 __storage_type __m = ~__storage_type (0 ) >> (__bits_per_word - __n);
127- __storage_type __b = std::__invert_if<!_ToFind> (*__first.__seg_ ) & __m;
127+ __storage_type __b = std::__invert_if (*__first.__seg_ , !__to_find ) & __m;
128128 if (__b)
129129 return _It (__first.__seg_ , static_cast <unsigned >(std::__libcpp_ctz (__b)));
130130 }
@@ -134,9 +134,7 @@ __find_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
134134template <class _Cp , bool _IsConst, class _Tp , class _Proj , __enable_if_t <__is_identity<_Proj>::value, int > = 0 >
135135inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, _IsConst>
136136__find (__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value, _Proj&) {
137- if (static_cast <bool >(__value))
138- return std::__find_bool<true >(__first, static_cast <typename _Cp::size_type>(__last - __first));
139- return std::__find_bool<false >(__first, static_cast <typename _Cp::size_type>(__last - __first));
137+ return std::__find_bool (__first, static_cast <typename _Cp::size_type>(__last - __first), static_cast <bool >(__value));
140138}
141139
142140// segmented iterator implementation
0 commit comments