fix(bench): change HAMT StringContext to be identical to others
This commit is contained in:
parent
7bdcbfd6f5
commit
3e82fde54a
|
@ -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 {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue