|
#define | __cpp_lib_bit_cast |
|
#define | __cpp_lib_endian |
|
#define | __cpp_lib_int_pow2 |
|
Utilities for examining and manipulating individual bits.
Byte order constants.
The platform endianness can be checked by comparing std::endian::native
to one of std::endian::big
or std::endian::little
.
- Since
- C++20
Definition at line 466 of file bit.
template<typename _To , typename _From >
constexpr _To std::bit_cast |
( |
const _From & |
__from | ) |
|
|
noexcept |
Create a value of type To
from the bits of from
.
- Template Parameters
-
_To | A trivially-copyable type. |
- Parameters
-
__from | A trivially-copyable object of the same size as _To . |
- Returns
- An object of type
_To
.
- Since
- C++20
template<typename _Tp >
constexpr _If_is_unsigned_integer<_Tp> std::bit_ceil |
( |
_Tp |
__x | ) |
|
|
noexcept |
The smallest power-of-two not less than x
.
Definition at line 442 of file bit.
template<typename _Tp >
constexpr _If_is_unsigned_integer<_Tp> std::bit_floor |
( |
_Tp |
__x | ) |
|
|
noexcept |
The largest power-of-two not greater than x
.
Definition at line 448 of file bit.
template<typename _Tp >
constexpr _If_is_unsigned_integer<_Tp> std::bit_width |
( |
_Tp |
__x | ) |
|
|
noexcept |
The smallest integer greater than the base-2 logarithm of x
.
Definition at line 454 of file bit.
template<typename _Tp >
constexpr _If_is_unsigned_integer<_Tp, int> std::countl_one |
( |
_Tp |
__x | ) |
|
|
noexcept |
The number of contiguous one bits, starting from the highest bit.
Definition at line 408 of file bit.
template<typename _Tp >
constexpr _If_is_unsigned_integer<_Tp, int> std::countr_one |
( |
_Tp |
__x | ) |
|
|
noexcept |
The number of contiguous one bits, starting from the lowest bit.
Definition at line 420 of file bit.
template<typename _Tp >
constexpr _If_is_unsigned_integer<_Tp, int> std::countr_zero |
( |
_Tp |
__x | ) |
|
|
noexcept |
The number of contiguous zero bits, starting from the lowest bit.
Definition at line 414 of file bit.
template<typename _Tp >
constexpr _If_is_unsigned_integer<_Tp, bool> std::has_single_bit |
( |
_Tp |
__x | ) |
|
|
noexcept |
template<typename _Tp >
constexpr _If_is_unsigned_integer<_Tp, int> std::popcount |
( |
_Tp |
__x | ) |
|
|
noexcept |
The number of bits set in x
.
Definition at line 426 of file bit.