Class MathHelpers
Minimal power-of-two test helpers.
public static class MathHelpers
- Inheritance
-
MathHelpers
- Inherited Members
Methods
IsPow2(int)
Whether x is a power of two. Returns true for 0.
public static bool IsPow2(int x)
Parameters
xintThe value to test.
Returns
- bool
trueifxhas at most one bit set.
IsPow2(long)
Whether x is a power of two. Returns true for 0.
public static bool IsPow2(long x)
Parameters
xlongThe value to test.
Returns
- bool
trueifxhas at most one bit set.