|
@ -177,10 +177,15 @@ int main(int argc, char *argv[]) |
|
|
while (regs[ip] >= 0 && regs[ip] < instructions_len) { |
|
|
while (regs[ip] >= 0 && regs[ip] < instructions_len) { |
|
|
struct instr *instr = &instructions[regs[ip]]; |
|
|
struct instr *instr = &instructions[regs[ip]]; |
|
|
|
|
|
|
|
|
// Day 21 part 2 optimizations...
|
|
|
// Day 21 part 2 optimization...
|
|
|
if (regs[ip] == 17) { |
|
|
if (instr->i == INSTR_GTIR && instr->a == 0x100) { |
|
|
regs[5] >>= 8; |
|
|
reg_t *reg = ®s[instr->b]; |
|
|
regs[ip] = 8; |
|
|
if (0x100 <= *reg) { |
|
|
|
|
|
*reg >>= 8; |
|
|
|
|
|
regs[ip] = 8; |
|
|
|
|
|
} else { |
|
|
|
|
|
regs[ip] = 28; |
|
|
|
|
|
} |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|