]> granicus.if.org Git - graphviz/commitdiff
neatogen: [nfc] rephrase some boolean accumulation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 15 Feb 2022 08:01:21 +0000 (19:01 +1100)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 16 Feb 2022 10:05:54 +0000 (21:05 +1100)
These operations can be written simpler using bitwise-or assignment.

lib/neatogen/constrained_majorization.c

index 7d6b49a676292cf518e107de63926eceab285ea9..ea1723d5feff6c082a72a6c379e68d14e0766159 100644 (file)
@@ -86,8 +86,7 @@ int stress_majorization_with_hierarchy(vtx_data * graph,      /* Input graph in spars
     if (graph[0].edists != NULL) {
        for (i = 0; i < n; i++) {
            for (j = 1; j < graph[i].nedges; j++) {
-               directionalityExist = directionalityExist
-                   || (graph[i].edists[j] != 0);
+               directionalityExist |= graph[i].edists[j] != 0;
            }
        }
     }
@@ -418,8 +417,7 @@ int stress_majorization_with_hierarchy(vtx_data * graph,    /* Input graph in spars
        converged =
            fabs(new_stress - old_stress) / fabs(old_stress + 1e-10) <
            Epsilon;
-       converged = converged || (iterations > 1
-                                 && new_stress > old_stress);
+       converged |= iterations > 1 && new_stress > old_stress;
        /* in first iteration we allowed stress increase, which 
         * might result ny imposing constraints
         */