Maybe someone finds any use in the following procedure (found somewhere
on the net).
The procedure returns TRUE if x.l is a power of 2 and FALSE if it
is not.
Code: Select all
Procedure isPowerOfTwo(x)
If ((x & -x) = x)
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
Debug isPowerOfTwo(64)
Debug isPowerOfTwo(6)