Returns the nearest (smaller or larger) power of 2 for the specified value.
The value for which to calculate the nearest power of 2.
The nearest power of 2.
math.nearestPowerOfTwo(17); // returns 16math.nearestPowerOfTwo(24); // returns 32 Copy
math.nearestPowerOfTwo(17); // returns 16math.nearestPowerOfTwo(24); // returns 32
Returns the nearest (smaller or larger) power of 2 for the specified value.