NCBI C++ ToolKit
|
Bit manipulation primitives (internal) More...
Go to the source code of this file.
Go to the SVN repository for this file.
Classes | |
struct | bm::bv_statistics |
Structure with statistical information about memory allocation footprint, serialization projection, number of vectors. More... | |
struct | bm::bv_arena_statistics |
Structure with statistical information about memory allocation for arena based vectors. More... | |
struct | bm::pair< First, Second > |
Pair type. More... | |
struct | bm::bit_decode_cache |
bit-decode cache structure More... | |
class | bm::copy_to_array_functor< B > |
Adaptor to copy 1 bits to array. More... | |
struct | bm::all_set< T > |
Structure carries pointer on bit block with all bits 1. More... | |
struct | bm::all_set< T >::all_set_block |
struct | bm::d_copy_func< T > |
d-Gap copy functor More... | |
class | bm::bitblock_get_adapter |
Bit-block get adapter, takes bitblock and represents it as a get_32() accessor function. More... | |
class | bm::bitblock_store_adapter |
Bit-block store adapter, takes bitblock and saves results into it. More... | |
class | bm::bitblock_sum_adapter |
Bit-block sum adapter, takes values and sums it /internal. More... | |
class | bm::decoder_range_adapter< DEC > |
Adapter to get words from a range stream (see range serialized bit-block) More... | |
struct | bm::bit_AND< W > |
Bit AND functor. More... | |
struct | bm::bit_OR< W > |
Bit OR functor. More... | |
struct | bm::bit_SUB< W > |
Bit SUB functor. More... | |
struct | bm::bit_XOR< W > |
Bit XOR functor. More... | |
struct | bm::bit_ASSIGN< W > |
Bit ASSIGN functor. More... | |
struct | bm::bit_COUNT< W > |
Bit COUNT functor. More... | |
struct | bm::bit_COUNT_AND< W > |
Bit COUNT AND functor. More... | |
struct | bm::bit_COUNT_XOR< W > |
Bit COUNT XOR functor. More... | |
struct | bm::bit_COUNT_OR< W > |
Bit COUNT OR functor. More... | |
struct | bm::bit_COUNT_SUB_AB< W > |
Bit COUNT SUB AB functor. More... | |
struct | bm::bit_COUNT_SUB_BA< W > |
Bit SUB BA functor. More... | |
struct | bm::bit_COUNT_A< W > |
Bit COUNT A functor. More... | |
struct | bm::bit_COUNT_B< W > |
Bit COUNT B functor. More... | |
struct | bm::operation_functions< T > |
union | bm::ptr_payload_t |
helper union to interpret pointer as integers More... | |
Namespaces | |
bm | |
#include<zmmintrin.h> | |
Typedefs | |
typedef void(* | bm::gap_operation_to_bitset_func_type) (unsigned *, const gap_word_t *) |
typedef gap_word_t *(* | bm::gap_operation_func_type) (const gap_word_t *, const gap_word_t *, gap_word_t *, unsigned &) |
typedef bm::id_t(* | bm::bit_operation_count_func_type) (const bm::word_t *, const bm::word_t *) |
Enumerations | |
enum | bm::bit_representation { bm::e_bit_GAP = 0 , bm::e_bit_INT , bm::e_bit_IINT , bm::e_bit_1 , bm::e_bit_0 , bm::e_bit_bit , bm::e_bit_end } |
Possible representations for bit sets. More... | |
Functions | |
template<bool LWA = false, bool RWA = false> | |
bm::id_t | bm::bit_block_calc_count_range (const bm::word_t *block, bm::word_t left, bm::word_t right) noexcept |
bm::id_t | bm::bit_block_any_range (const bm::word_t *block, bm::word_t left, bm::word_t right) noexcept |
template<typename BI_TYPE > | |
void | bm::get_block_coord (BI_TYPE nb, unsigned &i, unsigned &j) noexcept |
Recalc linear bvector block index into 2D matrix coordinates. More... | |
template<typename RTYPE > | |
RTYPE | bm::get_super_block_start (unsigned i) noexcept |
Compute bit address of the first bit in a superblock. More... | |
template<typename RTYPE > | |
RTYPE | bm::get_block_start (unsigned i, unsigned j) noexcept |
Compute bit address of the first bit in a block. More... | |
int | bm::parallel_popcnt_32 (unsigned int n) noexcept |
32-bit paralle, bitcount More... | |
unsigned | bm::bitcount64_4way (bm::id64_t x, bm::id64_t y, bm::id64_t u, bm::id64_t v) noexcept |
template<typename T , typename F > | |
void | bm::bit_for_each_4 (T w, F &func) |
Templated algorithm to unpacks octet based word into list of ON bit indexes. More... | |
template<typename T , typename F > | |
void | bm::bit_for_each (T w, F &func) |
Templated algorithm to unpacks word into list of ON bit indexes. More... | |
unsigned | bm::bitscan_nibble (unsigned w, unsigned *bits) noexcept |
portable, switch based bitscan More... | |
template<typename T , typename B > | |
unsigned | bm::bit_list (T w, B *bits) noexcept |
Unpacks word into list of ON bit indexes. More... | |
template<typename T , typename B > | |
unsigned | bm::bit_list_4 (T w, B *bits) noexcept |
Unpacks word into list of ON bit indexes (quad-bit based) More... | |
template<typename B > | |
unsigned short | bm::bitscan_popcnt (bm::id_t w, B *bits, unsigned short offs) noexcept |
Unpacks word into list of ON bit indexes using popcnt method. More... | |
template<typename B > | |
unsigned short | bm::bitscan_popcnt (bm::id_t w, B *bits) noexcept |
Unpacks word into list of ON bit indexes using popcnt method. More... | |
template<typename B > | |
unsigned short | bm::bitscan_popcnt64 (bm::id64_t w, B *bits) noexcept |
Unpacks 64-bit word into list of ON bit indexes using popcnt method. More... | |
template<typename B > | |
unsigned short | bm::bitscan_bsf (unsigned w, B *bits) noexcept |
Unpacks word into list of ON bits (BSF/__builtin_ctz) More... | |
template<typename B , typename OT > | |
unsigned short | bm::bitscan_bsf (unsigned w, B *bits, OT offs) noexcept |
template<typename B > | |
unsigned short | bm::bitscan_bsf64 (bm::id64_t w, B *bits) noexcept |
Unpacks word into list of ON bits (BSF/__builtin_ctz) More... | |
template<typename B > | |
unsigned short | bm::bitscan_popcnt64 (bm::id64_t w, B *bits, unsigned short offs) noexcept |
Unpacks 64-bit word into list of ON bit indexes using popcnt method. More... | |
template<typename V , typename B > | |
unsigned short | bm::bitscan (V w, B *bits) noexcept |
Templated Bitscan with dynamic dispatch for best type. More... | |
unsigned | bm::word_select64_linear (bm::id64_t w, unsigned rank) noexcept |
word find index of the rank-th bit set by bit-testing More... | |
unsigned | bm::word_select64_bitscan_popcnt (bm::id64_t w, unsigned rank) noexcept |
word find index of the rank-th bit set by bit-testing More... | |
unsigned | bm::word_select64_bitscan_tz (bm::id64_t w, unsigned rank) noexcept |
word find index of the rank-th bit set by bit-testing More... | |
unsigned | bm::word_select32_bitscan_popcnt (unsigned w, unsigned rank) noexcept |
word find index of the rank-th bit set by bit-testing More... | |
unsigned | bm::word_select32_bitscan_tz (unsigned w, unsigned rank) noexcept |
word find index of the rank-th bit set by bit-testing More... | |
unsigned | bm::word_select64 (bm::id64_t w, unsigned rank) noexcept |
word find index of the rank-th bit set by bit-testing More... | |
unsigned | bm::word_select32 (unsigned w, unsigned rank) noexcept |
word find index of the rank-th bit set by bit-testing More... | |
bm::id64_t | bm::widx_to_digest_mask (unsigned w_idx) noexcept |
Compute digest mask for word address in block. More... | |
bm::id64_t | bm::dm_control (unsigned from, unsigned to) noexcept |
digest mask control generation (for debug and test only) More... | |
bm::id64_t | bm::digest_mask (unsigned from, unsigned to) noexcept |
Compute digest mask for [from..to] positions. More... | |
bool | bm::check_zero_digest (bm::id64_t digest, unsigned bitpos_from, unsigned bitpos_to) noexcept |
check if all digest bits for the range [from..to] are 0 More... | |
bool | bm::is_digest_one_range (bm::id64_t digest) noexcept |
Is one range of 1s ( 0000110000 - one range, 000011000010 - more than one) More... | |
void | bm::block_init_digest0 (bm::word_t *const block, bm::id64_t digest) noexcept |
Init block with 000111000 pattren based on digest. More... | |
bm::id64_t | bm::calc_block_digest0 (const bm::word_t *const block) noexcept |
Compute digest for 64 non-zero areas. More... | |
bm::id64_t | bm::update_block_digest0 (const bm::word_t *const block, bm::id64_t digest) noexcept |
Compute digest for 64 non-zero areas based on existing digest (function revalidates zero areas) More... | |
void | bm::block_compact_by_digest (bm::word_t *t_block, const bm::word_t *block, bm::id64_t digest, bool zero_tail) noexcept |
Compact sub-blocks by digest (rank compaction) More... | |
void | bm::block_expand_by_digest (bm::word_t *t_block, const bm::word_t *block, bm::id64_t digest, bool zero_subs) noexcept |
expand sub-blocks by digest (rank expansion) More... | |
bool | bm::is_const_set_operation (set_operation op) noexcept |
Returns true if set operation is constant (bitcount) More... | |
bm::operation | bm::setop2op (bm::set_operation op) noexcept |
Convert set operation to operation. More... | |
template<typename N > | |
bool | bm::find_not_null_ptr (const bm::word_t *const *const *arr, N start, N size, N *pos) noexcept |
template<typename T > | |
int | bm::wordcmp0 (T w1, T w2) noexcept |
Lexicographical comparison of two words as bit strings (reference) Auxiliary implementation for testing and reference purposes. More... | |
template<typename T > | |
int | bm::wordcmp (T a, T b) noexcept |
Lexicographical comparison of two words as bit strings. Auxiliary implementation for testing and reference purposes. More... | |
bool | bm::bit_is_all_zero (const bm::word_t *start) noexcept |
Returns "true" if all bits in the block are 0. More... | |
bool | bm::gap_is_all_zero (const bm::gap_word_t *buf) noexcept |
Checks if GAP block is all-zero. More... | |
bool | bm::gap_is_all_one (const bm::gap_word_t *buf) noexcept |
Checks if GAP block is all-one. More... | |
bm::gap_word_t | bm::gap_length (const bm::gap_word_t *buf) noexcept |
Returs GAP block length. More... | |
template<typename T > | |
unsigned | bm::gap_capacity (const T *buf, const T *glevel_len) noexcept |
Returs GAP block capacity. More... | |
template<typename T > | |
unsigned | bm::gap_limit (const T *buf, const T *glevel_len) noexcept |
Returs GAP block capacity limit. More... | |
template<typename T > | |
T | bm::gap_level (const T *buf) noexcept |
Returs GAP blocks capacity level. More... | |
template<typename T > | |
unsigned | bm::gap_find_last (const T *buf, unsigned *last) noexcept |
GAP block find the last set bit. More... | |
template<typename T > | |
unsigned | bm::gap_find_first (const T *buf, unsigned *first) noexcept |
GAP block find the first set bit. More... | |
template<typename T > | |
unsigned | bm::gap_bfind (const T *buf, unsigned pos, unsigned *is_set) noexcept |
template<typename T > | |
unsigned | bm::gap_test (const T *buf, unsigned pos) noexcept |
Tests if bit = pos is true. More... | |
template<typename T > | |
unsigned | bm::gap_test_unr (const T *buf, const unsigned pos) noexcept |
Tests if bit = pos is true. Analog of bm::gap_test with SIMD unrolling. More... | |
template<typename T , typename N , typename F > | |
void | bm::for_each_nzblock_range (T ***root, N top_size, N nb_from, N nb_to, F &f) noexcept |
template<class T , class F > | |
void | bm::for_each_nzblock (T ***root, unsigned size1, F &f) |
template<class T , class F > | |
void | bm::for_each_nzblock2 (T ***root, unsigned size1, F &f) |
template<typename T , typename BI , typename F > | |
bool | bm::for_each_nzblock_if (T ***root, BI size1, F &f) noexcept |
template<class T , class F , typename BLOCK_IDX > | |
void | bm::for_each_block (T ***root, unsigned size1, F &f, BLOCK_IDX start) |
template<class T , class F > | |
F | bm::bmfor_each (T first, T last, F f) |
template<typename T > | |
bm::id64_t | bm::sum_arr (const T *first, const T *last) noexcept |
template<typename T > | |
void | bm::gap_split (const T *buf, T *arr0, T *arr1, T &arr0_cnt, T &arr1_cnt) noexcept |
template<typename T > | |
unsigned | bm::gap_bit_count (const T *buf, unsigned dsize=0) noexcept |
Calculates number of bits ON in GAP buffer. More... | |
template<typename T > | |
unsigned | bm::gap_bit_count_unr (const T *buf) noexcept |
Calculates number of bits ON in GAP buffer. Loop unrolled version. More... | |
template<typename T , bool RIGHT_END = false> | |
unsigned | bm::gap_bit_count_range (const T *const buf, unsigned left, unsigned right) noexcept |
Counts 1 bits in GAP buffer in the closed [left, right] range. More... | |
template<typename T > | |
unsigned | bm::gap_bit_count_range_hint (const T *const buf, unsigned left, unsigned right, unsigned hint) noexcept |
Counts 1 bits in GAP buffer in the closed [left, right] range using position hint to avoid bfind. More... | |
template<typename T > | |
bool | bm::gap_is_all_one_range (const T *const buf, unsigned left, unsigned right) noexcept |
Test if all bits are 1 in GAP buffer in the [left, right] range. More... | |
template<typename T > | |
bool | bm::gap_any_range (const T *const buf, unsigned left, unsigned right) noexcept |
Test if any bits are 1 in GAP buffer in the [left, right] range. More... | |
template<typename T > | |
bool | bm::gap_is_interval (const T *const buf, unsigned left, unsigned right) noexcept |
Test if any bits are 1 in GAP buffer in the [left, right] range and flanked with 0s. More... | |
template<typename T > | |
bool | bm::gap_find_interval_end (const T *const buf, unsigned nbit, unsigned *pos) noexcept |
Searches for the last 1 bit in the 111 interval of a GAP block. More... | |
template<typename T > | |
bool | bm::gap_find_interval_start (const T *const buf, unsigned nbit, unsigned *pos) noexcept |
Searches for the first 1 bit in the 111 interval of a GAP block. More... | |
template<typename T > | |
bool | bm::gap_find_prev (const T *const buf, unsigned nbit, unsigned *pos) noexcept |
reverse search for the first 1 bit of a GAP block More... | |
template<typename T , typename SIZE_TYPE > | |
SIZE_TYPE | bm::gap_find_rank (const T *const block, SIZE_TYPE rank, unsigned nbit_from, unsigned &nbit_pos) noexcept |
GAP block find position for the rank. More... | |
template<typename T , bool TCORRECT = false> | |
unsigned | bm::gap_bit_count_to (const T *const buf, T right) noexcept |
template<class T , class Func > | |
void | bm::for_each_dgap (const T *gap_buf, Func &func) |
template<typename T > | |
T * | bm::gap_2_dgap (const T *gap_buf, T *dgap_buf, bool copy_head=true) noexcept |
Convert GAP buffer into D-GAP buffer. More... | |
template<typename T > | |
void | bm::dgap_2_gap (const T *dgap_buf, T *gap_buf, T gap_header=0) noexcept |
Convert D-GAP buffer into GAP buffer. More... | |
template<typename T > | |
int | bm::gapcmp (const T *buf1, const T *buf2) noexcept |
Lexicographical comparison of GAP buffers. More... | |
template<typename T > | |
bool | bm::gap_find_first_diff (const T *buf1, const T *buf2, unsigned *pos) noexcept |
Find first bit which is different between two GAP-blocks. More... | |
template<typename T , class F > | |
void | bm::gap_buff_op (T *dest, const T *vect1, unsigned vect1_mask, const T *vect2, unsigned vect2_mask, unsigned &dlen) |
Abstract operation for GAP buffers. Receives functor F as a template argument. More... | |
template<typename T , class F > | |
unsigned | bm::gap_buff_any_op (const T *vect1, unsigned vect1_mask, const T *vect2, unsigned vect2_mask) |
Abstract distance test operation for GAP buffers. Receives functor F as a template argument. More... | |
template<typename T , class F > | |
unsigned | bm::gap_buff_count_op (const T *vect1, const T *vect2) |
Abstract distance(similarity) operation for GAP buffers. Receives functor F as a template argument. More... | |
template<typename T > | |
unsigned | bm::gap_set_value_cpos (unsigned val, T *buf, unsigned pos, unsigned *is_set, unsigned curr) noexcept |
Sets or clears bit in the GAP buffer. More... | |
template<typename T > | |
unsigned | bm::gap_set_value (unsigned val, T *buf, unsigned pos, unsigned *is_set) noexcept |
Sets or clears bit in the GAP buffer. More... | |
template<typename T > | |
unsigned | bm::gap_set_value (unsigned val, T *buf, unsigned pos) noexcept |
Sets or clears bit in the GAP buffer. More... | |
template<typename T > | |
unsigned | bm::gap_add_value (T *buf, unsigned pos) noexcept |
Add new value to the end of GAP buffer. More... | |
template<typename T > | |
bool | bm::gap_shift_r1 (T *buf, unsigned co_flag, unsigned *new_len) noexcept |
Right shift GAP block by 1 bit. More... | |
template<typename T > | |
bool | bm::gap_insert (T *buf, unsigned pos, unsigned val, unsigned *new_len) noexcept |
isnert bit into GAP compressed block More... | |
template<typename T > | |
bool | bm::gap_shift_l1 (T *buf, unsigned co_flag, unsigned *new_len) noexcept |
Left shift GAP block by 1 bit. More... | |
template<typename T > | |
unsigned | bm::gap_set_array (T *buf, const T *arr, unsigned len) noexcept |
Convert array to GAP buffer. More... | |
template<typename T > | |
unsigned | bm::bit_array_compute_gaps (const T *arr, unsigned len) noexcept |
Compute number of GAPs in bit-array. More... | |
template<typename T > | |
unsigned | bm::gap_block_find (const T *buf, unsigned nbit, bm::id_t *prev) noexcept |
Searches for the next 1 bit in the GAP block. More... | |
void | bm::set_bit (unsigned *dest, unsigned bitpos) noexcept |
Set 1 bit in a block. More... | |
void | bm::clear_bit (unsigned *dest, unsigned bitpos) noexcept |
Set 1 bit in a block. More... | |
unsigned | bm::test_bit (const unsigned *block, unsigned bitpos) noexcept |
Test 1 bit in a block. More... | |
void | bm::or_bit_block (unsigned *dest, unsigned bitpos, unsigned bitcount) noexcept |
Sets bits to 1 in the bitblock. More... | |
void | bm::sub_bit_block (unsigned *dest, unsigned bitpos, unsigned bitcount) noexcept |
SUB (AND NOT) bit interval to 1 in the bitblock. More... | |
void | bm::xor_bit_block (unsigned *dest, unsigned bitpos, unsigned bitcount) noexcept |
XOR bit interval to 1 in the bitblock. More... | |
template<typename T > | |
void | bm::gap_sub_to_bitset (unsigned *dest, const T *pcurr) noexcept |
SUB (AND NOT) GAP block to bitblock. More... | |
template<typename T > | |
bm::id64_t | bm::gap_sub_to_bitset (unsigned *dest, const T *pcurr, bm::id64_t digest0) noexcept |
SUB (AND NOT) GAP block to bitblock with digest assist. More... | |
template<typename T > | |
void | bm::gap_xor_to_bitset (unsigned *dest, const T *pcurr) noexcept |
XOR GAP block to bitblock. More... | |
template<typename T > | |
void | bm::gap_add_to_bitset (unsigned *dest, const T *pcurr, unsigned len) noexcept |
Adds(OR) GAP block to bitblock. More... | |
template<typename T > | |
void | bm::gap_add_to_bitset (unsigned *dest, const T *pcurr) noexcept |
Adds(OR) GAP block to bitblock. More... | |
template<typename T > | |
void | bm::gap_and_to_bitset (unsigned *dest, const T *pcurr) noexcept |
ANDs GAP block to bitblock. More... | |
template<typename T > | |
bm::id64_t | bm::gap_and_to_bitset (unsigned *dest, const T *pcurr, bm::id64_t digest0) noexcept |
ANDs GAP block to bitblock with digest assist. More... | |
template<typename T > | |
bm::id_t | bm::gap_bitset_and_count (const unsigned *block, const T *pcurr) noexcept |
Compute bitcount of bit block AND masked by GAP block. More... | |
template<typename T > | |
bm::id_t | bm::gap_bitset_and_any (const unsigned *block, const T *pcurr) noexcept |
Bitcount test of bit block AND masked by GAP block. More... | |
template<typename T > | |
bm::id_t | bm::gap_bitset_sub_count (const unsigned *block, const T *buf) noexcept |
Compute bitcount of bit block SUB masked by GAP block. More... | |
template<typename T > | |
bm::id_t | bm::gap_bitset_sub_any (const unsigned *block, const T *buf) noexcept |
Compute bitcount test of bit block SUB masked by GAP block. More... | |
template<typename T > | |
bm::id_t | bm::gap_bitset_xor_count (const unsigned *block, const T *buf) noexcept |
Compute bitcount of bit block XOR masked by GAP block. More... | |
template<typename T > | |
bm::id_t | bm::gap_bitset_xor_any (const unsigned *block, const T *buf) noexcept |
Compute bitcount test of bit block XOR masked by GAP block. More... | |
template<typename T > | |
bm::id_t | bm::gap_bitset_or_count (const unsigned *block, const T *buf) noexcept |
Compute bitcount of bit block OR masked by GAP block. More... | |
template<typename T > | |
bm::id_t | bm::gap_bitset_or_any (const unsigned *block, const T *buf) noexcept |
Compute bitcount test of bit block OR masked by GAP block. More... | |
void | bm::bit_block_set (bm::word_t *dst, bm::word_t value) noexcept |
Bitblock memset operation. More... | |
template<typename T > | |
void | bm::gap_convert_to_bitset (unsigned *dest, const T *buf, unsigned len=0) noexcept |
GAP block to bitblock conversion. More... | |
template<typename T > | |
unsigned * | bm::gap_convert_to_bitset_smart (unsigned *dest, const T *buf, id_t set_max) noexcept |
Smart GAP block to bitblock conversion. More... | |
template<typename T > | |
unsigned | bm::gap_control_sum (const T *buf) noexcept |
Calculates sum of all words in GAP block. (For debugging purposes) More... | |
template<class T > | |
void | bm::gap_set_all (T *buf, unsigned set_max, unsigned value) noexcept |
Sets all bits to 0 or 1 (GAP) More... | |
template<class T > | |
void | bm::gap_init_range_block (T *buf, T from, T to, T value) noexcept |
Init gap block so it has block in it (can be whole block) More... | |
template<typename T > | |
void | bm::gap_invert (T *buf) noexcept |
Inverts all bits in the GAP buffer. More... | |
template<typename T > | |
void | bm::set_gap_level (T *buf, int level) noexcept |
Sets GAP block capacity level. More... | |
template<typename T > | |
int | bm::gap_calc_level (unsigned len, const T *glevel_len) noexcept |
Calculates GAP block capacity level. More... | |
template<typename T > | |
unsigned | bm::gap_free_elements (const T *buf, const T *glevel_len) noexcept |
Returns number of free elements in GAP block array. Difference between GAP block capacity on this level and actual GAP length. More... | |
template<typename T > | |
int | bm::bitcmp (const T *buf1, const T *buf2, unsigned len) noexcept |
Lexicographical comparison of BIT buffers. More... | |
bool | bm::bit_find_first_diff (const bm::word_t *blk1, const bm::word_t *blk2, unsigned *pos) noexcept |
Find first bit which is different between two bit-blocks. More... | |
unsigned | bm::bit_block_to_gap (gap_word_t *dest, const unsigned *block, unsigned dest_len) noexcept |
Converts bit block to GAP. More... | |
unsigned | bm::bit_to_gap (gap_word_t *dest, const unsigned *block, unsigned dest_len) noexcept |
Convert bit block to GAP representation. More... | |
template<class T , class F > | |
void | bm::for_each_gap_dbit (const T *buf, F &func) |
Iterate gap block as delta-bits with a functor. More... | |
template<typename D , typename T > | |
D | bm::gap_convert_to_arr (D *dest, const T *buf, unsigned dest_len, bool invert=false) noexcept |
Convert gap block into array of ints corresponding to 1 bits. More... | |
unsigned | bm::bit_count_min_unroll (const bm::word_t *block, const bm::word_t *block_end) noexcept |
Bitcount for bit block without agressive unrolling. More... | |
bm::id_t | bm::bit_block_count (const bm::word_t *block) noexcept |
Bitcount for bit block. More... | |
bm::id_t | bm::bit_block_count (const bm::word_t *const block, bm::id64_t digest) noexcept |
Bitcount for bit block. More... | |
bm::id_t | bm::bit_count_change (bm::word_t w) noexcept |
unsigned | bm::bit_block_change32 (const bm::word_t *block, unsigned size) noexcept |
unsigned | bm::bit_block_change64 (const bm::word_t *in_block, unsigned size) noexcept |
void | bm::bit_block_change_bc (const bm::word_t *block, unsigned *gc, unsigned *bc) noexcept |
unsigned | bm::bit_block_calc_change (const bm::word_t *block) noexcept |
bool | bm::bit_block_is_all_one_range (const bm::word_t *const block, bm::word_t left, bm::word_t right) noexcept |
bm::id_t | bm::bit_block_calc_count_to (const bm::word_t *block, bm::word_t right) noexcept |
void | bm::bit_block_rotate_left_1 (bm::word_t *block) noexcept |
void | bm::bit_block_rotate_left_1_unr (bm::word_t *block) noexcept |
Unrolled cyclic rotation of bit-block left by 1 bit. More... | |
bm::word_t | bm::bit_block_insert (bm::word_t *block, unsigned bitpos, bool value) noexcept |
insert bit into position and shift the rest right with carryover More... | |
bool | bm::bit_block_shift_r1 (bm::word_t *block, bm::word_t *empty_acc, bm::word_t co_flag) noexcept |
Right bit-shift bitblock by 1 bit (reference) More... | |
bool | bm::bit_block_shift_r1_unr_min (bm::word_t *block, bm::word_t *empty_acc, bm::id64_t co_flag) noexcept |
Right bit-shift bitblock by 1 bit (minimum unroll) More... | |
bool | bm::bit_block_shift_r1_unr (bm::word_t *block, bm::word_t *empty_acc, bm::word_t co_flag) noexcept |
Right bit-shift of bit-block by 1 bit (loop unrolled) More... | |
bool | bm::bit_block_shift_l1 (bm::word_t *block, bm::word_t *empty_acc, bm::word_t co_flag) noexcept |
Left bit-shift bitblock by 1 bit (reference) More... | |
bool | bm::bit_block_shift_l1_unr_min (bm::word_t *block, bm::word_t *empty_acc, unsigned co_flag) noexcept |
Left bit-shift bitblock by 1 bit (minimum unroll) More... | |
bool | bm::bit_block_shift_l1_unr (bm::word_t *block, bm::word_t *empty_acc, bm::word_t co_flag) noexcept |
Left bit-shift of bit-block by 1 bit (loop unrolled) More... | |
void | bm::bit_block_erase (bm::word_t *block, unsigned bitpos, bool carry_over) noexcept |
erase bit from position and shift the rest right with carryover More... | |
bool | bm::bit_block_shift_r1_and (bm::word_t *block, bm::word_t co_flag, const bm::word_t *mask_block, bm::id64_t *digest) noexcept |
Right bit-shift of bit-block by 1 bit (reference) + AND. More... | |
bool | bm::bit_block_shift_r1_and_unr (bm::word_t *block, bm::word_t co_flag, const bm::word_t *mask_block, bm::id64_t *digest) noexcept |
Right bit-shift bitblock by 1 bit (reference) + AND. More... | |
template<typename T > | |
void | bm::bit_invert (T *start) noexcept |
bool | bm::is_bits_one (const bm::wordop_t *start) noexcept |
Returns "true" if all bits in the block are 1. More... | |
bool | bm::block_is_all_one_range (const bm::word_t *const block, unsigned left, unsigned right) noexcept |
Returns "true" if all bits are 1 in the block [left, right] Function check for block varieties. More... | |
bool | bm::block_is_interval (const bm::word_t *const block, unsigned left, unsigned right) noexcept |
Returns "true" if all bits are 1 in the block [left, right] and border bits are 0. More... | |
bool | bm::bit_block_find_interval_end (const bm::word_t *block, unsigned nbit, unsigned *pos) noexcept |
Searches for the last 1 bit in the 111 interval of a BIT block. More... | |
unsigned | bm::block_find_interval_end (const bm::word_t *block, unsigned nbit_from, unsigned *found_nbit) noexcept |
Find end of the current 111 interval. More... | |
bool | bm::bit_block_find_interval_start (const bm::word_t *block, unsigned nbit, unsigned *pos) noexcept |
Searches for the first 1 bit in the 111 interval of a BIT block. More... | |
bool | bm::bit_block_find_prev (const bm::word_t *block, unsigned nbit, unsigned *pos) noexcept |
Reverse search for the previous 1 bit. More... | |
unsigned | bm::block_find_interval_start (const bm::word_t *block, unsigned nbit_from, unsigned *found_nbit) noexcept |
Find start of the current 111 interval. More... | |
bool | bm::block_find_reverse (const bm::word_t *block, unsigned nbit_from, unsigned *found_nbit) noexcept |
Reverse find 1. More... | |
bool | bm::block_any_range (const bm::word_t *const block, unsigned left, unsigned right) noexcept |
Returns "true" if one bit is set in the block [left, right] Function check for block varieties. More... | |
bool | bm::block_any (const bm::word_t *const block) noexcept |
Returns "true" if one bit is set in the block Function check for block varieties. More... | |
gap_word_t * | bm::gap_operation_and (const gap_word_t *vect1, const gap_word_t *vect2, gap_word_t *tmp_buf, unsigned &dsize) noexcept |
GAP AND operation. More... | |
unsigned | bm::gap_operation_any_and (const gap_word_t *vect1, const gap_word_t *vect2) noexcept |
GAP AND operation test. More... | |
unsigned | bm::gap_count_and (const gap_word_t *vect1, const gap_word_t *vect2) noexcept |
GAP bitcount AND operation test. More... | |
gap_word_t * | bm::gap_operation_xor (const gap_word_t *vect1, const gap_word_t *vect2, gap_word_t *tmp_buf, unsigned &dsize) noexcept |
GAP XOR operation. More... | |
unsigned | bm::gap_operation_any_xor (const gap_word_t *vect1, const gap_word_t *vect2) noexcept |
GAP XOR operation test. More... | |
unsigned | bm::gap_count_xor (const gap_word_t *vect1, const gap_word_t *vect2) noexcept |
GAP bitcount XOR operation test. More... | |
gap_word_t * | bm::gap_operation_or (const gap_word_t *vect1, const gap_word_t *vect2, gap_word_t *tmp_buf, unsigned &dsize) noexcept |
GAP OR operation. More... | |
unsigned | bm::gap_count_or (const gap_word_t *vect1, const gap_word_t *vect2) noexcept |
GAP bitcount OR operation test. More... | |
gap_word_t * | bm::gap_operation_sub (const gap_word_t *vect1, const gap_word_t *vect2, gap_word_t *tmp_buf, unsigned &dsize) noexcept |
GAP SUB (AND NOT) operation. More... | |
unsigned | bm::gap_operation_any_sub (const gap_word_t *vect1, const gap_word_t *vect2) noexcept |
GAP SUB operation test. More... | |
unsigned | bm::gap_count_sub (const gap_word_t *vect1, const gap_word_t *vect2) noexcept |
GAP bitcount SUB (AND NOT) operation test. More... | |
void | bm::bit_block_copy (bm::word_t *dst, const bm::word_t *src) noexcept |
Bitblock copy operation. More... | |
void | bm::bit_block_copy_unalign (bm::word_t *dst, const bm::word_t *src) noexcept |
Bitblock copy operation (unaligned src) More... | |
void | bm::bit_block_stream (bm::word_t *dst, const bm::word_t *src) noexcept |
Bitblock copy/stream operation. More... | |
void | bm::bit_block_stream_unalign (bm::word_t *dst, const bm::word_t *src) noexcept |
Bitblock copy/stream operation (unaligned src) More... | |
bm::id64_t | bm::bit_block_and (bm::word_t *dst, const bm::word_t *src) noexcept |
Plain bitblock AND operation. Function does not analyse availability of source and destination blocks. More... | |
bm::id64_t | bm::bit_block_and (bm::word_t *dst, const bm::word_t *src, bm::id64_t digest) noexcept |
digest based bit-block AND More... | |
bm::id64_t | bm::bit_block_and_5way (bm::word_t *dst, const bm::word_t *src0, const bm::word_t *src1, const bm::word_t *src2, const bm::word_t *src3, bm::id64_t digest) noexcept |
digest based bit-block AND 5-way More... | |
bm::id64_t | bm::bit_block_and_3way (bm::word_t *dst, const bm::word_t *src1, const bm::word_t *src2, bm::id64_t digest) noexcept |
digest based bit-block AND More... | |
bm::id64_t | bm::bit_block_and_2way (bm::word_t *dst, const bm::word_t *src1, const bm::word_t *src2, bm::id64_t digest) noexcept |
digest based bit-block AND More... | |
bm::id64_t | bm::bit_block_init_and_2way (bm::word_t *dst, const bm::word_t *src1, const bm::word_t *src2, bm::id64_t digest) noexcept |
digest based bit-block AND (0 elements of digest will be zeroed) More... | |
bm::id64_t | bm::bit_block_and_or_2way (bm::word_t *dst, const bm::word_t *src1, const bm::word_t *src2, bm::id64_t digest) noexcept |
digest based bit-block AND - OR More... | |
unsigned | bm::bit_block_and_count (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Function ANDs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks. More... | |
unsigned | bm::bit_block_and_any (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Function ANDs two bitblocks and tests for any bit. Function does not analyse availability of source blocks. More... | |
unsigned | bm::bit_block_xor_count (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Function XORs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks. More... | |
unsigned | bm::bit_block_xor_any (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Function XORs two bitblocks and and tests for any bit. Function does not analyse availability of source blocks. More... | |
unsigned | bm::bit_block_sub_count (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Function SUBs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks. More... | |
unsigned | bm::bit_block_sub_any (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Function SUBs two bitblocks and and tests for any bit. Function does not analyse availability of source blocks. More... | |
unsigned | bm::bit_block_or_count (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Function ORs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks. More... | |
unsigned | bm::bit_block_or_any (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Function ORs two bitblocks and and tests for any bit. Function does not analyse availability of source blocks. More... | |
bm::word_t * | bm::bit_operation_and (bm::word_t *dst, const bm::word_t *src) noexcept |
bitblock AND operation. More... | |
bm::id_t | bm::bit_operation_and_count (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Performs bitblock AND operation and calculates bitcount of the result. More... | |
bm::id_t | bm::bit_operation_and_any (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Performs bitblock AND operation test. More... | |
bm::id_t | bm::bit_operation_sub_count (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Performs bitblock SUB operation and calculates bitcount of the result. More... | |
bm::id_t | bm::bit_operation_sub_count_inv (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Performs inverted bitblock SUB operation and calculates bitcount of the result. More... | |
bm::id_t | bm::bit_operation_sub_any (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Performs bitblock test of SUB operation. More... | |
bm::id_t | bm::bit_operation_or_count (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Performs bitblock OR operation and calculates bitcount of the result. More... | |
bm::id_t | bm::bit_operation_or_any (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Performs bitblock OR operation test. More... | |
bool | bm::bit_block_or (bm::word_t *dst, const bm::word_t *src) noexcept |
Plain bitblock OR operation. Function does not analyse availability of source and destination blocks. More... | |
bool | bm::bit_block_or_2way (bm::word_t *dst, const bm::word_t *src1, const bm::word_t *src2) noexcept |
2 way (target := source1 | source2) bitblock OR operation. More... | |
bm::id64_t | bm::bit_block_xor_2way (bm::word_t *dst, const bm::word_t *src1, const bm::word_t *src2) noexcept |
2 way (target := source1 ^ source2) bitblock XOR operation. More... | |
bool | bm::bit_block_or_3way (bm::word_t *dst, const bm::word_t *src1, const bm::word_t *src2) noexcept |
3 way (target | source1 | source2) bitblock OR operation. Function does not analyse availability of source and destination blocks. More... | |
bool | bm::bit_block_or_5way (bm::word_t *dst, const bm::word_t *src1, const bm::word_t *src2, const bm::word_t *src3, const bm::word_t *src4) noexcept |
5 way (target, source1, source2) bitblock OR operation. Function does not analyse availability of source and destination blocks. More... | |
bm::word_t * | bm::bit_operation_or (bm::word_t *dst, const bm::word_t *src) noexcept |
Block OR operation. Makes analysis if block is 0 or FULL. More... | |
bm::id64_t | bm::bit_block_sub (bm::word_t *dst, const bm::word_t *src) noexcept |
Plain bitblock SUB (AND NOT) operation. Function does not analyse availability of source and destination blocks. More... | |
bm::id64_t | bm::bit_block_sub (bm::word_t *dst, const bm::word_t *src, bm::id64_t digest) noexcept |
digest based bitblock SUB (AND NOT) operation More... | |
bm::id64_t | bm::bit_block_sub_2way (bm::word_t *dst, const bm::word_t *src1, const bm::word_t *src2, bm::id64_t digest) noexcept |
digest based bitblock SUB (AND NOT) operation (3 operand) More... | |
bm::id64_t | bm::bit_block_sub_5way (bm::word_t *dst, const bm::word_t *src0, const bm::word_t *src1, const bm::word_t *src2, const bm::word_t *src3, bm::id64_t digest) noexcept |
digest based bit-block SUB 5-way More... | |
bm::id64_t | bm::bit_block_sub_3way (bm::word_t *dst, const bm::word_t *src0, const bm::word_t *src1, bm::id64_t digest) noexcept |
digest based bit-block SUB 3-way More... | |
bm::word_t * | bm::bit_operation_sub (bm::word_t *dst, const bm::word_t *src) noexcept |
bitblock SUB operation. More... | |
bm::id64_t | bm::bit_block_xor (bm::word_t *dst, const bm::word_t *src) noexcept |
Plain bitblock XOR operation. Function does not analyse availability of source and destination blocks. More... | |
void | bm::bit_andnot_arr_ffmask (bm::word_t *dst, const bm::word_t *src) noexcept |
bitblock AND NOT with constant ~0 mask operation. More... | |
bm::word_t * | bm::bit_operation_xor (bm::word_t *dst, const bm::word_t *src) noexcept |
bitblock XOR operation. More... | |
bm::id_t | bm::bit_operation_xor_count (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Performs bitblock XOR operation and calculates bitcount of the result. More... | |
bm::id_t | bm::bit_operation_xor_any (const bm::word_t *src1, const bm::word_t *src2) noexcept |
Performs bitblock XOR operation test. More... | |
template<class T > | |
unsigned | bm::bit_count_nonzero_size (const T *blk, unsigned data_size) noexcept |
Inspects block for full zero words. More... | |
unsigned | bm::bit_block_find (const bm::word_t *block, unsigned nbit, unsigned *pos) noexcept |
Searches for the next 1 bit in the BIT block. More... | |
unsigned | bm::bit_find_last (const bm::word_t *block, unsigned *last) noexcept |
BIT block find the last set bit (backward search) More... | |
bool | bm::bit_find_first (const bm::word_t *block, unsigned *pos) noexcept |
BIT block find the first set bit. More... | |
unsigned | bm::bit_find_first (const bm::word_t *block, unsigned *first, bm::id64_t digest) noexcept |
BIT block find the first set bit. More... | |
bool | bm::bit_find_first_if_1 (const bm::word_t *block, unsigned *first, bm::id64_t digest) noexcept |
BIT block find the first set bit if only 1 bit is set. More... | |
template<typename SIZE_TYPE > | |
SIZE_TYPE | bm::bit_find_rank (const bm::word_t *const block, SIZE_TYPE rank, unsigned nbit_from, unsigned &nbit_pos) noexcept |
BIT block find position for the rank. More... | |
template<typename SIZE_TYPE > | |
SIZE_TYPE | bm::block_find_rank (const bm::word_t *const block, SIZE_TYPE rank, unsigned nbit_from, unsigned &nbit_pos) noexcept |
Find rank in block (GAP or BIT) More... | |
bm::set_representation | bm::best_representation (unsigned bit_count, unsigned total_possible_bitcount, unsigned gap_count, unsigned block_size) noexcept |
Choose best representation for a bit-block. More... | |
template<typename T > | |
unsigned | bm::bit_block_convert_to_arr (T *dest, const unsigned *src, bool inverted) noexcept |
Convert bit block into an array of ints corresponding to 1 bits. More... | |
bool | bm::check_block_zero (const bm::word_t *blk, bool deep_scan) noexcept |
Checks all conditions and returns true if block consists of only 0 bits. More... | |
bool | bm::check_block_one (const bm::word_t *blk, bool deep_scan) noexcept |
Checks if block has only 1 bits. More... | |
template<typename T > | |
unsigned | bm::gap_overhead (const T *length, const T *length_end, const T *glevel_len) noexcept |
Calculates memory overhead for number of gap blocks sharing the same memory allocation table (level lengths table). More... | |
template<typename T > | |
bool | bm::improve_gap_levels (const T *length, const T *length_end, T *glevel_len) noexcept |
Finds optimal gap blocks lengths. More... | |
bool | bm::block_find_first_diff (const bm::word_t *blk, const bm::word_t *arg_blk, unsigned *pos) noexcept |
Find first bit which is different between two blocks (GAP or bit) More... | |
template<class It1 , class It2 , class BinaryOp , class Encoder > | |
void | bm::bit_recomb (It1 &it1, It2 &it2, BinaryOp &op, Encoder &enc, unsigned block_size=bm::set_block_size) noexcept |
unsigned short | bm::bitscan_wave (const bm::word_t *w_ptr, unsigned char *bits) noexcept |
Unpacks word wave (Nx 32-bit words) More... | |
template<typename TRGW , typename IDX , typename SZ > | |
void | bm::bit_block_gather_scatter (TRGW *arr, const bm::word_t *blk, const IDX *idx, SZ size, SZ start, unsigned bit_idx) noexcept |
bit index to word gather-scatter algorithm More... | |
bm::id64_t | bm::idx_arr_block_lookup_u64 (const bm::id64_t *idx, bm::id64_t size, bm::id64_t nb, bm::id64_t start) noexcept |
block boundaries look ahead U32 More... | |
unsigned | bm::idx_arr_block_lookup_u32 (const unsigned *idx, unsigned size, unsigned nb, unsigned start) noexcept |
block boundaries look ahead U32 More... | |
void | bm::set_block_bits_u64 (bm::word_t *block, const bm::id64_t *idx, bm::id64_t start, bm::id64_t stop) noexcept |
set bits in a bit-block using global index More... | |
void | bm::set_block_bits_u32 (bm::word_t *block, const unsigned *idx, unsigned start, unsigned stop) noexcept |
set bits in a bit-block using global index More... | |
bool | bm::block_ptr_array_range (bm::word_t **arr, unsigned &left, unsigned &right) noexcept |
array range detector More... | |
unsigned | bm::lower_bound_linear_u32 (const unsigned *arr, unsigned target, unsigned from, unsigned to) noexcept |
Linear lower bound search in unsigned array. More... | |
unsigned | bm::lower_bound_linear_u64 (const unsigned long long *arr, unsigned long long target, unsigned from, unsigned to) noexcept |
Linear lower bound search in unsigned LONG array. More... | |
unsigned | bm::lower_bound_u32 (const unsigned *arr, unsigned target, unsigned from, unsigned to) noexcept |
Hybrid, binary-linear lower bound search in unsigned array. More... | |
unsigned | bm::lower_bound_u64 (const unsigned long long *arr, unsigned long long target, unsigned from, unsigned to) noexcept |
Hybrid, binary-linear lower bound search in unsigned LONG array. More... | |
bool | bm::find_ptr (const void *const *p_arr, size_t arr_size, const void *ptr, size_t *idx) noexcept |
Scan search for pointer value in unordered array. More... | |
bm::id_t | bm::block_to_global_index (unsigned i, unsigned j, unsigned block_idx) noexcept |
calculate bvector<> global bit-index from block-local coords More... | |
unsigned | bm::min_delta_u32 (const unsigned *arr, size_t arr_size) |
Calculate minimal delta between elements of sorted array. More... | |
void | bm::min_delta_apply (unsigned *arr, size_t arr_size, unsigned delta) noexcept |
Recalculate the array to decrement delta as arr[i] = arr[i] - delta + 1 so that array remains monotonically growing (fit for interpolative compression) More... | |
template<typename VT , typename SZ > | |
bool | bm::find_max_nz (const VT *arr, SZ arr_size, SZ *found_idx) noexcept |
Find max non-zero value in an array. More... | |
template<typename VT , typename SZ > | |
bool | bm::find_first_nz (const VT *arr, SZ arr_size, SZ *found_idx) noexcept |
Find max non-zero value in an array. More... | |
template<typename VT , typename SZ > | |
SZ | bm::count_nz (const VT *arr, SZ arr_size) noexcept |
Find count of non-zero elements in the array. More... | |
bm::bit_representation | bm::best_representation (unsigned gc, unsigned bc, unsigned max_bits, float bie_bits_per_int, unsigned *best_metric) noexcept |
Detect best representation for serialization for a block or sub-block. More... | |
void | bm::set_nibble (unsigned char *arr, unsigned idx, unsigned char v) noexcept |
set nibble in the array More... | |
unsigned char | bm::get_nibble (const unsigned char *arr, unsigned idx) noexcept |
get nibble from the array More... | |
bm::id64_t | bm::ptrp_test (ptr_payload_t ptr, bm::gap_word_t v) noexcept |
Variables | |
const unsigned short | bm::set_bitscan_wave_size = 4 |
Size of bit decode wave in words. More... | |
Bit manipulation primitives (internal)
Definition in file bmfunc.h.