From 2692f3f6216083e433062507d9953b7f64d277af Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Sat, 22 Jan 2022 20:18:15 +0100 Subject: [PATCH] day19: cosmetic changes --- 2021/day19/Makefile | 2 +- 2021/day19/aoc-c.c | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/2021/day19/Makefile b/2021/day19/Makefile index 77c2652..eb5077c 100644 --- a/2021/day19/Makefile +++ b/2021/day19/Makefile @@ -65,7 +65,7 @@ ex2: aoc-c @$(TIME) aoc-c -p 2 < $(INPUT) clean: - @rm -f aoc-c core* gmon.out + @rm -f aoc-c core* vgcore* gmon.out aoc-c.s .c: @echo compiling $< diff --git a/2021/day19/aoc-c.c b/2021/day19/aoc-c.c index 8f8b538..c37bcec 100644 --- a/2021/day19/aoc-c.c +++ b/2021/day19/aoc-c.c @@ -371,8 +371,8 @@ static int count_common_distances(scanner_t *s1, scanner_t *s2) /* we need to adjust references for the two pairs of * 2 beacons having same distance, for both scanners. */ - for (int i = 0; i < 2; i++) { - if (i == 0) { + for (int sc = 0; sc < 2; sc++) { + if (sc == 0) { beacon1 = pdist1->beacon1; beacon2 = pdist1->beacon2; scanner = s1; @@ -416,17 +416,13 @@ static int count_common_distances(scanner_t *s1, scanner_t *s2) nref++; } } - break; } - - } else if (dist1 < dist2) { plist1 = plist1->next; } else { /* dist1 > dist2 */ plist2 = plist2->next; } - } return count; }