mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
MathUtil: Generify IsPow2
This will allow it to also be used in the AArch64 emitter.
This commit is contained in:
parent
e88cc33a29
commit
79f40fb8d7
@ -49,9 +49,10 @@ constexpr T Clamp(const T val, const T& min, const T& max)
|
||||
return std::max(min, std::min(max, val));
|
||||
}
|
||||
|
||||
constexpr bool IsPow2(u32 imm)
|
||||
template <typename T>
|
||||
constexpr bool IsPow2(T imm)
|
||||
{
|
||||
return (imm & (imm - 1)) == 0;
|
||||
return imm > 0 && (imm & (imm - 1)) == 0;
|
||||
}
|
||||
|
||||
// The most significant bit of the fraction is an is-quiet bit on all architectures we care about.
|
||||
|
Loading…
Reference in New Issue
Block a user