Mjolnir Core
Core functionality of the Mjolnir API

◆ bit_construct()

consteval auto bit_construct ( [[maybe_unused] ] bool  left_is_low = false) -> T_Type
noexcept

Construct an unsigned integer by setting its individual bits.

The function sets the first N lowest bits of the returned integer where N is the number of provided template parameters. Each parameter defines the value of a single bit. Depending on the value of left_is_low, the bits can either be specified in ascending or descending order. Or in other words, left_is_low controls if the lowest bit is represented by the first or last parameter.

Template Parameters
T_TypeAn unsigned integer type
t_bit_valuesThe individual bits (see detailed description). Values other than 0 or 1 will trigger a static assertion.
Parameters
[in]left_is_lowIf true, the first value represents the lowest bit. Otherwise, the last value represents the lowest bit.
Returns
The constructed integer value