Skip to content

Commit 42e252d

Browse files
committed
std.Build.Cache.Path: fix hash impl on windows
1 parent d7c59fd commit 42e252d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/std/Build/Cache/Path.zig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,11 @@ pub const TableAdapter = struct {
183183

184184
pub fn hash(self: TableAdapter, a: Cache.Path) u32 {
185185
_ = self;
186-
const seed: u32 = @bitCast(a.root_dir.handle.fd);
186+
const seed = switch (@typeInfo(@TypeOf(a.root_dir.handle.fd))) {
187+
.Pointer => @intFromPtr(a.root_dir.handle.fd),
188+
.Int => @as(u32, @bitCast(a.root_dir.handle.fd)),
189+
else => @compileError("unimplemented hash function"),
190+
};
187191
return @truncate(Hash.hash(seed, a.sub_path));
188192
}
189193
pub fn eql(self: TableAdapter, a: Cache.Path, b: Cache.Path, b_index: usize) bool {

0 commit comments

Comments
 (0)