fn IntegerBitSet(comptime size: u16) type
A bit set with static size, which is backed by a single integer. This set is good for sets with a small size, but may generate inefficient code for larger sets, especially in debug mode.
Functions
fn complement(self: Self) Self
Returns the complement bit sets. Bits in the result are set if the correspondin…
Returns the complement bit sets. Bits in the result are set if the corresponding bits were not set.
fn differenceWith(self: Self, other: Self) Self
Returns the difference of two bit sets. Bits in the result are set if set in th…
Returns the difference of two bit sets. Bits in the result are set if set in the first but not set in the second set.
fn eql(self: Self, other: Self) bool
Returns true iff every corresponding bit in both bit sets are the same.
fn findFirstSet(self: Self) ?usize
Finds the index of the first set bit. If no bits are set, returns null.
fn intersectWith(self: Self, other: Self) Self
Returns the intersection of two bit sets. Bits in the result are set if the cor…
Returns the intersection of two bit sets. Bits in the result are set if the corresponding bits were set in both inputs.
fn isSet(self: Self, index: usize) bool
Returns true if the bit at the specified index is present in the set, false oth…
Returns true if the bit at the specified index is present in the set, false otherwise.
fn iterator(self: *const Self, comptime options: IteratorOptions) Iterator(options)
Iterates through the items in the set, according to the options. The default op…
Iterates through the items in the set, according to the options. The default options (.{}) will iterate indices of set bits in ascending order. Modifications to the underlying bit set may or may not be observed by the iterator.
fn setIntersection(self: *Self, other: Self) void
Performs an intersection of two bit sets, and stores the result in the first on…
Performs an intersection of two bit sets, and stores the result in the first one. Bits in the result are set if the corresponding bits were set in both inputs.
fn setRangeValue(self: *Self, range: Range, value: bool) void
Changes the value of all bits in the specified range to match the passed boolea…
Changes the value of all bits in the specified range to match the passed boolean.
fn setUnion(self: *Self, other: Self) void
Performs a union of two bit sets, and stores the result in the first one. Bits…
Performs a union of two bit sets, and stores the result in the first one. Bits in the result are set if the corresponding bits were set in either input.
fn setValue(self: *Self, index: usize, value: bool) void
Changes the value of the specified bit of the bit set to match the passed boole…
Changes the value of the specified bit of the bit set to match the passed boolean.
fn subsetOf(self: Self, other: Self) bool
Returns true iff the first bit set is the subset of the second one.
fn supersetOf(self: Self, other: Self) bool
Returns true iff the first bit set is the superset of the second one.
fn toggleFirstSet(self: *Self) ?usize
Finds the index of the first set bit, and unsets it. If no bits are set, return…
Finds the index of the first set bit, and unsets it. If no bits are set, returns null.
fn toggleSet(self: *Self, toggles: Self) void
Flips all bits in this bit set which are present in the toggles bit set.
Values
MaskInt | undefined | The integer type used to represent a mask in this bit set |
ShiftInt | undefined | The integer type used to shift a mask in this bit set |
bit_length | usize | The number of items in this bit set |