From 3e82fde54a1f0249a05a04f6e8041a46bef97046 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Sat, 14 Sep 2024 18:00:53 -0500 Subject: [PATCH] fix(bench): change HAMT StringContext to be identical to others --- src/bench.zig | 4 ++-- src/trie.zig | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bench.zig b/src/bench.zig index 3149bf9..38dd2b4 100644 --- a/src/bench.zig +++ b/src/bench.zig @@ -2,10 +2,10 @@ const std = @import("std"); const HashArrayMappedTrie = @import("hamt").HashArrayMappedTrie; const StringContext = struct { - pub const Digest = u64; + pub const Digest = u32; pub fn hash(input: []const u8) Digest { - return std.hash.Wyhash.hash(0, input); + return @truncate(std.hash.Wyhash.hash(0, input)); } pub fn eql(left: []const u8, right: []const u8) bool { diff --git a/src/trie.zig b/src/trie.zig index c7553c4..d449727 100644 --- a/src/trie.zig +++ b/src/trie.zig @@ -181,7 +181,7 @@ pub fn HashArrayMappedTrie(comptime K: type, comptime V: type, comptime Context: } } - fn tableIdx(hash: Digest, offset: u16) Log2Int(Digest) { + inline fn tableIdx(hash: Digest, offset: u16) Log2Int(Digest) { const shift_amt: Log2Int(Digest) = @intCast(table_size - offset); return @truncate(hash >> shift_amt);