diff --git a/BAN/include/BAN/Math.h b/BAN/include/BAN/Math.h index fa05875d..8302decf 100644 --- a/BAN/include/BAN/Math.h +++ b/BAN/include/BAN/Math.h @@ -51,6 +51,14 @@ namespace BAN::Math return (a + b - 1) / b; } + template + inline constexpr bool is_power_of_two(T value) + { + if (value == 0) + return false; + return (value & (value - 1)) == 0; + } + template inline constexpr T little_endian_to_host(const uint8_t* bytes) {