prevent overflow
authornemo
Tue, 11 Aug 2009 19:56:01 +0000
changeset 2300 d633bc70c893
parent 2299 ac9a2f2431c7
child 2301 7a4ad0772c88
prevent overflow
hedgewars/uFloat.pas
--- a/hedgewars/uFloat.pas	Sun Aug 09 22:07:57 2009 +0000
+++ b/hedgewars/uFloat.pas	Tue Aug 11 19:56:01 2009 +0000
@@ -273,8 +273,8 @@
 
 function hwRound(const t: hwFloat): LongInt;
 begin
-if t.isNegative then hwRound:= -t.Round
-                else hwRound:= t.Round
+if t.isNegative then hwRound:= -(t.Round and $7FFFFFFF)
+                else hwRound:= t.Round and $7FFFFFFF
 end;
 
 function hwAbs(const t: hwFloat): hwFloat;