up
previous
next
IsPowerOf2
-- check if an integer is a power of 2
Syntax
IsPowerOf2(N: INT): BOOL
Description
This function determines whether an integer is a (positive) power of 2. To find out which power of 2 use the function
FloorLog2
(see entry about
FloorLog2, FloorLog10, FloorLogBase
).
Example
/**/ IsPowerOf2(2); true /**/ IsPowerOf2(-2); false
See Also
FloorLog2, FloorLog10, FloorLogBase