hedgewars/uUtils.pas
changeset 4981 0c60ade27a0a
parent 4976 088d40d8aba2
child 5118 9cfdb9bc6140
--- 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;