Skip to main content

Module bitset

Module bitset 

Source
Expand description

BitSet (§6.1).

A compact set of non-negative integers, backed by a ReprCVec<u64> of words. Occupancy is bit i of word i / 64. Nullary in user syntax (BitSet, no type arg); elements are always Int. Iterable (yields Int).

BitSet is its own GC payload: the words are a Drop vector, so the descriptor’s drop_value releases them on sweep. Equality/hash are structural (two bitsets are equal iff they hold the same bits).

The container is a ReprCVec and not a std::Vec because generated code reads its two leading words inline for bs.contains(x) (ADR-118 part 2); INLINE_BITSET_SITE is the one value that says where they are.

Structs§

BitIndex
A value a BitSet can actually hold: non-negative, and small enough that the word vector backing it stays a real allocation.
BitSetPayload
The BitSet payload: a growable vector of 64-bit words. Bit i is in word i / 64 at position i % 64. The field is Drop.

Constants§

INLINE_BITSET_SITE
The one site generated code may read a BitSet’s words through (ADR-118 part 2), minted beside the payload for INLINE_VEC_SITE’s reason.

Statics§

BITSET
Descriptor for BitSet (§6.1, TypeId 15). Equatable and hashable (structural over the set of bits), so a BitSet can be a value in another collection.