co_ecs 0.9.0
Cobalt ECS
Loading...
Searching...
No Matches
bits.hpp
Go to the documentation of this file.
1#pragma once
2
3namespace co_ecs::detail {
4
10constexpr auto mod_2n(auto value, auto divisor) noexcept -> decltype(auto) {
11 return value & (divisor - 1U);
12}
13
17constexpr auto is_power_of_2(auto value) -> bool {
18 return ((value & (value - 1U)) == 0);
19}
20
21} // namespace co_ecs::detail
Definition component.hpp:17
constexpr auto mod_2n(auto value, auto divisor) noexcept -> decltype(auto)
Calculate the value % b=2^n.
Definition bits.hpp:10
constexpr auto is_power_of_2(auto value) -> bool
Check if value is a power of 2.
Definition bits.hpp:17