Skip to main content

Module bit_set

Module bit_set 

Source
Expand description

A semi-dynamic bit mask data structure the size of which is fixed at construction.

Supports very efficient “is empty” check, get, and set operations. A BitSet allocates all of its storage up front. The storage is chunked into 64 bit words, which means allocated capacity can be greater than the value of bit_count the BitSet was constructed with. For simplicity, we allow the entire capacity to be used (with set and get). As a consequence, the actual value of bit_count the BitSet was constructed with is not recoverable after construction.

§Implementation

Storage is inline for <=64 bits, which makes access and cloning very cheap for the overwhelmingly common case. Internally we use a set_count to make is_empty very fast independent of whether or not storage is inline.

Structs§

BitSet