Small performance optimization
authorunc0rr
Sun, 11 Feb 2007 00:18:16 +0000
changeset 430 57d05fb13ea7
parent 429 7f69c7ac2e97
child 431 79ac59673df3
Small performance optimization
hedgewars/uLand.pas
--- a/hedgewars/uLand.pas	Sun Feb 11 00:14:42 2007 +0000
+++ b/hedgewars/uLand.pas	Sun Feb 11 00:18:16 2007 +0000
@@ -163,7 +163,7 @@
 var i, pi, ni: LongInt;
     NVx, NVy, PVx, PVy: hwFloat;
     x1, x2, y1, y2, cx1, cx2, cy1, cy2: hwFloat;
-    tsq, tcb, t, r1, r2, r3, r4: hwFloat;
+    tsq, tcb, t, r1, r2, r3: hwFloat;
     X, Y: LongInt;
 begin
 pi:= EndI;
@@ -194,16 +194,11 @@
           begin
           tsq:= t * t;
           tcb:= tsq * t;
-          r1:= (1 - 3*t + 3*tsq -   tcb) * x1;
-          r2:= (    3*t - 6*tsq + 3*tcb) * cx1;
-          r3:= (          3*tsq - 3*tcb) * cx2;
-          r4:= (                    tcb) * x2;
-          X:= hwRound(r1 + r2 + r3 + r4);
-          r1:= (1 - 3*t + 3*tsq -   tcb) * y1;
-          r2:= (    3*t - 6*tsq + 3*tcb) * cy1;
-          r3:= (          3*tsq - 3*tcb) * cy2;
-          r4:= (                    tcb) * y2;
-          Y:= hwRound(r1 + r2 + r3 + r4);
+          r1:= (1 - 3*t + 3*tsq -   tcb);
+          r2:= (    3*t - 6*tsq + 3*tcb);
+          r3:= (          3*tsq - 3*tcb);
+          X:= hwRound(r1 * x1 + r2 * cx1 + r3 * cx2 + tcb * x2);
+          Y:= hwRound(r1 * y1 + r2 * cy1 + r3 * cy2 + tcb * y2);
           t:= t + Delta;
           pa.ar[pa.Count].x:= X;
           pa.ar[pa.Count].y:= Y;