0
0
Fork 0
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:
Jason Volk 2017-11-15 17:28:23 -08:00
parent 6937e91fc3
commit 0da55e93aa

View file

@ -1269,5 +1269,12 @@ struct is_zero
};
constexpr bool
is_powerof2(const long long v)
{
return v && !(v & (v - 1LL));
}
} // namespace util
} // namespace ircd