]> granicus.if.org Git - graphviz/commitdiff
rephrase unnecessarily cryptic bitwise operations
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 19 Mar 2021 04:48:52 +0000 (21:48 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 28 Mar 2021 22:58:00 +0000 (15:58 -0700)
This is just doing boolean logic. Sometimes there is a motivation to use bitwise
operators in place of boolean operators to optimize hot paths that are
negatively affected by the stalling semantics of boolean shortcut logic. But
this is not the case here. This is not a hot path.

lib/neatogen/edges.c

index 63c939e0e0a08825895ee1f981c739aa1f3c9062..805bc760f5e4e56f215f5b7d0442bedf04f1ab8c 100644 (file)
@@ -117,7 +117,7 @@ void clip_line(Edge * e)
            x2 = e->c - e->b * y2;
        }
 
-       if (((x1 > pxmax) & (x2 > pxmax)) | ((x1 < pxmin) & (x2 < pxmin)))
+       if ((x1 > pxmax && x2 > pxmax) || (x1 < pxmin && x2 < pxmin))
            return;
        if (x1 > pxmax) {
            x1 = pxmax;
@@ -166,7 +166,7 @@ void clip_line(Edge * e)
            y2 = e->c - e->a * x2;
        }
 
-       if (((y1 > pymax) & (y2 > pymax)) | ((y1 < pymin) & (y2 < pymin)))
+       if ((y1 > pymax && y2 > pymax) || (y1 < pymin && y2 < pymin))
            return;
        if (y1 > pymax) {
            y1 = pymax;