From: Brendan Hansen Date: Tue, 15 Dec 2020 01:32:56 +0000 (-0600) Subject: sped up day 14; updated day 8 X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=c69307c2ea2e44ba78e36dbea8cdf1542acb4847;p=onyx-aoc-2020.git sped up day 14; updated day 8 --- diff --git a/day14.onyx b/day14.onyx index e2e1789..2dff089 100644 --- a/day14.onyx +++ b/day14.onyx @@ -85,7 +85,7 @@ main :: proc (args: [] cstr) { file := reader.make(contents); mem : map.Map(u64, u64); - map.init(^mem, 64); + map.init(^mem, 257); defer map.free(^mem); mask : Bitmask; diff --git a/day8.onyx b/day8.onyx index 111c105..a93a243 100644 --- a/day8.onyx +++ b/day8.onyx @@ -14,9 +14,9 @@ Instruction :: struct { // Returns if the program successfully exited. get_acc_value :: proc (instrs: [..] Instruction, ret_acc: ^i32) -> bool { - already_been: i32map.I32Map(bool); - i32map.init(^already_been); - defer i32map.free(^already_been); + already_been: map.Map(i32, bool); + map.init(^already_been); + defer map.free(^already_been); ip := 0; acc := 0; @@ -27,8 +27,8 @@ get_acc_value :: proc (instrs: [..] Instruction, ret_acc: ^i32) -> bool { break; } - if i32map.has(^already_been, ip) do break; - i32map.put(^already_been, ip, true); + if map.has(^already_been, ip) do break; + map.put(^already_been, ip, true); switch instrs[ip].opcode { case OpCode.Nop do ip += 1;