16 #define GETTEXT_DOMAIN "wesnoth-test"
22 static_assert(bit_width<uint8_t>() == 8);
23 static_assert(bit_width<uint16_t>() == 16);
24 static_assert(bit_width<uint32_t>() == 32);
25 static_assert(bit_width<uint64_t>() == 64);
27 static_assert(
bit_width(
static_cast<uint8_t
>(0)) == 8);
28 static_assert(
bit_width(
static_cast<uint16_t
>(0)) == 16);
29 static_assert(
bit_width(
static_cast<uint32_t
>(0)) == 32);
30 static_assert(
bit_width(
static_cast<uint64_t
>(0)) == 64);
37 static_assert(
count_leading_zeros(
static_cast<unsigned int>(0)) == bit_width<unsigned int>());
38 static_assert(
count_leading_zeros(
static_cast<unsigned long int>(0)) == bit_width<unsigned long int>());
39 static_assert(
count_leading_zeros(
static_cast<unsigned long long int>(0)) == bit_width<unsigned long long int>());
General math utility functions.
constexpr unsigned int count_leading_ones(N n)
Returns the quantity of leading 1 bits in n — i.e., the quantity of bits in n, minus the 1-based bit ...
constexpr std::enable_if_t< std::is_integral_v< N >, unsigned int > count_leading_zeros(N n)
Returns the quantity of leading 0 bits in n — i.e., the quantity of bits in n, minus the 1-based bit ...
constexpr std::size_t bit_width()
Returns the size, in bits, of an instance of type T, providing a convenient and self-documenting name...