std.bitset
bits 0..n-1, 64 per word, in an arena; index past the end panics
BitSet
Section titled “BitSet”pub BitSet :: struct { words: []u64, n: usize,}n: how many bits
BitSet.len
Section titled “BitSet.len”pub len :: fn(self: *Self) -> usizeBitSet.has
Section titled “BitSet.has”pub has :: fn(self: *Self, i: usize) -> boolBitSet.set
Section titled “BitSet.set”pub set :: fn(self: *Self, i: usize)BitSet.unset
Section titled “BitSet.unset”pub unset :: fn(self: *Self, i: usize)BitSet.toggle
Section titled “BitSet.toggle”pub toggle :: fn(self: *Self, i: usize)BitSet.put
Section titled “BitSet.put”pub put :: fn(self: *Self, i: usize, on: bool)set or clear bit i
BitSet.count
Section titled “BitSet.count”pub count :: fn(self: *Self) -> usizenumber of set bits
BitSet.set_all
Section titled “BitSet.set_all”pub set_all :: fn(self: *Self)BitSet.clear_all
Section titled “BitSet.clear_all”pub clear_all :: fn(self: *Self)BitSet.union_with
Section titled “BitSet.union_with”pub union_with :: fn(self: *Self, other: *BitSet)self |= other; same length required
BitSet.intersect_with
Section titled “BitSet.intersect_with”pub intersect_with :: fn(self: *Self, other: *BitSet)self &= other
BitSet.subtract
Section titled “BitSet.subtract”pub subtract :: fn(self: *Self, other: *BitSet)self &= ~other
BitSet.ones
Section titled “BitSet.ones”pub ones :: fn(self: *Self) -> Onesset bits, smallest first
pub Ones :: struct { s: *BitSet, word: usize, rest: u64,}iterator from BitSet.ones
word: the word being looked atrest: its bits not given yet
Ones.next
Section titled “Ones.next”pub next :: fn(self: *Self) -> ?usizepub make :: fn(a: *Arena, n: usize) -> BitSetn clear bits in a