forked from Bananymous/banan-os
BAN: Add is_power_of_two to Math functions
This commit is contained in:
parent
5bfcf6783e
commit
88a2c60065
|
@ -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