From 42e252db3aec509b4f647026c0c8e932844b6f1f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 10 Jul 2024 17:27:30 -0700 Subject: [PATCH] std.Build.Cache.Path: fix hash impl on windows --- lib/std/Build/Cache/Path.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/std/Build/Cache/Path.zig b/lib/std/Build/Cache/Path.zig index c7160ea14350..0abe79d373d0 100644 --- a/lib/std/Build/Cache/Path.zig +++ b/lib/std/Build/Cache/Path.zig @@ -183,7 +183,11 @@ pub const TableAdapter = struct { pub fn hash(self: TableAdapter, a: Cache.Path) u32 { _ = self; - const seed: u32 = @bitCast(a.root_dir.handle.fd); + const seed = switch (@typeInfo(@TypeOf(a.root_dir.handle.fd))) { + .Pointer => @intFromPtr(a.root_dir.handle.fd), + .Int => @as(u32, @bitCast(a.root_dir.handle.fd)), + else => @compileError("unimplemented hash function"), + }; return @truncate(Hash.hash(seed, a.sub_path)); } pub fn eql(self: TableAdapter, a: Cache.Path, b: Cache.Path, b_index: usize) bool {