BAN: Add is_power_of_two to Math functions
This commit is contained in:
parent
e1a6e7c3ac
commit
9cf09165b5
|
@ -51,6 +51,14 @@ namespace BAN::Math
|
|||
return (a + b - 1) / b;
|
||||
}
|
||||
|
||||
template<integral T>
|
||||
inline constexpr bool is_power_of_two(T value)
|
||||
{
|
||||
if (value == 0)
|
||||
return false;
|
||||
return (value & (value - 1)) == 0;
|
||||
}
|
||||
|
||||
template<integral T>
|
||||
inline constexpr T little_endian_to_host(const uint8_t* bytes)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue