BitMagic-C++
Data Structures | Namespaces | Typedefs | Enumerations | Functions | Variables
bmfunc.h File Reference

Bit manipulation primitives (internal) More...

#include <memory.h>
#include <type_traits>
#include "bmdef.h"
#include "bmutil.h"
Include dependency graph for bmfunc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

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

namespace  bm
 

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 *BMRESTRICT, const gap_word_t *BMRESTRICT, gap_word_t *BMRESTRICT, unsigned &)
 
typedef bm::id_t(* bm::bit_operation_count_func_type) (const bm::word_t *BMRESTRICT, const bm::word_t *BMRESTRICT)
 

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) BMNOEXCEPT
  More...
 
bm::id_t bm::bit_block_any_range (const bm::word_t *block, bm::word_t left, bm::word_t right) BMNOEXCEPT
  More...
 
template<typename BI_TYPE >
BMFORCEINLINE void bm::get_block_coord (BI_TYPE nb, unsigned &i, unsigned &j) BMNOEXCEPT
 Recalc linear bvector block index into 2D matrix coordinates. More...
 
template<typename RTYPE >
BMFORCEINLINE RTYPE bm::get_super_block_start (unsigned i) BMNOEXCEPT
 Compute bit address of the first bit in a superblock. More...
 
template<typename RTYPE >
BMFORCEINLINE RTYPE bm::get_block_start (unsigned i, unsigned j) BMNOEXCEPT
 Compute bit address of the first bit in a block. More...
 
int bm::parallel_popcnt_32 (unsigned int n) BMNOEXCEPT
 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) BMNOEXCEPT
  More...
 
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) BMNOEXCEPT
 portable, switch based bitscan More...
 
template<typename T , typename B >
unsigned bm::bit_list (T w, B *bits) BMNOEXCEPT
 Unpacks word into list of ON bit indexes. More...
 
template<typename T , typename B >
unsigned bm::bit_list_4 (T w, B *bits) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
  More...
 
template<typename B >
unsigned short bm::bitscan_bsf64 (bm::id64_t w, B *bits) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 Templated Bitscan with dynamic dispatch for best type. More...
 
unsigned bm::word_select64_linear (bm::id64_t w, unsigned rank) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 word find index of the rank-th bit set by bit-testing More...
 
unsigned bm::word_select32_bitscan_popcnt (unsigned w, unsigned rank) BMNOEXCEPT
 word find index of the rank-th bit set by bit-testing More...
 
unsigned bm::word_select32_bitscan_tz (unsigned w, unsigned rank) BMNOEXCEPT
 word find index of the rank-th bit set by bit-testing More...
 
unsigned bm::word_select64 (bm::id64_t w, unsigned rank) BMNOEXCEPT
 word find index of the rank-th bit set by bit-testing More...
 
unsigned bm::word_select32 (unsigned w, unsigned rank) BMNOEXCEPT
 word find index of the rank-th bit set by bit-testing More...
 
BMFORCEINLINE bm::id64_t bm::widx_to_digest_mask (unsigned w_idx) BMNOEXCEPT
 Compute digest mask for word address in block. More...
 
bm::id64_t bm::dm_control (unsigned from, unsigned to) BMNOEXCEPT
 digest mask control generation (for debug and test only) More...
 
BMFORCEINLINE bm::id64_t bm::digest_mask (unsigned from, unsigned to) BMNOEXCEPT
 Compute digest mask for [from..to] positions. More...
 
bool bm::check_zero_digest (bm::id64_t digest, unsigned bitpos_from, unsigned bitpos_to) BMNOEXCEPT
 check if all digest bits for the range [from..to] are 0 More...
 
void bm::block_init_digest0 (bm::word_t *const block, bm::id64_t digest) BMNOEXCEPT
 Init block with 000111000 pattren based on digest. More...
 
bm::id64_t bm::calc_block_digest0 (const bm::word_t *const block) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 expand sub-blocks by digest (rank expansion) More...
 
bool bm::is_const_set_operation (set_operation op) BMNOEXCEPT
 Returns true if set operation is constant (bitcount) More...
 
bm::operation bm::setop2op (bm::set_operation op) BMNOEXCEPT
 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) BMNOEXCEPT
  More...
 
template<typename T >
int bm::wordcmp0 (T w1, T w2) BMNOEXCEPT
 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) BMNOEXCEPT
 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 *BMRESTRICT start) BMNOEXCEPT
 Returns "true" if all bits in the block are 0. More...
 
BMFORCEINLINE bool bm::gap_is_all_zero (const bm::gap_word_t *BMRESTRICT buf) BMNOEXCEPT
 Checks if GAP block is all-zero. More...
 
BMFORCEINLINE bool bm::gap_is_all_one (const bm::gap_word_t *BMRESTRICT buf) BMNOEXCEPT
 Checks if GAP block is all-one. More...
 
BMFORCEINLINE bm::gap_word_t bm::gap_length (const bm::gap_word_t *BMRESTRICT buf) BMNOEXCEPT
 Returs GAP block length. More...
 
template<typename T >
unsigned bm::gap_capacity (const T *BMRESTRICT buf, const T *BMRESTRICT glevel_len) BMNOEXCEPT
 Returs GAP block capacity. More...
 
template<typename T >
unsigned bm::gap_limit (const T *BMRESTRICT buf, const T *BMRESTRICT glevel_len) BMNOEXCEPT
 Returs GAP block capacity limit. More...
 
template<typename T >
bm::gap_level (const T *BMRESTRICT buf) BMNOEXCEPT
 Returs GAP blocks capacity level. More...
 
template<typename T >
unsigned bm::gap_find_last (const T *BMRESTRICT buf, unsigned *BMRESTRICT last) BMNOEXCEPT
 GAP block find the last set bit. More...
 
template<typename T >
unsigned bm::gap_find_first (const T *BMRESTRICT buf, unsigned *BMRESTRICT first) BMNOEXCEPT
 GAP block find the first set bit. More...
 
template<typename T >
unsigned bm::gap_bfind (const T *BMRESTRICT buf, unsigned pos, unsigned *BMRESTRICT is_set) BMNOEXCEPT
  More...
 
template<typename T >
unsigned bm::gap_test (const T *BMRESTRICT buf, unsigned pos) BMNOEXCEPT
 Tests if bit = pos is true. More...
 
template<typename T >
unsigned bm::gap_test_unr (const T *BMRESTRICT buf, const unsigned pos) BMNOEXCEPT
 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) BMNOEXCEPT
  More...
 
template<class T , class F >
void bm::for_each_nzblock (T ***root, unsigned size1, F &f)
  More...
 
template<class T , class F >
void bm::for_each_nzblock2 (T ***root, unsigned size1, F &f)
  More...
 
template<typename T , typename BI , typename F >
bool bm::for_each_nzblock_if (T ***root, BI size1, F &f) BMNOEXCEPT
  More...
 
template<class T , class F , typename BLOCK_IDX >
void bm::for_each_block (T ***root, unsigned size1, F &f, BLOCK_IDX start)
  More...
 
template<class T , class F >
bm::bmfor_each (T first, T last, F f)
  More...
 
template<typename T >
bm::id64_t bm::sum_arr (const T *first, const T *last) BMNOEXCEPT
  More...
 
template<typename T >
void bm::gap_split (const T *buf, T *arr0, T *arr1, T &arr0_cnt, T &arr1_cnt) BMNOEXCEPT
  More...
 
template<typename T >
unsigned bm::gap_bit_count (const T *buf, unsigned dsize=0) BMNOEXCEPT
 Calculates number of bits ON in GAP buffer. More...
 
template<typename T >
unsigned bm::gap_bit_count_unr (const T *buf) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 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 BMRESTRICT buf, unsigned left, unsigned right) BMNOEXCEPT
 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 BMRESTRICT buf, unsigned left, unsigned right) BMNOEXCEPT
 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 BMRESTRICT buf, unsigned left, unsigned right) BMNOEXCEPT
 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 BMRESTRICT buf, unsigned nbit, unsigned *BMRESTRICT pos) BMNOEXCEPT
 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 BMRESTRICT buf, unsigned nbit, unsigned *BMRESTRICT pos) BMNOEXCEPT
 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 BMRESTRICT buf, unsigned nbit, unsigned *BMRESTRICT pos) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 Counts 1 bits in GAP buffer in the closed [0, right] range. More...
 
template<class T , class Func >
void bm::for_each_dgap (const T *gap_buf, Func &func)
  More...
 
template<typename T >
T * bm::gap_2_dgap (const T *BMRESTRICT gap_buf, T *BMRESTRICT dgap_buf, bool copy_head=true) BMNOEXCEPT
 Convert GAP buffer into D-GAP buffer. More...
 
