Skip to documentation
SLOP

tiny.simd.Cuckoo2x2

Reference tiny.simd Cuckoo2x2

Defined in cuckoo2x2.

API (7)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callscuckoo2x2Cuckoo2x2
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/simd/src/cuckoo2x2.zig:59

zig
pub const Cuckoo2x2 = struct {    hash1: hash_mod.WeakTwoMul,    data: Cuckoo2x2Data,    const Self = @This();    pub fn init(data: Cuckoo2x2Data) Self {        std.debug.assert(!data.isEmpty());        std.debug.assert(data.numBuckets() >= minimum_bucket_count);        return .{            .hash1 = hash_mod.WeakTwoMul.initKey(data.config.hash_key),            .data = data,        };    }    pub fn getData(self: Self) Cuckoo2x2Data {        return self.data;    }    pub fn contains(self: Self, key: u32) bool {        const h1 = self.hash1.hash(key);        const b1 = h1 & self.data.config.bucket_mask;        const fingerprint = h1 >> 18;        const b2 = b1 ^ (fingerprint + 1);        const primary: u16 = @truncate(fingerprint | 0x4000);        const secondary: u16 = @truncate(fingerprint | 0x8000);        const e1 = self.data.entries[b1];        const e2 = self.data.entries[b2];        return primary == @as(u16, @truncate(e1)) or            primary == @as(u16, @truncate(e1 >> 16)) or            secondary == @as(u16, @truncate(e2)) or            secondary == @as(u16, @truncate(e2 >> 16));    }    pub fn query(self: Self, comptime D: type, keys: D.Vector) D.Mask {        requireTag(D);        const h1 = self.hash1.oneVec(D, keys);        const b1 = h1 & @as(D.Vector, @splat(self.data.config.bucket_mask));        const fingerprint = shift.shiftRight(D, 18, h1);        const b2 = b1 ^ (fingerprint +% @as(D.Vector, @splat(1)));        const primary = fingerprint | @as(D.Vector, @splat(0x4000));        const secondary = fingerprint | @as(D.Vector, @splat(0x8000));        const e1 = indexed.gatherIndex(D, self.data.entries, b1);        const e2 = indexed.gatherIndex(D, self.data.entries, b2);        const low_mask: D.Vector = @splat(0xffff);        const found = (e1 & low_mask == primary) |            (shift.shiftRight(D, 16, e1) == primary) |            (e2 & low_mask == secondary) |            (shift.shiftRight(D, 16, e2) == secondary);        return !found;    }    pub fn containsVec(self: Self, comptime D: type, keys: D.Vector) D.Mask {        return !self.query(D, keys);    }};

Source: lib/simd/src/root.zig:613

zig
pub const Cuckoo2x2 = cuckoo2x2.Cuckoo2x2;
Called byCallsNo direct callstest sourcelib.simd.src.cuckoo2x2test: Highway Cuckoo2x2 builds and qu...test sourcelib.simd.src.cuckoo2x2test: Highway Cuckoo2x2 represents th...test sourcelib.simd.src.cuckoo2x2test: Highway Cuckoo2x2 scalar and ve...Cuckoo2x2contains
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallstest sourcelib.simd.src.cuckoo2x2test: Highway Cuckoo2x2 scalar and ve...Cuckoo2x2queryCuckoo2x2containsVec
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callscuckoo2x2makeCuckoo2x2test sourcelib.simd.src.cuckoo2x2test: Highway Cuckoo2x2 builds and qu...test sourcelib.simd.src.cuckoo2x2test: Highway Cuckoo2x2 represents th...test sourcelib.simd.src.cuckoo2x2test: Highway Cuckoo2x2 scalar and ve...Cuckoo2x2init
Static calls · unresolved targets: 0 · external targets: 3.
Called byCallsCuckoo2x2containsVecprivate sourcelib.simd.src.cuckoo2x2requireTagindexedgatherIndexshiftshiftRightCuckoo2x2query
Static calls · unresolved targets: 0 · external targets: 1.

Audit

Definitions6
Public names12
Members2
Version26.7.0
Revisiondaab053ee433