fix(bench): change HAMT StringContext to be identical to others

This commit is contained in:
Rekai Nyangadzayi Musuka 2024-09-14 18:00:53 -05:00
parent 7bdcbfd6f5
commit 3e82fde54a
2 changed files with 3 additions and 3 deletions

View File

@ -2,10 +2,10 @@ const std = @import("std");
const HashArrayMappedTrie = @import("hamt").HashArrayMappedTrie; const HashArrayMappedTrie = @import("hamt").HashArrayMappedTrie;
const StringContext = struct { const StringContext = struct {
pub const Digest = u64; pub const Digest = u32;
pub fn hash(input: []const u8) Digest { 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 { pub fn eql(left: []const u8, right: []const u8) bool {

View File

@ -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); const shift_amt: Log2Int(Digest) = @intCast(table_size - offset);
return @truncate(hash >> shift_amt); return @truncate(hash >> shift_amt);