A workaround for __cpp_lib_bitops for gcc version 9.x (in C++20 mode). Those versions implemented std::countl_zero, etc, but did not define that feature detection macro.
More...
|
template<class T > |
constexpr T | std::bit_ceil (T x) noexcept |
| Calculates the smallest integral power of two that is not smaller than x. More...
|
|
template<class T > |
constexpr T | std::bit_width (T x) noexcept |
| If x is not zero, calculates the number of bits needed to store the value x, that is, 1 + floor(log2(x)). If x is zero, returns zero. More...
|
|
template<class T > |
constexpr int | std::countl_zero (T x) noexcept |
| Returns the number of consecutive 0 bits in the value of x, starting from the most significant bit ("left"). More...
|
|
template<class T > |
constexpr int | std::countr_zero (T x) noexcept |
| Returns the number of consecutive 0 bits in the value of x, starting from the least significant bit ("right"). More...
|
|
template<class T > |
constexpr bool | std::has_single_bit (T x) noexcept |
| Checks if x is an integral power of two. More...
|
|
template<class T > |
constexpr int | std::popcount (T x) noexcept |
| Returns the number of 1 bits in the value of x. More...
|
|
A workaround for __cpp_lib_bitops for gcc version 9.x (in C++20 mode). Those versions implemented std::countl_zero, etc, but did not define that feature detection macro.
This defines __cpp_lib_int_pow2. Note: g++-9.3 -std=c++2a on ubuntu 20.04 did #define __cpp_lib_int_pow2 201806L
, which is an older implementation of the __cpp_lib_int_pow2 proposal.
- See also
- http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0556r3.html (__cpp_lib_int_pow2 >= 201806L)
-
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1956r1.pdf (__cpp_lib_int_pow2 >= 202002L)
A workaround for __cpp_lib_endian for gcc version 8.x (in C++20 mode). Those versions implemented std::endian, but did not define that feature detection macro.
The <bit> header from C++20's standard library.
◆ endian
◆ bit_ceil()
template<class T >
constexpr T std::bit_ceil |
( |
T |
x | ) |
|
|
no-apiconstexprnoexcept |
◆ bit_width()
template<class T >
constexpr T std::bit_width |
( |
T |
x | ) |
|
|
no-apiconstexprnoexcept |
◆ countl_zero()
template<class T >
constexpr int std::countl_zero |
( |
T |
x | ) |
|
|
no-apiconstexprnoexcept |
◆ countr_zero()
template<class T >
constexpr int std::countr_zero |
( |
T |
x | ) |
|
|
no-apiconstexprnoexcept |
◆ has_single_bit()
template<class T >
constexpr bool std::has_single_bit |
( |
T |
x | ) |
|
|
no-apiconstexprnoexcept |
◆ popcount()
template<class T >
constexpr int std::popcount |
( |
T |
x | ) |
|
|
no-apiconstexprnoexcept |