about summary refs log tree commit diff
path: root/aoc
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-12-15 17:21:17 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-12-15 17:21:17 +0700
commitf934ff8b3b44bfea5f0d3eb9d16fba06a9289849 (patch)
tree2629c2ae8aacd5dc80890b34dd4da7726a598510 /aoc
parent8f82cd174f340a69bbd3738bb7b521f46a98a720 (diff)
downloadcp-f934ff8b3b44bfea5f0d3eb9d16fba06a9289849.tar.gz
[aoc/2021/15] Improve portability
Diffstat (limited to 'aoc')
-rw-r--r--aoc/2021/15/part-one.zig2
-rw-r--r--aoc/2021/15/part-two.zig2
2 files changed, 2 insertions, 2 deletions
diff --git a/aoc/2021/15/part-one.zig b/aoc/2021/15/part-one.zig
index a99e1cb..700bcf4 100644
--- a/aoc/2021/15/part-one.zig
+++ b/aoc/2021/15/part-one.zig
@@ -12,7 +12,7 @@ const Risk = packed struct {
     v: u18,
 
     pub fn lt(self: Risk, other: Risk) Order {
-        return order(@bitCast(u32, self), @bitCast(u32, other));
+        return order(self.v, other.v);
     }
 
     pub fn move(self: Risk, queue: *PQ(Risk), dx: i8, dy: i8) !void {
diff --git a/aoc/2021/15/part-two.zig b/aoc/2021/15/part-two.zig
index cc77035..452a6c9 100644
--- a/aoc/2021/15/part-two.zig
+++ b/aoc/2021/15/part-two.zig
@@ -12,7 +12,7 @@ const Risk = packed struct {
     v: u22,
 
     pub fn lt(self: Risk, other: Risk) Order {
-        return order(@bitCast(u40, self), @bitCast(u40, other));
+        return order(self.v, other.v);
     }
 
     pub fn move(self: Risk, queue: *PQ(Risk), dx: i10, dy: i10) !void {