mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 16:34:13 +01:00
ircd::util: Add powerof2() bithack.
This commit is contained in:
parent
6937e91fc3
commit
0da55e93aa
1 changed files with 7 additions and 0 deletions
|
@ -1269,5 +1269,12 @@ struct is_zero
|
|||
};
|
||||
|
||||
|
||||
constexpr bool
|
||||
is_powerof2(const long long v)
|
||||
{
|
||||
return v && !(v & (v - 1LL));
|
||||
}
|
||||
|
||||
|
||||
} // namespace util
|
||||
} // namespace ircd
|
||||
|
|
Loading…
Reference in a new issue