template<typename T >
void bm::dgap_2_gap (const T *BMRESTRICT dgap_buf, T *BMRESTRICT gap_buf, T gap_header=0) BMNOEXCEPT
 Convert D-GAP buffer into GAP buffer. More...
 
template<typename T >
int bm::gapcmp (const T *buf1, const T *buf2) BMNOEXCEPT
 Lexicographical comparison of GAP buffers. More...
 
template<typename T >
bool bm::gap_find_first_diff (const T *BMRESTRICT buf1, const T *BMRESTRICT buf2, unsigned *BMRESTRICT pos) BMNOEXCEPT
 Find first bit which is different between two GAP-blocks. More...
 
template<typename T , class F >
void bm::gap_buff_op (T *BMRESTRICT dest, const T *BMRESTRICT vect1, unsigned vect1_mask, const T *BMRESTRICT vect2, unsigned vect2_mask, unsigned &dlen) BMNOEXCEPT2
 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 *BMRESTRICT vect1, unsigned vect1_mask, const T *BMRESTRICT vect2, unsigned vect2_mask) BMNOEXCEPT2
 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) BMNOEXCEPT2
 Abstract distance(similarity) operation for GAP buffers. Receives functor F as a template argument. More...
 
template<typename T >
unsigned bm::gap_set_value (unsigned val, T *BMRESTRICT buf, unsigned pos, unsigned *BMRESTRICT is_set) BMNOEXCEPT
 Sets or clears bit in the GAP buffer. More...
 
template<typename T >
unsigned bm::gap_set_value (unsigned val, T *BMRESTRICT buf, unsigned pos) BMNOEXCEPT
 Sets or clears bit in the GAP buffer. More...
 
template<typename T >
unsigned bm::gap_add_value (T *buf, unsigned pos) BMNOEXCEPT
 Add new value to the end of GAP buffer. More...
 
template<typename T >
bool bm::gap_shift_r1 (T *BMRESTRICT buf, unsigned co_flag, unsigned *BMRESTRICT new_len) BMNOEXCEPT
 Right shift GAP block by 1 bit. More...
 
template<typename T >
bool bm::gap_insert (T *BMRESTRICT buf, unsigned pos, unsigned val, unsigned *BMRESTRICT new_len) BMNOEXCEPT
 isnert bit into GAP compressed block More...
 
template<typename T >
bool bm::gap_shift_l1 (T *BMRESTRICT buf, unsigned co_flag, unsigned *BMRESTRICT new_len) BMNOEXCEPT
 Left shift GAP block by 1 bit. More...
 
template<typename T >
unsigned bm::gap_set_array (T *buf, const T *arr, unsigned len) BMNOEXCEPT
 Convert array to GAP buffer. More...
 
template<typename T >
unsigned bm::bit_array_compute_gaps (const T *arr, unsigned len) BMNOEXCEPT
 Compute number of GAPs in bit-array. More...
 
template<typename T >
unsigned bm::gap_block_find (const T *BMRESTRICT buf, unsigned nbit, bm::id_t *BMRESTRICT prev) BMNOEXCEPT
 Searches for the next 1 bit in the GAP block. More...
 
BMFORCEINLINE void bm::set_bit (unsigned *dest, unsigned bitpos) BMNOEXCEPT
 Set 1 bit in a block. More...
 
BMFORCEINLINE void bm::clear_bit (unsigned *dest, unsigned bitpos) BMNOEXCEPT
 Set 1 bit in a block. More...
 
BMFORCEINLINE unsigned bm::test_bit (const unsigned *block, unsigned bitpos) BMNOEXCEPT
 Test 1 bit in a block. More...
 
void bm::or_bit_block (unsigned *dest, unsigned bitpos, unsigned bitcount) BMNOEXCEPT
 Sets bits to 1 in the bitblock. More...
 
void bm::sub_bit_block (unsigned *dest, unsigned bitpos, unsigned bitcount) BMNOEXCEPT
 SUB (AND NOT) bit interval to 1 in the bitblock. More...
 
void bm::xor_bit_block (unsigned *dest, unsigned bitpos, unsigned bitcount) BMNOEXCEPT
 XOR bit interval to 1 in the bitblock. More...
 
template<typename T >
void bm::gap_sub_to_bitset (unsigned *BMRESTRICT dest, const T *BMRESTRICT pcurr) BMNOEXCEPT
 SUB (AND NOT) GAP block to bitblock. More...
 
