We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c5ded52 commit 28df28bCopy full SHA for 28df28b
libcxx/include/bitset
@@ -867,7 +867,14 @@ bitset<_Size>::to_string(char __zero, char __one) const {
867
868
template <size_t _Size>
869
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t bitset<_Size>::count() const _NOEXCEPT {
870
- return static_cast<size_t>(std::count(__base::__make_iter(0), __base::__make_iter(_Size), true));
+#ifdef _LIBCPP_COMPILER_CLANG_BASED
871
+ if constexpr (_Size <= __base::__bits_per_word) {
872
+ return __builtin_popcountg(static_cast<unsigned _BitInt(_Size)>(__base::__first_));
873
+ } else
874
+#endif
875
+ {
876
+ return static_cast<size_t>(std::count(__base::__make_iter(0), __base::__make_iter(_Size), true));
877
+ }
878
}
879
880
0 commit comments