From f934ff8b3b44bfea5f0d3eb9d16fba06a9289849 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Wed, 15 Dec 2021 17:21:17 +0700 Subject: [aoc/2021/15] Improve portability --- aoc/2021/15/part-one.zig | 2 +- aoc/2021/15/part-two.zig | 2 +- 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 { -- cgit 1.4.1