# HG changeset patch # User unc0rr # Date 1299227453 -10800 # Node ID 0c60ade27a0aaa09fd8bc6cf46fb0aa0f591a8a2 # Parent 3b40c80c0fe3841f7cd5e3f49e3633ac41fc0f4a Optimize check (not like it is called much, just ffs; not tested) diff -r 3b40c80c0fe3 -r 0c60ade27a0a hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Thu Mar 03 22:15:42 2011 +0300 +++ b/hedgewars/uUtils.pas Fri Mar 04 11:30:53 2011 +0300 @@ -185,9 +185,7 @@ function isPowerOf2(i: Longword): boolean; begin -if i = 0 then exit(true); -while not odd(i) do i:= i shr 1; -isPowerOf2:= (i = 1) +isPowerOf2:= (i and (i - 1)) = 0 end; function toPowerOf2(i: Longword): Longword;