template<typename T >
void bm::gap_sub_to_bitset (unsigned *BMRESTRICT dest, const T *BMRESTRICT pcurr, bm::id64_t digest0) BMNOEXCEPT
 SUB (AND NOT) GAP block to bitblock with digest assist. More...
 
template<typename T >
void bm::gap_xor_to_bitset (unsigned *BMRESTRICT dest, const T *BMRESTRICT pcurr) BMNOEXCEPT
 XOR GAP block to bitblock. More...
 
template<typename T >
void bm::gap_add_to_bitset (unsigned *BMRESTRICT dest, const T *BMRESTRICT pcurr, unsigned len) BMNOEXCEPT
 Adds(OR) GAP block to bitblock. More...
 
template<typename T >
void bm::gap_add_to_bitset (unsigned *BMRESTRICT dest, const T *BMRESTRICT pcurr) BMNOEXCEPT
 Adds(OR) GAP block to bitblock. More...
 
template<typename T >
void bm::gap_and_to_bitset (unsigned *BMRESTRICT dest, const T *BMRESTRICT pcurr) BMNOEXCEPT
 ANDs GAP block to bitblock. More...
 
template<typename T >
void bm::gap_and_to_bitset (unsigned *BMRESTRICT dest, const T *BMRESTRICT pcurr, bm::id64_t digest0) BMNOEXCEPT
 ANDs GAP block to bitblock with digest assist. More...
 
template<typename T >
bm::id_t bm::gap_bitset_and_count (const unsigned *BMRESTRICT block, const T *BMRESTRICT pcurr) BMNOEXCEPT
 Compute bitcount of bit block AND masked by GAP block. More...
 
template<typename T >
bm::id_t bm::gap_bitset_and_any (const unsigned *BMRESTRICT block, const T *BMRESTRICT pcurr) BMNOEXCEPT
 Bitcount test of bit block AND masked by GAP block. More...
 
template<typename T >
bm::id_t bm::gap_bitset_sub_count (const unsigned *BMRESTRICT block, const T *BMRESTRICT buf) BMNOEXCEPT
 Compute bitcount of bit block SUB masked by GAP block. More...
 
template<typename T >
bm::id_t bm::gap_bitset_sub_any (const unsigned *BMRESTRICT block, const T *BMRESTRICT buf) BMNOEXCEPT
 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 *BMRESTRICT block, const T *BMRESTRICT buf) BMNOEXCEPT
 Compute bitcount of bit block XOR masked by GAP block. More...
 
template<typename T >
bm::id_t bm::gap_bitset_xor_any (const unsigned *BMRESTRICT block, const T *BMRESTRICT buf) BMNOEXCEPT
 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 *BMRESTRICT block, const T *BMRESTRICT buf) BMNOEXCEPT
 Compute bitcount of bit block OR masked by GAP block. More...
 
template<typename T >
bm::id_t bm::gap_bitset_or_any (const unsigned *BMRESTRICT block, const T *BMRESTRICT buf) BMNOEXCEPT
 Compute bitcount test of bit block OR masked by GAP block. More...
 
void bm::bit_block_set (bm::word_t *BMRESTRICT dst, bm::word_t value) BMNOEXCEPT
 Bitblock memset operation. More...
 
template<typename T >
void bm::gap_convert_to_bitset (unsigned *BMRESTRICT dest, const T *BMRESTRICT buf, unsigned len=0) BMNOEXCEPT
 GAP block to bitblock conversion. More...
 
template<typename T >
unsigned * bm::gap_convert_to_bitset_smart (unsigned *BMRESTRICT dest, const T *BMRESTRICT buf, id_t set_max) BMNOEXCEPT
 Smart GAP block to bitblock conversion. More...
 
template<typename T >
unsigned bm::gap_control_sum (const T *buf) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 Init gap block so it has block in it (can be whole block) More...
 
template<typename T >
void bm::gap_invert (T *buf) BMNOEXCEPT
 Inverts all bits in the GAP buffer. More...
 
template<typename T >
void bm::set_gap_level (T *buf, int level) BMNOEXCEPT
 Sets GAP block capacity level. More...
 
template<typename T >
int bm::gap_calc_level (unsigned len, const T *glevel_len) BMNOEXCEPT
 Calculates GAP block capacity level. More...
 
template<typename T >
unsigned bm::gap_free_elements (const T *BMRESTRICT buf, const T *BMRESTRICT glevel_len) BMNOEXCEPT
 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) BMNOEXCEPT
 Lexicographical comparison of BIT buffers. More...
 
