file
bit.hBit manipulation functions. C++20's <bit> with extra steps.
This header includes a number of others:
Namespaces
- namespace muu
- The root namespace for all muu functions and types.
Functions
-
template <typename T>auto bit_width(T val) -> T constexpr noexcept
- Finds the smallest number of bits needed to represent the given value.
-
template <size_t Index, typename T>auto byte_select(T val) -> uint8_t constexpr noexcept
- Gets a specific byte from an integer.
-
template <typename T>auto byte_select(T val, size_t index) -> uint8_t constexpr noexcept
- Gets a specific byte from an integer.
-
template <size_t... ByteIndices, typename T>auto swizzle(T val) -> auto constexpr noexcept
- Select and re-pack arbitrary bytes from an integer.