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 549d11d commit 144f83eCopy full SHA for 144f83e
libcxx/include/__bit/has_single_bit.h
@@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
25
26
template <__libcpp_unsigned_integer _Tp>
27
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_single_bit(_Tp __t) noexcept {
28
- return (__t ^ (__t - 1)) > __t - 1;
+ return __builtin_popcountg(__t) == 1;
29
}
30
31
_LIBCPP_END_NAMESPACE_STD
0 commit comments