diff options
Diffstat (limited to 'src/openvic-simulation/utility')
-rw-r--r-- | src/openvic-simulation/utility/NumberUtils.hpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/openvic-simulation/utility/NumberUtils.hpp b/src/openvic-simulation/utility/NumberUtils.hpp index d814019..8656f27 100644 --- a/src/openvic-simulation/utility/NumberUtils.hpp +++ b/src/openvic-simulation/utility/NumberUtils.hpp @@ -49,4 +49,8 @@ namespace OpenVic::NumberUtils { return c; } + + constexpr bool is_power_of_two(uint64_t n) { + return n > 0 && (n & (n - 1)) == 0; + } } |