Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Private Function

hash8

Private Function
std.hash.xxhash.XxHash3.hash8
fn hash8(seed: u64, input: anytype, noalias secret: *const [192]u8) u64

Params

  • seed: u64
  • input
  • secret: *const [192]u8

File

hash/xxhash.zig:618
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
    fn hash8(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 {
        @branchHint(.cold);
        std.debug.assert(input.len >= 4 and input.len <= 8);

        const flip: [2]u64 = @bitCast(secret[8..24].*);
        const blk: [2]u32 = @bitCast([_][4]u8{
            input[0..4].*,
            input[input.len - 4 ..][0..4].*,
        });

        const mixed = seed ^ (@as(u64, @byteSwap(@as(u32, @truncate(seed)))) << 32);
        const key = (flip[0] ^ flip[1]) -% mixed;
        const combined = (@as(u64, blk[0]) << 32) +% blk[1];
        return avalanche(.{ .rrmxmx = input.len }, key ^ combined);
    }