![]() |
Pixie
|
Interleaved, owning bit vector with rank and select. More...
#include <bitvector.h>
Public Member Functions | |
| BitVectorInterleaved (std::span< const uint64_t > bit_vector, size_t num_bits) | |
| Construct from an external array of 64-bit words. | |
| size_t | size () const |
| Returns the number of valid bits. | |
| int | operator[] (size_t pos) const |
| Returns the bit at the given position. | |
| void | build_rank_interleaved (std::span< const uint64_t > bits, size_t num_bits) |
| Build the interleaved layout and rank index. | |
| uint64_t | rank (size_t pos) const |
| Rank of 1s up to position pos (exclusive). | |
| std::string | to_string () const |
| Convert to a binary string (debug helper). | |
Static Public Member Functions | |
| static uint64_t | first_bits_mask (size_t num) |
| Mask with the lowest num bits set. | |
Interleaved, owning bit vector with rank and select.
This variant interleaves data with local rank metadata to reduce cache misses for rank queries. It copies input bits into an interleaved layout.
Based on: "SPIDER: Improved Succinct Rank and Select Performance" Matthew D. Laws, Jocelyn Bliven, Kit Conklin, Elyes Laalai, Samuel McCauley, Zach S. Sturdevant
|
inlineexplicit |
Construct from an external array of 64-bit words.
| bit_vector | Backing data to copy and interleave. |
| num_bits | Number of valid bits in the vector. |
|
inline |
Build the interleaved layout and rank index.
| bits | Source bit vector as 64-bit words. |
| num_bits | Number of valid bits in the source. |
|
inline |
Returns the bit at the given position.
| pos | Bit index in [0, size()). |
|
inline |
Rank of 1s up to position pos (exclusive).
| pos | Bit index in [0, size()]. |
Ok, so here's quite the important factor to load 512-bit region at &bits_interleaved[b_block_pos], we store local rank as 16 last bits of it. Prefetch should guarantee but seems like there is no need for it.