Click or drag to resize

MathExNextPowerOfTwo(Int32) Method

Calculates the next highest power of two.

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

Parameters

v  Int32
A value.

Return Value

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