From: Matthew Fernandez Date: Tue, 15 Feb 2022 08:01:21 +0000 (+1100) Subject: neatogen: [nfc] rephrase some boolean accumulation X-Git-Tag: 3.0.0~26^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da48b581136b6abe588ca506a2a34184f1f2476f;p=graphviz neatogen: [nfc] rephrase some boolean accumulation These operations can be written simpler using bitwise-or assignment. --- diff --git a/lib/neatogen/constrained_majorization.c b/lib/neatogen/constrained_majorization.c index 7d6b49a67..ea1723d5f 100644 --- a/lib/neatogen/constrained_majorization.c +++ b/lib/neatogen/constrained_majorization.c @@ -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 */