Types and functions for retrieving and manipulating bits in integral values.
More...
Types and functions for retrieving and manipulating bits in integral values.
◆ intN_t
An integer type for the given PoT bit size.
Definition at line 80 of file bits.h.
◆ sintN_t
A signed integer type for the given PoT bit size.
Definition at line 92 of file bits.h.
◆ uintN_t
An unsigned integer type for the given PoT bit size.
Definition at line 67 of file bits.h.
◆ least_significant_half()
Returns an integer with the N/2 least significant bits of the given N-bit integer.
Definition at line 105 of file bits.h.
◆ make_bit_reference() [1/4]
template<
size_t BIT_NUM, std::ranges::contiguous_range RANGE_TYPE>
◆ make_bit_reference() [2/4]
template<std::ranges::contiguous_range RANGE_TYPE>
◆ make_bit_reference() [3/4]
template<
size_t BIT_NUM, bit_integral VALUE_TYPE>
auto ghassanpl::make_bit_reference |
( |
VALUE_TYPE & |
value | ) |
|
◆ make_bit_reference() [4/4]
template<bit_integral VALUE_TYPE>
auto ghassanpl::make_bit_reference |
( |
VALUE_TYPE & |
value, |
|
|
size_t |
bit_num |
|
) |
| |
◆ most_significant_half()
Returns an integer with the N/2 most significant bits of the given N-bit integer.
Definition at line 96 of file bits.h.
◆ to_big_endian()
Returns val
in its big-endian representation.
Definition at line 117 of file bits.h.
◆ to_endian() [1/2]
template<std::endian ENDIANNESS, bit_integral B>
Returns val
in its ENDIANNESS
representation.
Definition at line 125 of file bits.h.
◆ to_endian() [2/2]
template<bit_integral B>
constexpr B ghassanpl::to_endian |
( |
B |
val, |
|
|
std::endian |
endianness |
|
) |
| |
|
constexprnoexcept |
Returns val
in its endianness
representation.
Definition at line 129 of file bits.h.
◆ to_little_endian()
Returns val
in its big-endian representation.
Definition at line 121 of file bits.h.
◆ all_bits
A value of type uint64_t
with all bits set.
Definition at line 36 of file bits.h.
◆ bit_count
template<typename T >
constexpr auto ghassanpl::bit_count |
|
inlineconstexpr |
Equal to the number of bits in the type.
Definition at line 33 of file bits.h.
◆ bit_mask_for_v
template<bit_integral FOR>
Value with all bits available for the FOR type set (e.g. first 8 bits for uint8_t will be set, etc.)
Definition at line 44 of file bits.h.
◆ bit_mask_v
Value with bits between BEGIN and END (exclusive) set.
Definition at line 40 of file bits.h.
◆ dynamic_bit_number