mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
CommonFuncs: Convert ROUND_UP_POW2 macro to a function
Also move it to MathUtils where it belongs with the rest of the power-of-two functions. This gets rid of pollution of the current scope of any translation unit with b<value> macros that aren't intended to be used directly.
This commit is contained in:
@ -29,6 +29,19 @@ constexpr bool IsPow2(T imm)
|
||||
return imm > 0 && (imm & (imm - 1)) == 0;
|
||||
}
|
||||
|
||||
constexpr u32 NextPowerOf2(u32 value)
|
||||
{
|
||||
--value;
|
||||
value |= value >> 1;
|
||||
value |= value >> 2;
|
||||
value |= value >> 4;
|
||||
value |= value >> 8;
|
||||
value |= value >> 16;
|
||||
++value;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct Rectangle
|
||||
{
|
||||
|
Reference in New Issue
Block a user