12 #ifndef ESTD_LOG2U_HPP_ 13 #define ESTD_LOG2U_HPP_ 23 #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) 38 constexpr
int log2u(
const unsigned int value)
40 return value != 0 ? (
sizeof(value) * CHAR_BIT - 1) - __builtin_clz(value) : 0;
58 #endif // ESTD_LOG2U_HPP_ Collection of useful templates.
Definition: DmaChannel.hpp:121
constexpr int log2u(const unsigned int value)
log2()-like constexpr function for unsigned int.
Definition: log2u.hpp:38
#define STATIC_ASSERT(...)
Produces a static_assert() where the expression is also used as the message.
Definition: log2u.hpp:23