bool bm::bit_find_first_diff (const bm::word_t *BMRESTRICT blk1, const bm::word_t *BMRESTRICT blk2, unsigned *BMRESTRICT pos) BMNOEXCEPT
 Find first bit which is different between two bit-blocks. More...
 
unsigned bm::bit_block_to_gap (gap_word_t *BMRESTRICT dest, const unsigned *BMRESTRICT block, unsigned dest_len) BMNOEXCEPT
 Converts bit block to GAP. More...
 
unsigned bm::bit_to_gap (gap_word_t *BMRESTRICT dest, const unsigned *BMRESTRICT block, unsigned dest_len) BMNOEXCEPT
 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 >
bm::gap_convert_to_arr (D *BMRESTRICT dest, const T *BMRESTRICT buf, unsigned dest_len, bool invert=false) BMNOEXCEPT
 Convert gap block into array of ints corresponding to 1 bits. More...
 
BMFORCEINLINE unsigned bm::bit_count_min_unroll (const bm::word_t *BMRESTRICT block, const bm::word_t *BMRESTRICT block_end) BMNOEXCEPT
 Bitcount for bit block without agressive unrolling. More...
 
bm::id_t bm::bit_block_count (const bm::word_t *block) BMNOEXCEPT
 Bitcount for bit block. More...
 
bm::id_t bm::bit_block_count (const bm::word_t *BMRESTRICT const block, bm::id64_t digest) BMNOEXCEPT
 Bitcount for bit block. More...
 
bm::id_t bm::bit_count_change (bm::word_t w) BMNOEXCEPT
  More...
 
unsigned bm::bit_block_change32 (const bm::word_t *BMRESTRICT block, unsigned size) BMNOEXCEPT
  More...
 
unsigned bm::bit_block_change64 (const bm::word_t *BMRESTRICT in_block, unsigned size) BMNOEXCEPT
  More...
 
void bm::bit_block_change_bc (const bm::word_t *BMRESTRICT block, unsigned *BMRESTRICT gc, unsigned *BMRESTRICT bc) BMNOEXCEPT
  More...
 
unsigned bm::bit_block_calc_change (const bm::word_t *block) BMNOEXCEPT
  More...
 
bool bm::bit_block_is_all_one_range (const bm::word_t *const BMRESTRICT block, bm::word_t left, bm::word_t right) BMNOEXCEPT
  More...
 
bm::id_t bm::bit_block_calc_count_to (const bm::word_t *block, bm::word_t right) BMNOEXCEPT
  More...
 
void bm::bit_block_rotate_left_1 (bm::word_t *block) BMNOEXCEPT
  More...
 
void bm::bit_block_rotate_left_1_unr (bm::word_t *block) BMNOEXCEPT
 Unrolled cyclic rotation of bit-block left by 1 bit. More...
 
bm::word_t bm::bit_block_insert (bm::word_t *BMRESTRICT block, unsigned bitpos, bool value) BMNOEXCEPT
 insert bit into position and shift the rest right with carryover More...
 
bool bm::bit_block_shift_r1 (bm::word_t *BMRESTRICT block, bm::word_t *BMRESTRICT empty_acc, bm::word_t co_flag) BMNOEXCEPT
 Right bit-shift bitblock by 1 bit (reference) More...
 
bool bm::bit_block_shift_r1_unr_min (bm::word_t *BMRESTRICT block, bm::word_t *BMRESTRICT empty_acc, bm::id64_t co_flag) BMNOEXCEPT
 Right bit-shift bitblock by 1 bit (minimum unroll) More...
 
bool bm::bit_block_shift_r1_unr (bm::word_t *BMRESTRICT block, bm::word_t *BMRESTRICT empty_acc, bm::word_t co_flag) BMNOEXCEPT
 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) BMNOEXCEPT
 Left bit-shift bitblock by 1 bit (reference) More...
 
bool bm::bit_block_shift_l1_unr_min (bm::word_t *BMRESTRICT block, bm::word_t *BMRESTRICT empty_acc, unsigned co_flag) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 erase bit from position and shift the rest right with carryover More...
 
bool bm::bit_block_shift_r1_and (bm::word_t *BMRESTRICT block, bm::word_t co_flag, const bm::word_t *BMRESTRICT mask_block, bm::id64_t *BMRESTRICT digest) BMNOEXCEPT
 Right bit-shift of bit-block by 1 bit (reference) + AND. More...
 
