NBit Bit Manipulation Library

BitMathExtensions.IsPowerOf2 Method

Checks if a value is a power of two.

[Visual Basic]
<Extension> _
Public Shared Sub IsPowerOf2( _
   ByVal value As UInt32 _
)
[C#]
[Extension]
public static bool IsPowerOf2(
   this uint value
);

Parameters

value
The value to check.

Return Value

True if the value is a power of two. Zero is not considered a power of two.

See Also

BitMathExtensions Class | NBit Namespace