day 7
This commit is contained in:
23
day0.h
23
day0.h
@@ -12,27 +12,36 @@ ch test[] = {
|
||||
#embed "day0_test.txt"
|
||||
};
|
||||
|
||||
alignas(0x40) static
|
||||
struct {
|
||||
line padstart[4];
|
||||
struct { ch *s; num _extra[7]; };
|
||||
union { line l; struct { ch s[16]; num n; }; } result;
|
||||
line padend;
|
||||
} m;
|
||||
static_assert(offsetof(typeof(m),result) % 64 == 0);
|
||||
static_assert(offsetof(typeof(m),padend) % 64 == 0);
|
||||
|
||||
static
|
||||
num do_part1(size_t file_len, ch file[file_len]) {
|
||||
ch *s = file;
|
||||
num result = 0;
|
||||
m = (typeof(m)){ };
|
||||
m.s = file;
|
||||
m.result.n = 0;
|
||||
|
||||
#if DBG
|
||||
print("\n");
|
||||
#endif
|
||||
|
||||
do {
|
||||
s++;
|
||||
} while (s != &file[file_len]);
|
||||
m.s++;
|
||||
} while (m.s != &file[file_len]);
|
||||
|
||||
return result;
|
||||
return m.result.n;
|
||||
}
|
||||
|
||||
static
|
||||
num do_part2(size_t file_len, ch file[file_len]) {
|
||||
num result = 0;
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define RUN_TEST1 1
|
||||
|
||||
Reference in New Issue
Block a user