bool bm::bit_block_shift_r1_and_unr (bm::word_t *BMRESTRICT block, bm::word_t co_flag, const bm::word_t *BMRESTRICT mask_block, bm::id64_t *BMRESTRICT digest) BMNOEXCEPT
 Right bit-shift bitblock by 1 bit (reference) + AND. More...
 
bm::id_t bm::bit_block_any_range (const bm::word_t *const BMRESTRICT block, bm::word_t left, bm::word_t right) BMNOEXCEPT
  More...
 
template<typename T >
void bm::bit_invert (T *start) BMNOEXCEPT
  More...
 
bool bm::is_bits_one (const bm::wordop_t *start) BMNOEXCEPT
 Returns "true" if all bits in the block are 1. More...
 
bool bm::block_is_all_one_range (const bm::word_t *const BMRESTRICT block, unsigned left, unsigned right) BMNOEXCEPT
 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 BMRESTRICT block, unsigned left, unsigned right) BMNOEXCEPT
 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 *BMRESTRICT block, unsigned nbit, unsigned *BMRESTRICT pos) BMNOEXCEPT
 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 *BMRESTRICT block, unsigned nbit_from, unsigned *BMRESTRICT found_nbit) BMNOEXCEPT
 Find end of the current 111 interval. More...
 
bool bm::bit_block_find_interval_start (const bm::word_t *BMRESTRICT block, unsigned nbit, unsigned *BMRESTRICT pos) BMNOEXCEPT
 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 *BMRESTRICT block, unsigned nbit, unsigned *BMRESTRICT pos) BMNOEXCEPT
 Reverse search for the previous 1 bit. More...
 
unsigned bm::block_find_interval_start (const bm::word_t *BMRESTRICT block, unsigned nbit_from, unsigned *BMRESTRICT found_nbit) BMNOEXCEPT
 Find start of the current 111 interval. More...
 
bool bm::block_find_reverse (const bm::word_t *BMRESTRICT block, unsigned nbit_from, unsigned *BMRESTRICT found_nbit) BMNOEXCEPT
 Reverse find 1. More...
 
bool bm::block_any_range (const bm::word_t *const BMRESTRICT block, unsigned left, unsigned right) BMNOEXCEPT
 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 BMRESTRICT block) BMNOEXCEPT
 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 *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2, gap_word_t *BMRESTRICT tmp_buf, unsigned &dsize) BMNOEXCEPT
 GAP AND operation. More...
 
unsigned bm::gap_operation_any_and (const gap_word_t *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2) BMNOEXCEPT
 GAP AND operation test. More...
 
unsigned bm::gap_count_and (const gap_word_t *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2) BMNOEXCEPT
 GAP bitcount AND operation test. More...
 
gap_word_t * bm::gap_operation_xor (const gap_word_t *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2, gap_word_t *BMRESTRICT tmp_buf, unsigned &dsize) BMNOEXCEPT
 GAP XOR operation. More...
 
BMFORCEINLINE unsigned bm::gap_operation_any_xor (const gap_word_t *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2) BMNOEXCEPT
 GAP XOR operation test. More...
 
BMFORCEINLINE unsigned bm::gap_count_xor (const gap_word_t *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2) BMNOEXCEPT
 GAP bitcount XOR operation test. More...
 
gap_word_t * bm::gap_operation_or (const gap_word_t *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2, gap_word_t *BMRESTRICT tmp_buf, unsigned &dsize) BMNOEXCEPT
 GAP OR operation. More...
 
BMFORCEINLINE unsigned bm::gap_count_or (const gap_word_t *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2) BMNOEXCEPT
 GAP bitcount OR operation test. More...
 
gap_word_t * bm::gap_operation_sub (const gap_word_t *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2, gap_word_t *BMRESTRICT tmp_buf, unsigned &dsize) BMNOEXCEPT
 GAP SUB (AND NOT) operation. More...
 
unsigned bm::gap_operation_any_sub (const gap_word_t *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2) BMNOEXCEPT
 GAP SUB operation test. More...
 
BMFORCEINLINE unsigned bm::gap_count_sub (const gap_word_t *BMRESTRICT vect1, const gap_word_t *BMRESTRICT vect2) BMNOEXCEPT
 GAP bitcount SUB (AND NOT) operation test. More...
 
