Skip to documentation
SLOP

tiny.simd.BitSet4096

Reference tiny.simd BitSet4096

Defined in bitset.

Called byCallstest sourcelib.simd.src.bitsettest: Highway bit set foreach snapsho...test sourcelib.simd.src.bitsettest: Highway bit set random walks ma...test sourcelib.simd.src.bitsettest: Highway bit sets default empty ...private sourcelib.simd.src.bitsetbitIndexprivate sourcelib.simd.src.bitsetfirstBitprivate sourcelib.simd.src.bitsetrequireCapacityprivate sourcelib.simd.src.bitsetvalidBitsprivate sourcelib.simd.src.bitsetvisitWord+2 morebitsetBitSet4096
Static calls · unresolved targets: 2 · external targets: 10.

Source

Source: lib/simd/src/bitset.zig:283

zig
pub fn BitSet4096(comptime size: usize) type {    requireCapacity(size);    if (size > 4096) @compileError("BitSet4096 supports at most 4096 bits");    const word_count = wordsFor(size);    return struct {        nonzero: BitSet64 = .{},        words: [word_count]BitSet64 = @as([word_count]BitSet64, @splat(.{})),        const Self = @This();        pub const capacity: usize = size;        pub const max_size: usize = capacity;        pub fn maxSize(_: *const Self) usize {            return max_size;        }        pub fn set(self: *Self, index: usize) void {            std.debug.assert(index < max_size);            const word_index = wordIndex(index);            self.words[word_index].set(bitIndex(index));            self.nonzero.set(word_index);            std.debug.assert(self.get(index));        }        pub fn setNonzeroBitsFrom64(self: *Self, bits: u64) void {            const valid = bits & validBits(@min(max_size, 64));            std.debug.assert(valid == bits);            self.words[0].setNonzeroBitsFrom64(valid);            if (valid != 0) self.nonzero.set(0);        }        pub fn clear(self: *Self, index: usize) void {            std.debug.assert(index < max_size);            const word_index = wordIndex(index);            self.words[word_index].clear(bitIndex(index));            if (!self.words[word_index].any()) self.nonzero.clear(word_index);            std.debug.assert(!self.get(index));        }        pub fn get(self: *const Self, index: usize) bool {            std.debug.assert(index < max_size);            return self.words[wordIndex(index)].get(bitIndex(index));        }        pub fn any(self: *const Self) bool {            return self.nonzero.any();        }        pub fn all(self: *const Self) bool {            if (self.nonzero.count() != word_count) return false;            return self.count() == max_size;        }        pub fn first(self: *const Self) usize {            std.debug.assert(self.any());            const word_index = self.nonzero.first();            return word_index * 64 + self.words[word_index].first();        }        pub fn first0(self: *const Self) usize {            std.debug.assert(!self.all());            for (&self.words, 0..) |*word, word_index| {                if (!word.all()) {                    const index = word_index * 64 + word.first0();                    std.debug.assert(index < max_size);                    return index;                }            }            unreachable;        }        pub fn get64(self: *const Self) u64 {            return self.words[0].get64();        }        pub fn foreach(self: *const Self, function: anytype) void {            var remaining_words = self.nonzero.get64();            while (remaining_words != 0) {                const word_index = firstBit(remaining_words);                remaining_words &= remaining_words - 1;                visitWord(self.words[word_index].get64(), word_index * 64, function);            }        }        pub fn count(self: *const Self) usize {            var total: usize = 0;            var remaining_words = self.nonzero.get64();            while (remaining_words != 0) {                const word_index = firstBit(remaining_words);                remaining_words &= remaining_words - 1;                total += self.words[word_index].count();            }            std.debug.assert(total <= max_size);            return total;        }    };}

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

zig
pub const BitSet4096 = bitset.BitSet4096;

Complete call list

7 direct calls.

Audit

Definitions1
Public names2
Members0
Version26.7.0
Revisiondaab053ee433