diff options
author | mikhnenko <[email protected]> | 2024-11-15 10:28:14 +0300 |
---|---|---|
committer | mikhnenko <[email protected]> | 2024-11-15 10:39:55 +0300 |
commit | 63e58b6e405f754c634aac8411c84da160b4c574 (patch) | |
tree | e93aa558728b77f263074a89ea1e7ba7849f6b7a /contrib/libs/cxxsupp/libcxx/include/__bit_reference | |
parent | 423f17a2717306abbb05e18c17c1dcfe0bd89558 (diff) |
Update libcxx to 19 Oct d173ce4a670e88b65c52f6fc1bf10d133ee35704
commit_hash:c1da7a8a6580c15e8af41b1a4847da2163706905
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__bit_reference')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/__bit_reference | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit_reference b/contrib/libs/cxxsupp/libcxx/include/__bit_reference index 107368759c6..9032b8f0180 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit_reference +++ b/contrib/libs/cxxsupp/libcxx/include/__bit_reference @@ -171,45 +171,6 @@ private: __bit_const_reference& operator=(const __bit_const_reference&) = delete; }; -// count - -template <bool _ToCount, class _Cp, bool _IsConst> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 typename __bit_iterator<_Cp, _IsConst>::difference_type -__count_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { - using _It = __bit_iterator<_Cp, _IsConst>; - using __storage_type = typename _It::__storage_type; - using difference_type = typename _It::difference_type; - - const int __bits_per_word = _It::__bits_per_word; - difference_type __r = 0; - // do first partial word - if (__first.__ctz_ != 0) { - __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); - __storage_type __dn = std::min(__clz_f, __n); - __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); - __r = std::__libcpp_popcount(std::__invert_if<!_ToCount>(*__first.__seg_) & __m); - __n -= __dn; - ++__first.__seg_; - } - // do middle whole words - for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) - __r += std::__libcpp_popcount(std::__invert_if<!_ToCount>(*__first.__seg_)); - // do last partial word - if (__n > 0) { - __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); - __r += std::__libcpp_popcount(std::__invert_if<!_ToCount>(*__first.__seg_) & __m); - } - return __r; -} - -template <class _Cp, bool _IsConst, class _Tp> -inline _LIBCPP_HIDE_FROM_ABI typename __bit_iterator<_Cp, _IsConst>::difference_type -count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value) { - if (static_cast<bool>(__value)) - return std::__count_bool<true>(__first, static_cast<typename _Cp::size_type>(__last - __first)); - return std::__count_bool<false>(__first, static_cast<typename _Cp::size_type>(__last - __first)); -} - // fill_n template <bool _FillValue, class _Cp> @@ -1092,7 +1053,7 @@ private: _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator<_Dp, _IC> __find_bool(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); template <bool _ToCount, class _Dp, bool _IC> - friend typename __bit_iterator<_Dp, _IC>::difference_type _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 + friend typename __bit_iterator<_Dp, _IC>::difference_type _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __count_bool(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); }; |