From f792852c55a5880af75304ababe8becdca6a6cd2 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 19 Nov 2022 16:19:20 -0800 Subject: [PATCH] neatogen countOverlap: use a clearer iteration idiom --- lib/neatogen/adjust.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/neatogen/adjust.c b/lib/neatogen/adjust.c index 44336995d..3fa7966f3 100644 --- a/lib/neatogen/adjust.c +++ b/lib/neatogen/adjust.c @@ -306,23 +306,20 @@ static void rmEquality(void) static int countOverlap(int iter) { int count = 0; - Info_t *ip = nodeInfo; - Info_t *jp; for (size_t i = 0; i < nsites; i++) nodeInfo[i].overlaps = 0; for (size_t i = 0; i < nsites - 1; i++) { - jp = ip + 1; + Info_t *ip = &nodeInfo[i]; for (size_t j = i + 1; j < nsites; j++) { + Info_t *jp = &nodeInfo[j]; if (polyOverlap(ip->site.coord, &ip->poly, jp->site.coord, &jp->poly)) { count++; ip->overlaps = 1; jp->overlaps = 1; } - jp++; } - ip++; } if (Verbose > 1) -- 2.40.0