Skip to content

Commit 5c8912d

Browse files
Rexicon226kprotty
andauthored
XXH3 Implementation for Zig STD (#17530)
XXH3 is the faster alternative to XXH64 which utilizes SIMD when hashing large chunks of memory and similar mixing to WyHash (64x64 -> 128 mul) for smaller inputs. Co-authored-by: Reixcon226 <[email protected]> --------- Co-authored-by: kprotty <[email protected]>
1 parent 3b21c15 commit 5c8912d

File tree

3 files changed

+417
-3
lines changed

3 files changed

+417
-3
lines changed

lib/std/hash.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const wyhash = @import("hash/wyhash.zig");
3333
pub const Wyhash = wyhash.Wyhash;
3434

3535
const xxhash = @import("hash/xxhash.zig");
36+
pub const XxHash3 = xxhash.XxHash3;
3637
pub const XxHash64 = xxhash.XxHash64;
3738
pub const XxHash32 = xxhash.XxHash32;
3839

lib/std/hash/benchmark.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ const Hash = struct {
2424
};
2525

2626
const hashes = [_]Hash{
27+
Hash{
28+
.ty = hash.XxHash3,
29+
.name = "xxh3",
30+
.init_u64 = 0,
31+
.has_anytype_api = @as([]const comptime_int, &[_]comptime_int{ 8, 16, 32, 48, 64, 80, 96, 112, 128 }),
32+
},
2733
Hash{
2834
.ty = hash.XxHash64,
2935
.name = "xxhash64",

0 commit comments

Comments
 (0)