void bm::bit_block_copy (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 Bitblock copy operation. More...
 
void bm::bit_block_copy_unalign (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 Bitblock copy operation (unaligned src) More...
 
void bm::bit_block_stream (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 Bitblock copy/stream operation. More...
 
void bm::bit_block_stream_unalign (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 Bitblock copy/stream operation (unaligned src) More...
 
bm::id64_t bm::bit_block_and (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 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 *BMRESTRICT dst, const bm::word_t *BMRESTRICT src, bm::id64_t digest) BMNOEXCEPT
 digest based bit-block AND More...
 
bm::id64_t bm::bit_block_and_5way (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src0, const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2, const bm::word_t *BMRESTRICT src3, bm::id64_t digest) BMNOEXCEPT
 digest based bit-block AND 5-way More...
 
bm::id64_t bm::bit_block_and_2way (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2, bm::id64_t digest) BMNOEXCEPT
 digest based bit-block AND More...
 
bm::id64_t bm::bit_block_and_or_2way (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2, bm::id64_t digest) BMNOEXCEPT
 digest based bit-block AND - OR More...
 
unsigned bm::bit_block_and_count (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 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) BMNOEXCEPT
 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 *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 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 *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 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 *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 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 *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 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) BMNOEXCEPT
 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 *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 Function ORs two bitblocks and and tests for any bit. Function does not analyse availability of source blocks. More...
 
bm::word_tbm::bit_operation_and (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 bitblock AND operation. More...
 
bm::id_t bm::bit_operation_and_count (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 Performs bitblock AND operation and calculates bitcount of the result. More...
 
bm::id_t bm::bit_operation_and_any (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 Performs bitblock AND operation test. More...
 
bm::id_t bm::bit_operation_sub_count (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 Performs bitblock SUB operation and calculates bitcount of the result. More...
 
bm::id_t bm::bit_operation_sub_count_inv (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 Performs inverted bitblock SUB operation and calculates bitcount of the result. More...
 
bm::id_t bm::bit_operation_sub_any (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 Performs bitblock test of SUB operation. More...
 
bm::id_t bm::bit_operation_or_count (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 Performs bitblock OR operation and calculates bitcount of the result. More...
 
bm::id_t bm::bit_operation_or_any (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 Performs bitblock OR operation test. More...
 
bool bm::bit_block_or (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 Plain bitblock OR operation. Function does not analyse availability of source and destination blocks. More...
 
bool bm::bit_block_or_2way (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 2 way (target := source1 | source2) bitblock OR operation. More...
 
bm::id64_t bm::bit_block_xor_2way (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 2 way (target := source1 ^ source2) bitblock XOR operation. More...
 
bool bm::bit_block_or_3way (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 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 *BMRESTRICT dst, const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2, const bm::word_t *BMRESTRICT src3, const bm::word_t *BMRESTRICT src4) BMNOEXCEPT
 5 way (target, source1, source2) bitblock OR operation. Function does not analyse availability of source and destination blocks. More...
 
bm::word_tbm::bit_operation_or (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 Block OR operation. Makes analysis if block is 0 or FULL. More...
 
bm::id64_t bm::bit_block_sub (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 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 *BMRESTRICT dst, const bm::word_t *BMRESTRICT src, bm::id64_t digest) BMNOEXCEPT
 digest based bitblock SUB (AND NOT) operation More...
 
bm::id64_t bm::bit_block_sub_2way (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2, bm::id64_t digest) BMNOEXCEPT
 digest based bitblock SUB (AND NOT) operation (3 operand) More...
 
bm::word_tbm::bit_operation_sub (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 bitblock SUB operation. More...
 
bm::id64_t bm::bit_block_xor (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 Plain bitblock XOR operation. Function does not analyse availability of source and destination blocks. More...
 
void bm::bit_andnot_arr_ffmask (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 bitblock AND NOT with constant ~0 mask operation. More...
 
bm::word_tbm::bit_operation_xor (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src) BMNOEXCEPT
 bitblock XOR operation. More...
 
bm::id_t bm::bit_operation_xor_count (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 Performs bitblock XOR operation and calculates bitcount of the result. More...
 
bm::id_t bm::bit_operation_xor_any (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src2) BMNOEXCEPT
 Performs bitblock XOR operation test. More...
 
template<class T >
unsigned bm::bit_count_nonzero_size (const T *blk, unsigned data_size) BMNOEXCEPT
 Inspects block for full zero words. More...
 
unsigned bm::bit_block_find (const bm::word_t *BMRESTRICT block, unsigned nbit, unsigned *BMRESTRICT pos) BMNOEXCEPT
 Searches for the next 1 bit in the BIT block. More...
 
unsigned bm::bit_find_last (const bm::word_t *BMRESTRICT block, unsigned *BMRESTRICT last) BMNOEXCEPT
 BIT block find the last set bit (backward search) More...
 
bool bm::bit_find_first (const bm::word_t *BMRESTRICT block, unsigned *BMRESTRICT pos) BMNOEXCEPT
 BIT block find the first set bit. More...
 
unsigned bm::bit_find_first (const bm::word_t *BMRESTRICT block, unsigned *BMRESTRICT first, bm::id64_t digest) BMNOEXCEPT
 BIT block find the first set bit. More...
 
bool bm::bit_find_first_if_1 (const bm::word_t *BMRESTRICT block, unsigned *BMRESTRICT first, bm::id64_t digest) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 Choose best representation for a bit-block. More...
 
template<typename T >
unsigned bm::bit_block_convert_to_arr (T *BMRESTRICT dest, const unsigned *BMRESTRICT src, bool inverted) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 Finds optimal gap blocks lengths. More...
 
bool bm::block_find_first_diff (const bm::word_t *BMRESTRICT blk, const bm::word_t *BMRESTRICT arg_blk, unsigned *BMRESTRICT pos) BMNOEXCEPT
 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) BMNOEXCEPT
  More...
 
unsigned short bm::bitscan_wave (const bm::word_t *BMRESTRICT w_ptr, unsigned char *BMRESTRICT bits) BMNOEXCEPT
 Unpacks word wave (Nx 32-bit words) More...
 
void bm::bit_block_gather_scatter (unsigned *BMRESTRICT arr, const bm::word_t *BMRESTRICT blk, const unsigned *BMRESTRICT idx, unsigned size, unsigned start, unsigned bit_idx) BMNOEXCEPT
 bit index to word gather-scatter algorithm (SIMD) More...
 
template<typename TRGW , typename IDX , typename SZ >
void bm::bit_block_gather_scatter (TRGW *BMRESTRICT arr, const bm::word_t *BMRESTRICT blk, const IDX *BMRESTRICT idx, SZ size, SZ start, unsigned bit_idx) BMNOEXCEPT
 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) BMNOEXCEPT
 block boundaries look ahead U32 More...
 
unsigned bm::idx_arr_block_lookup_u32 (const unsigned *idx, unsigned size, unsigned nb, unsigned start) BMNOEXCEPT
 block boundaries look ahead U32 More...
 
void bm::set_block_bits_u64 (bm::word_t *BMRESTRICT block, const bm::id64_t *BMRESTRICT idx, bm::id64_t start, bm::id64_t stop) BMNOEXCEPT
 set bits in a bit-block using global index More...
 
void bm::set_block_bits_u32 (bm::word_t *BMRESTRICT block, const unsigned *BMRESTRICT idx, unsigned start, unsigned stop) BMNOEXCEPT
 set bits in a bit-block using global index More...
 
bool bm::block_ptr_array_range (bm::word_t **arr, unsigned &left, unsigned &right) BMNOEXCEPT
 array range detector More...
 
unsigned bm::lower_bound_linear_u32 (const unsigned *arr, unsigned target, unsigned from, unsigned to) BMNOEXCEPT
 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) BMNOEXCEPT
 Linear lower bound search in unsigned LONG array. More...
 
unsigned bm::lower_bound_u32 (const unsigned *arr, unsigned target, unsigned from, unsigned to) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 Scan search for pointer value in unordered array. More...
 
bm::id_t bm::block_to_global_index (unsigned i, unsigned j, unsigned block_idx) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 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) BMNOEXCEPT
 Find max non-zero value in an array. More...
 
template<typename VT , typename SZ >
SZ bm::count_nz (const VT *arr, SZ arr_size) BMNOEXCEPT
 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) BMNOEXCEPT
 Detect best representation for serialization for a block or sub-block. More...
 
void bm::set_nibble (unsigned char *arr, unsigned idx, unsigned char v) BMNOEXCEPT
 set nibble in the array More...
 
unsigned char bm::get_nibble (const unsigned char *arr, unsigned idx) BMNOEXCEPT
 get nibble from the array More...
 
bm::id64_t bm::ptrp_test (ptr_payload_t ptr, bm::gap_word_t v) BMNOEXCEPT
  More...
 

Variables

const unsigned short bm::set_bitscan_wave_size = 4
 Size of bit decode wave in words. More...
 

Detailed Description

Bit manipulation primitives (internal)

Definition in file bmfunc.h.