Skip to content

Commit

Permalink
correct the hint in XxHash3
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexicon226 committed Dec 15, 2024
1 parent af89bb0 commit b58916b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/std/hash/xxhash.zig
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ pub const XxHash3 = struct {
}

fn hash3(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 {
@branchHint(.cold);
@branchHint(.unlikely);
std.debug.assert(input.len > 0 and input.len < 4);

const flip: [2]u32 = @bitCast(secret[0..8].*);
Expand Down Expand Up @@ -625,7 +625,7 @@ pub const XxHash3 = struct {
}

fn hash16(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 {
@branchHint(.cold);
@branchHint(.unlikely);
std.debug.assert(input.len > 8 and input.len <= 16);

const flip: [4]u64 = @bitCast(secret[24..56].*);
Expand All @@ -641,7 +641,7 @@ pub const XxHash3 = struct {
}

fn hash128(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 {
@branchHint(.cold);
@branchHint(.unlikely);
std.debug.assert(input.len > 16 and input.len <= 128);

var acc = XxHash64.prime_1 *% @as(u64, input.len);
Expand All @@ -657,7 +657,7 @@ pub const XxHash3 = struct {
}

fn hash240(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 {
@branchHint(.cold);
@branchHint(.unlikely);
std.debug.assert(input.len > 128 and input.len <= 240);

var acc = XxHash64.prime_1 *% @as(u64, input.len);
Expand All @@ -676,7 +676,7 @@ pub const XxHash3 = struct {
}

noinline fn hashLong(seed: u64, input: []const u8) u64 {
@branchHint(.cold);
@branchHint(.unlikely);
std.debug.assert(input.len >= 240);

const block_count = ((input.len - 1) / @sizeOf(Block)) * @sizeOf(Block);
Expand Down

0 comments on commit b58916b

Please sign in to comment.