From da48b581136b6abe588ca506a2a34184f1f2476f Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 15 Feb 2022 19:01:21 +1100 Subject: [PATCH] neatogen: [nfc] rephrase some boolean accumulation These operations can be written simpler using bitwise-or assignment. --- lib/neatogen/constrained_majorization.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 */ -- 2.40.0