udfIsNumberPowerOf2
bln udfIsNumberPowerOf2 (int)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfIsNumberPowerOf2 (intNumber)
Return !(intNumber & (intNumber - 1)) && intNumber
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


;Test.

arrTest = Arrayize ("-2,-1,0,1,2,3,4,5,8,9,16,221,256,65536", ",")
intLast = ArrInfo (arrTest, 1) - 1
strOut = ""
For intI = 0 To intLast
   If udfIsNumberPowerOf2 (arrTest[intI])
      strOut = strOut : arrTest[intI] : "  is Power of 2." : @LF
   Else
      strOut = strOut : arrTest[intI] : "  has other form." : @LF
   EndIf
Next
Message ("udfIsNumberPowerOf2", strOut)

Exit