use that sort
This commit is contained in:
6
day5.c
6
day5.c
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user