use that sort

This commit is contained in:
2025-12-05 16:36:57 -06:00
parent e851e48f1e
commit f43acb06fe

6
day5.c
View File

@@ -131,10 +131,8 @@ unsigned long do_part2(size_t file_len, unsigned char file[file_len]) {
d++;
} while (*s != '\n');
#if PRETTY
size_t range_cnt = d - ranges;
qsort(ranges, range_cnt, sizeof(*ranges), linecmp);
#endif
d->sv = 0;
@@ -147,12 +145,10 @@ unsigned long do_part2(size_t file_len, unsigned char file[file_len]) {
bcdint djs = dj->sv;
bcdint dje = dj->ev;
if (djs == -1) continue;
if (djs > die) continue outer;
if (djs <= die && djs >= dis) {
djs = bcdadd(die, 1);
}
if (dje >= dis && dje <= die) {
dje = bcdsub(dis, 1);
}
if (djs == dj->sv && dje == dj->ev)
continue;
if (dje < djs) {