hedgewars/uFloat.pas
changeset 6415 af2047bb4f70
parent 6328 d14adf1c7721
child 6443 23364a5fcc86
--- a/hedgewars/uFloat.pas	Wed Nov 23 20:12:16 2011 +0300
+++ b/hedgewars/uFloat.pas	Thu Nov 24 16:18:45 2011 +0100
@@ -62,6 +62,7 @@
 
 // The implemented operators
 
+operator = (const z1, z2: hwFloat) z : boolean; inline;
 operator + (const z1, z2: hwFloat) z : hwFloat; inline;
 operator - (const z1, z2: hwFloat) z : hwFloat; inline;
 operator - (const z1: hwFloat) z : hwFloat; inline;
@@ -88,7 +89,7 @@
 function AngleCos(const Angle: Longword): hwFloat;
 function SignAs(const num, signum: hwFloat): hwFloat; inline; // Returns an hwFloat with the value of parameter num and the sign of signum.
 function hwSign(r: hwFloat): LongInt; inline; // Returns an integer with value 1 and sign of parameter r.
-
+function isZero(const z: hwFloat): boolean; inline;
 {$IFDEF FPC}
 {$J-}
 {$ENDIF}
@@ -159,10 +160,13 @@
              _40: hwFloat = (isNegative: false; QWordValue:  4294967296 * 40);
              _50: hwFloat = (isNegative: false; QWordValue:  4294967296 * 50);
              _70: hwFloat = (isNegative: false; QWordValue:  4294967296 * 70);
+             _90: hwFloat = (isNegative: false; QWordValue:  4294967296 * 90);
             _128: hwFloat = (isNegative: false; QWordValue:  4294967296 * 128);
+            _180: hwFloat = (isNegative: false; QWordValue:  4294967296 * 180);
             _250: hwFloat = (isNegative: false; QWordValue:  4294967296 * 250);
             _256: hwFloat = (isNegative: false; QWordValue:  4294967296 * 256);
             _300: hwFloat = (isNegative: false; QWordValue:  4294967296 * 300);
+            _360: hwFloat = (isNegative: false; QWordValue:  4294967296 * 360);
             _450: hwFloat = (isNegative: false; QWordValue:  4294967296 * 450);
            _1000: hwFloat = (isNegative: false; QWordValue:  4294967296 * 1000);
            _1024: hwFloat = (isNegative: false; QWordValue:  4294967296 * 1024);
@@ -198,6 +202,12 @@
 if i.isNegative then hwFloat2Float:= -hwFloat2Float;
 end;
 
+operator = (const z1, z2: hwFloat) z : boolean; inline;
+begin
+    z:= (z1.isNegative = z2.isNegative) and (z1.QWordValue = z2.QWordValue);
+end;
+
+
 operator + (const z1, z2: hwFloat) z : hwFloat;
 begin
 if z1.isNegative = z2.isNegative then
@@ -404,6 +414,10 @@
                 else AngleCos.QWordValue:= SinTable[Angle - 1024]
 end;
 
+function isZero(const z: hwFloat): boolean; inline; 
+begin
+    isZero := z.QWordValue = 0;
+end;
 {$ENDIF}
 
 end.