pasta_bit_vector
1.0.1
Bit Vector with Compact and Fast Rank and Select Support
|
Check that L12Type requires only 64 bits. More...
#include <l12_type.hpp>
Public Member Functions | |
BigL12Type ()=default | |
Constructor. Empty constructor required for tlx::SimpleVector . | |
BigL12Type (uint64_t const _l1, std::array< uint16_t, 7 > &_l2) | |
Constructor. Setting all values and packing the L2-block entries. | |
uint64_t | operator[] (size_t const index) const |
Access operator used to access the L2-block entries individually. | |
uint64_t | l1 () const |
Get the L1-value of the L12-block. | |
Public Attributes | |
__uint128_t | data |
All data of the BigL12Type packed into 128 bits. | |
Check that L12Type requires only 64 bits.
Struct used to store L1- and L2-blocks for BitVectorFlatRank
and BitVectorFlatRankSelect
.
We store the L1-information of 8 L2-blocks in 40 bits and the corresponding seven L2-information in 12 bits each. Using 12 bits allows us to store the prefix sum of the popcounts in the 512-bit L2-blocks. All this can be stored in 128 bits. To be precise 124 bits would suffice, but the additional 4 bits allow for faster access and result in exactly the same overhead the non-flat popcount rank and select data structure has.
+---—+---—+---—+---—+---—+---—+—+---—+---—+-----—+ | 8bit | 8bit | 8bit | 8bit | 8bit | 8bit |...| 8bit | 8bit | 40 bit | +---—+---—+---—+---—+---—+---—+—+---—+---—+-----—+ | 3 * 12-bit integer | 3 * 12 bit integer |...| 12 bit int. | L1-info| +---—+---—+---—+---—+---—+---—+—+---—+---—+-----—+ | 8 | 4/4 | 8 | 8 | 4/4 | 8 |...| 8 | 4/4 + 40 Bit | +---—+---—+---—+---—+---—+---—+—+---—+---—+-----—+
The order of the 12-bit integers should remain the same (as they occur in the bit vector). This helps us to determine the correct block later on. To this end, we have to split
|
inline |
Constructor. Setting all values and packing the L2-block entries.
_l1 | Value of the L1-block entry. |
_l2 | Values of the three L2-block entries ( asstd::array ). |
|
inline |
Get the L1-value of the L12-block.
|
inline |
Access operator used to access the L2-block entries individually.
index | The index (0 to 6) of the L2-block. |