@@ -96,9 +96,9 @@ __find(_Tp* __first, _Tp* __last, const _Up& __value, _Proj& __proj) {
9696}
9797
9898// __bit_iterator implementation
99- template <bool _ToFind, class _Cp , bool _IsConst>
99+ template <class _Cp , bool _IsConst>
100100_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, _IsConst>
101- __find_bool (__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) {
101+ __find_bool (__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n, bool _ToFind ) {
102102 using _It = __bit_iterator<_Cp, _IsConst>;
103103 using __storage_type = typename _It::__storage_type;
104104
@@ -108,7 +108,7 @@ __find_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
108108 __storage_type __clz_f = static_cast <__storage_type>(__bits_per_word - __first.__ctz_ );
109109 __storage_type __dn = std::min (__clz_f, __n);
110110 __storage_type __m = (~__storage_type (0 ) << __first.__ctz_ ) & (~__storage_type (0 ) >> (__clz_f - __dn));
111- __storage_type __b = std::__invert_if<!_ToFind> (*__first.__seg_ ) & __m;
111+ __storage_type __b = std::__invert_if (*__first.__seg_ , !_ToFind ) & __m;
112112 if (__b)
113113 return _It (__first.__seg_ , static_cast <unsigned >(std::__libcpp_ctz (__b)));
114114 if (__n == __dn)
@@ -118,14 +118,14 @@ __find_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
118118 }
119119 // do middle whole words
120120 for (; __n >= __bits_per_word; ++__first.__seg_ , __n -= __bits_per_word) {
121- __storage_type __b = std::__invert_if<!_ToFind> (*__first.__seg_ );
121+ __storage_type __b = std::__invert_if (*__first.__seg_ , !_ToFind );
122122 if (__b)
123123 return _It (__first.__seg_ , static_cast <unsigned >(std::__libcpp_ctz (__b)));
124124 }
125125 // do last partial word
126126 if (__n > 0 ) {
127127 __storage_type __m = ~__storage_type (0 ) >> (__bits_per_word - __n);
128- __storage_type __b = std::__invert_if<!_ToFind> (*__first.__seg_ ) & __m;
128+ __storage_type __b = std::__invert_if (*__first.__seg_ , !_ToFind ) & __m;
129129 if (__b)
130130 return _It (__first.__seg_ , static_cast <unsigned >(std::__libcpp_ctz (__b)));
131131 }
@@ -135,9 +135,7 @@ __find_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
135135template <class _Cp , bool _IsConst, class _Tp , class _Proj , __enable_if_t <__is_identity<_Proj>::value, int > = 0 >
136136inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, _IsConst>
137137__find (__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value, _Proj&) {
138- if (static_cast <bool >(__value))
139- return std::__find_bool<true >(__first, static_cast <typename _Cp::size_type>(__last - __first));
140- return std::__find_bool<false >(__first, static_cast <typename _Cp::size_type>(__last - __first));
138+ return std::__find_bool (__first, static_cast <typename _Cp::size_type>(__last - __first), static_cast <bool >(__value));
141139}
142140
143141// segmented iterator implementation
0 commit comments