]> granicus.if.org Git - graphviz/commitdiff
fullArea: remove micro-optimization of 0 value of 'm'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 4 Sep 2021 01:23:05 +0000 (18:23 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 11 Sep 2021 15:34:29 +0000 (08:34 -0700)
This is no longer necessary on modern compilers/processors where square root is
less expensive and this code is not on a hot path.

lib/patchwork/patchwork.c

index 95ce3e0b87ee3689f621ac1a5a5951eb826fbe27..fb3d20101e7bc69b5aed4cd9a64c1ec8e28c775c 100644 (file)
@@ -52,11 +52,8 @@ void dumpTree (treenode_t* r, int ind)
 static double fullArea (treenode_t* p, attrsym_t* mp)
 {
     double m = late_double (p->u.subg, mp, 0, 0);
-    if (m == 0) return p->child_area;
-    else {
-       double wid = (2.0*m + sqrt(p->child_area));
-       return wid*wid;
-    }
+    double wid = 2.0 * m + sqrt(p->child_area);
+    return wid * wid;
 }
 
 static double getArea (void* obj, attrsym_t* ap)