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 96925fa commit 549d11dCopy full SHA for 549d11d
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 != 0 && (((__t & (__t - 1)) == 0));
+ return (__t ^ (__t - 1)) > __t - 1;
29
}
30
31
_LIBCPP_END_NAMESPACE_STD
0 commit comments