File indexing completed on 2026-05-03 08:13:23
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___CXX03___BIT_HAS_SINGLE_BIT_H
0010 #define _LIBCPP___CXX03___BIT_HAS_SINGLE_BIT_H
0011
0012 #include <__cxx03/__concepts/arithmetic.h>
0013 #include <__cxx03/__config>
0014
0015 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0016 # pragma GCC system_header
0017 #endif
0018
0019 _LIBCPP_PUSH_MACROS
0020 #include <__cxx03/__undef_macros>
0021
0022 #if _LIBCPP_STD_VER >= 20
0023
0024 _LIBCPP_BEGIN_NAMESPACE_STD
0025
0026 template <__libcpp_unsigned_integer _Tp>
0027 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_single_bit(_Tp __t) noexcept {
0028 return __t != 0 && (((__t & (__t - 1)) == 0));
0029 }
0030
0031 _LIBCPP_END_NAMESPACE_STD
0032
0033 #endif
0034
0035 _LIBCPP_POP_MACROS
0036
0037 #endif