Click or drag to resize

MathExNextPowerOfTwo Method (Int32)

Calculates the next highest power of two.

Namespace:  NeoAxis
Assembly:  NeoAxis.Core (in NeoAxis.Core.dll) Version: 2024.1.1.0 (2024.1.1.0)
Syntax
C#
public static int NextPowerOfTwo(
	int v
)

Parameters

v
Type: SystemInt32
A value.

Return Value

Type: Int32
The next power of two after the value.
Remarks
This is a minimal method meant to be fast. There is a known edge case where an input of 0 will output 0 instead of the mathematically correct value of 1. It will not be fixed.
See Also