BIT functions
[BitMagic C++ Library]

Collaboration diagram for BIT functions:


Detailed Description

Bit functions implement different opereations on bit blocks and serve as a minimal building blocks.


Classes

struct  bm::first_bit_table< T >
 Structure keeps index of first right 1 bit for every byte. More...
struct  bm::bit_count_table< T >
 Structure to aid in counting bits table contains count of bits in 0-255 diapason of numbers. More...
struct  bm::block_set_table< T >
 Structure keeps all-left/right ON bits masks. More...
struct  bm::all_set< T >
 Structure carries pointer on bit block with all bits 1. More...

Defines

#define BM_INCWORD_BITCOUNT(cnt, w)

Functions

bm::id_t bm::word_bitcount (bm::id_t w)
template<typename T>
int bm::wordcmp0 (T w1, T w2)
 Lexicographical comparison of two words as bit strings. Auxiliary implementation for testing and reference purposes.
template<typename T>
int bm::wordcmp (T a, T b)
 Lexicographical comparison of two words as bit strings. Auxiliary implementation for testing and reference purposes.
void bm::set_bit (unsigned *dest, unsigned bitpos)
 Set 1 bit in a block.
unsigned bm::test_bit (const unsigned *block, unsigned bitpos)
 Test 1 bit in a block.
void bm::or_bit_block (unsigned *dest, unsigned bitpos, unsigned bitcount)
 Sets bits to 1 in the bitblock.
void bm::sub_bit_block (unsigned *dest, unsigned bitpos, unsigned bitcount)
 SUB (AND NOT) bit interval to 1 in the bitblock.
void bm::xor_bit_block (unsigned *dest, unsigned bitpos, unsigned bitcount)
 XOR bit interval to 1 in the bitblock.
template<typename T>
bm::id_t bm::gap_bitset_and_count (const unsigned *block, const T *buf)
 Compute bitcount of bit block AND masked by GAP block.
template<typename T>
bm::id_t bm::gap_bitset_and_any (const unsigned *block, const T *buf)
 Bitcount test of bit block AND masked by GAP block.
template<typename T>
bm::id_t bm::gap_bitset_sub_count (const unsigned *block, const T *buf)
 Compute bitcount of bit block SUB masked by GAP block.
template<typename T>
bm::id_t bm::gap_bitset_sub_any (const unsigned *block, const T *buf)
 Compute bitcount test of bit block SUB masked by GAP block.
template<typename T>
bm::id_t bm::gap_bitset_xor_count (const unsigned *block, const T *buf)
 Compute bitcount of bit block XOR masked by GAP block.
template<typename T>
bm::id_t bm::gap_bitset_xor_any (const unsigned *block, const T *buf)
 Compute bitcount test of bit block XOR masked by GAP block.
template<typename T>
bm::id_t bm::gap_bitset_or_count (const unsigned *block, const T *buf)
 Compute bitcount of bit block OR masked by GAP block.
template<typename T>
bm::id_t bm::gap_bitset_or_any (const unsigned *block, const T *buf)
 Compute bitcount test of bit block OR masked by GAP block.
void bm::bit_block_set (bm::word_t *dst, bm::word_t value)
 Bitblock memset operation.
template<typename T>
int bm::bitcmp (const T *buf1, const T *buf2, unsigned len)
 Lexicographical comparison of BIT buffers.
bm::id_t bm::bit_block_calc_count (const bm::word_t *block, const bm::word_t *block_end)
 Bitcount for bit string.
bm::id_t bm::bit_count_change (bm::word_t w)
bm::id_t bm::bit_block_calc_count_change (const bm::word_t *block, const bm::word_t *block_end, unsigned *bit_count)
bm::id_t bm::bit_block_calc_count_range (const bm::word_t *block, bm::word_t left, bm::word_t right)
bm::id_t bm::bit_block_any_range (const bm::word_t *block, bm::word_t left, bm::word_t right)
template<typename T>
void bm::bit_invert (T *start, T *end)
bool bm::is_bits_one (const bm::wordop_t *start, const bm::wordop_t *end)
 Returns "true" if all bits in the block are 1.
bool bm::bit_is_all_zero (const bm::wordop_t *start, const bm::wordop_t *end)
 Returns "true" if all bits in the block are 0.
void bm::bit_block_copy (bm::word_t *dst, const bm::word_t *src)
 Bitblock copy operation.
void bm::bit_block_and (bm::word_t *dst, const bm::word_t *src)
 Plain bitblock AND operation. Function does not analyse availability of source and destination blocks.
unsigned bm::bit_block_and_count (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Function ANDs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks.
unsigned bm::bit_block_and_any (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Function ANDs two bitblocks and tests for any bit. Function does not analyse availability of source blocks.
unsigned bm::bit_block_xor_count (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Function XORs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks.
unsigned bm::bit_block_xor_any (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Function XORs two bitblocks and and tests for any bit. Function does not analyse availability of source blocks.
unsigned bm::bit_block_sub_count (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Function SUBs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks.
unsigned bm::bit_block_sub_any (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Function SUBs two bitblocks and and tests for any bit. Function does not analyse availability of source blocks.
unsigned bm::bit_block_or_count (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Function ORs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks.
unsigned bm::bit_block_or_any (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Function ORs two bitblocks and and tests for any bit. Function does not analyse availability of source blocks.
bm::word_tbm::bit_operation_and (bm::word_t *dst, const bm::word_t *src)
 bitblock AND operation.
bm::id_t bm::bit_operation_and_count (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Performs bitblock AND operation and calculates bitcount of the result.
bm::id_t bm::bit_operation_and_any (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Performs bitblock AND operation test.
bm::id_t bm::bit_operation_sub_count (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Performs bitblock SUB operation and calculates bitcount of the result.
bm::id_t bm::bit_operation_sub_count_inv (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Performs inverted bitblock SUB operation and calculates bitcount of the result.
bm::id_t bm::bit_operation_sub_any (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Performs bitblock test of SUB operation.
bm::id_t bm::bit_operation_or_count (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Performs bitblock OR operation and calculates bitcount of the result.
bm::id_t bm::bit_operation_or_any (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Performs bitblock OR operation test.
void bm::bit_block_or (bm::word_t *dst, const bm::word_t *src)
 Plain bitblock OR operation. Function does not analyse availability of source and destination blocks.
bm::word_tbm::bit_operation_or (bm::word_t *dst, const bm::word_t *src)
 Block OR operation. Makes analysis if block is 0 or FULL.
void bm::bit_block_sub (bm::word_t *dst, const bm::word_t *src)
 Plain bitblock SUB (AND NOT) operation. Function does not analyse availability of source and destination blocks.
bm::word_tbm::bit_operation_sub (bm::word_t *dst, const bm::word_t *src)
 bitblock SUB operation.
void bm::bit_block_xor (bm::word_t *dst, const bm::word_t *src)
 Plain bitblock XOR operation. Function does not analyse availability of source and destination blocks.
bm::word_tbm::bit_operation_xor (bm::word_t *dst, const bm::word_t *src)
 bitblock XOR operation.
bm::id_t bm::bit_operation_xor_count (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Performs bitblock XOR operation and calculates bitcount of the result.
bm::id_t bm::bit_operation_xor_any (const bm::word_t *src1, const bm::word_t *src1_end, const bm::word_t *src2)
 Performs bitblock XOR operation test.
template<class T>
unsigned bm::bit_count_nonzero_size (const T *blk, unsigned data_size)
 Inspects block for full zero words.
int bm::bit_find_in_block (const bm::word_t *data, unsigned nbit, bm::id_t *prev)
 Searches for the next 1 bit in the BIT block.
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.
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.
template<typename T, typename B>
unsigned bm::bit_list_4 (T w, B *bits)
 Unpacks word into list of ON bit indexes (quad-bit based).
template<typename T, typename B>
unsigned bm::bit_list (T w, B *bits)
 Unpacks word into list of ON bit indexes.
template<typename T>
bm::bit_convert_to_arr (T *dest, const unsigned *src, bm::id_t bits, unsigned dest_len, unsigned mask=0)
 Convert bit block into an array of ints corresponding to 1 bits.
template<typename T, unsigned BPC, unsigned BPS>
void bm::tmatrix_distance (const T tmatrix[BPC][BPS], unsigned distance[BPC][BPC])
 Compute pairwise Row x Row Humming distances on plains(rows) of the transposed bit block.
template<typename T, unsigned BPC, unsigned BPS>
void bm::bit_iblock_make_pcv (const unsigned distance[BPC][BPC], unsigned char *pc_vector)
 !< ibpc limiter Make a compression descriptor vector for bit-plains


Define Documentation

#define BM_INCWORD_BITCOUNT cnt,
 ) 
 

Value:

cnt += \
     bm::bit_count_table<true>::_count[(unsigned char)(w)] + \
     bm::bit_count_table<true>::_count[(unsigned char)((w) >> 8)] + \
     bm::bit_count_table<true>::_count[(unsigned char)((w) >> 16)] + \
     bm::bit_count_table<true>::_count[(unsigned char)((w) >> 24)];
Define calculates number of 1 bits in 32-bit word.

Definition at line 169 of file bmdef.h.

Referenced by bm::bit_block_and_count(), bm::bit_block_calc_count(), bm::bit_block_calc_count_range(), bm::bit_block_or_count(), bm::bit_block_sub_count(), bm::bit_block_xor_count(), bm::bit_count_change(), bm::bit_COUNT_B< W >::operator()(), bm::bit_COUNT_A< W >::operator()(), bm::bit_COUNT_SUB_BA< W >::operator()(), bm::bit_COUNT_SUB_AB< W >::operator()(), bm::bit_COUNT_OR< W >::operator()(), bm::bit_COUNT_XOR< W >::operator()(), bm::bit_COUNT_AND< W >::operator()(), bm::bit_COUNT< W >::operator()(), bm::sse2_bit_block_calc_count_change(), and bm::tmatrix_distance().


Function Documentation

void bm::bit_block_and bm::word_t dst,
const bm::word_t src
[inline]
 

Plain bitblock AND operation. Function does not analyse availability of source and destination blocks.

Parameters:
dst - destination block.
src - source block.

Definition at line 3103 of file bmfunc.h.

References bm::set_block_size, and VECT_AND_ARR.

Referenced by bm::bit_operation_and().

unsigned bm::bit_block_and_any const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Function ANDs two bitblocks and tests for any bit. Function does not analyse availability of source blocks.

Parameters:
src1 - first bit block
src1_end - first bit block end
src2 - second bit block

Definition at line 3172 of file bmfunc.h.

Referenced by bm::bit_operation_and_any().

unsigned bm::bit_block_and_count const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Function ANDs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks.

Parameters:
src1 - first bit block
src1_end - first bit block end
src2 - second bit block

Definition at line 3137 of file bmfunc.h.

References BM_INCWORD_BITCOUNT, and VECT_BITCOUNT_AND.

Referenced by bm::bit_operation_and_count().

bm::id_t bm::bit_block_any_range const bm::word_t block,
bm::word_t  left,
bm::word_t  right
[inline]
 

Function calculates if there is any number of 1 bits in the given array of words in the range between left anf right bits (borders included). Make sure the addresses are aligned.

Definition at line 2756 of file bmfunc.h.

References BM_ASSERT, mask, bm::set_word_mask, and bm::set_word_shift.

Referenced by bm::gap_bitset_and_any(), bm::gap_bitset_or_any(), bm::gap_bitset_sub_any(), and bm::gap_bitset_xor_any().

bm::id_t bm::bit_block_calc_count const bm::word_t block,
const bm::word_t block_end
[inline]
 

Bitcount for bit string.

Function calculates number of 1 bits in the given array of words. Make sure the addresses are aligned.

Definition at line 2470 of file bmfunc.h.

References BM_ASSERT, and BM_INCWORD_BITCOUNT.

Referenced by bm::bit_operation_or_count(), bm::bit_operation_sub_count(), bm::bit_operation_xor_count(), bm::blocks_manager< Alloc, MS >::block_bitcount(), bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_A(), and bm::tmatrix_distance().

bm::id_t bm::bit_block_calc_count_change const bm::word_t block,
const bm::word_t block_end,
unsigned *  bit_count
[inline]
 

Function calculates number of times when bit value changed (1-0 or 0-1) in the bit block. Also calulates number of bits ON.

Parameters:
bit_count - OUT total number of bits ON
Returns:
number of 1-0, 0-1 transitions

Definition at line 2569 of file bmfunc.h.

References BM_ASSERT, bm::sse2_bit_block_calc_count_change(), and bm::sse4_bit_block_calc_count_change().

Referenced by bm::blocks_manager< Alloc, MS >::block_count_change_func::block_count().

bm::id_t bm::bit_block_calc_count_range const bm::word_t block,
bm::word_t  left,
bm::word_t  right
[inline]
 

Function calculates number of 1 bits in the given array of words in the range between left anf right bits (borders included) Make sure the addresses are aligned.

Definition at line 2687 of file bmfunc.h.

References BM_ASSERT, BM_INCWORD_BITCOUNT, mask, bm::set_word_mask, and bm::set_word_shift.

Referenced by bm::bvector< Alloc, MS >::count_range(), bm::gap_bitset_and_count(), bm::gap_bitset_or_count(), bm::gap_bitset_sub_count(), and bm::gap_bitset_xor_count().

void bm::bit_block_copy bm::word_t dst,
const bm::word_t src
[inline]
 

Bitblock copy operation.

Parameters:
dst - destination block.
src - source block.

Definition at line 3083 of file bmfunc.h.

References bm::set_block_size, and VECT_COPY_BLOCK.

Referenced by bm::blocks_manager< Alloc, MS >::deoptimize_block(), and bm::blocks_manager< Alloc, MS >::block_copy_func::operator()().

void bm::bit_block_or bm::word_t dst,
const bm::word_t src
[inline]
 

Plain bitblock OR operation. Function does not analyse availability of source and destination blocks.

Parameters:
dst - destination block.
src - source block.

Definition at line 3657 of file bmfunc.h.

References bm::set_block_size, and VECT_OR_ARR.

Referenced by bm::bit_operation_or().

unsigned bm::bit_block_or_any const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Function ORs two bitblocks and and tests for any bit. Function does not analyse availability of source blocks.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block.

Definition at line 3367 of file bmfunc.h.

Referenced by bm::bit_operation_or_any().

unsigned bm::bit_block_or_count const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Function ORs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks.

Parameters:
src1 - first bit block
src1_end - first block end
src2 - second bit block.

Definition at line 3333 of file bmfunc.h.

References BM_INCWORD_BITCOUNT, and VECT_BITCOUNT_OR.

Referenced by bm::bit_operation_or_count().

void bm::bit_block_set bm::word_t dst,
bm::word_t  value
[inline]
 

Bitblock memset operation.

Parameters:
dst - destination block.
value - value to set.

Definition at line 1885 of file bmfunc.h.

References bm::set_block_size.

Referenced by bm::blocks_manager< Alloc, MS >::check_allocate_block(), bm::gap_convert_to_bitset(), bm::serial_stream_iterator< DEC >::get_arr_bit(), bm::serial_stream_iterator< DEC >::get_bit_block_ASSIGN(), bm::blocks_manager< Alloc, MS >::make_bit_block(), and bm::blocks_manager< Alloc, MS >::block_zero_func::operator()().

void bm::bit_block_sub bm::word_t dst,
const bm::word_t src
[inline]
 

Plain bitblock SUB (AND NOT) operation. Function does not analyse availability of source and destination blocks.

Parameters:
dst - destination block.
src - source block.

Definition at line 3753 of file bmfunc.h.

References bm::set_block_size, and VECT_SUB_ARR.

Referenced by bm::bit_operation_sub().

unsigned bm::bit_block_sub_any const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Function SUBs two bitblocks and and tests for any bit. Function does not analyse availability of source blocks.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block.

Definition at line 3303 of file bmfunc.h.

Referenced by bm::bit_operation_sub_any().

unsigned bm::bit_block_sub_count const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Function SUBs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block.

Definition at line 3269 of file bmfunc.h.

References BM_INCWORD_BITCOUNT, and VECT_BITCOUNT_SUB.

Referenced by bm::bit_operation_sub_count().

void bm::bit_block_xor bm::word_t dst,
const bm::word_t src
[inline]
 

Plain bitblock XOR operation. Function does not analyse availability of source and destination blocks.

Parameters:
dst - destination block.
src - source block.

Definition at line 3849 of file bmfunc.h.

References bm::set_block_size, and VECT_XOR_ARR.

Referenced by bm::bit_operation_xor().

unsigned bm::bit_block_xor_any const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Function XORs two bitblocks and and tests for any bit. Function does not analyse availability of source blocks.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block.

Definition at line 3238 of file bmfunc.h.

Referenced by bm::bit_operation_xor_any().

unsigned bm::bit_block_xor_count const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Function XORs two bitblocks and computes the bitcount. Function does not analyse availability of source blocks.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block.

Definition at line 3203 of file bmfunc.h.

References BM_INCWORD_BITCOUNT, and VECT_BITCOUNT_XOR.

Referenced by bm::bit_operation_xor_count().

template<typename T>
T bm::bit_convert_to_arr T *  dest,
const unsigned *  src,
bm::id_t  bits,
unsigned  dest_len,
unsigned  mask = 0
 

Convert bit block into an array of ints corresponding to 1 bits.

Definition at line 4323 of file bmfunc.h.

References mask.

bm::id_t bm::bit_count_change bm::word_t  w  )  [inline]
 

Function calculates number of times when bit value changed (1-0 or 0-1).

For 001 result is 2 010 - 3 011 - 2 111 - 1

Definition at line 2546 of file bmfunc.h.

References BM_INCWORD_BITCOUNT.

Referenced by BitCountChangeTest().

template<class T>
unsigned bm::bit_count_nonzero_size const T *  blk,
unsigned  data_size
 

Inspects block for full zero words.

Parameters:
data - bit block pointer
data_size - data size
Returns:
size of all non-zero words

Definition at line 3981 of file bmfunc.h.

References BM_ASSERT.

int bm::bit_find_in_block const bm::word_t data,
unsigned  nbit,
bm::id_t prev
[inline]
 

Searches for the next 1 bit in the BIT block.

Parameters:
data - BIT buffer
nbit - bit index to start checking from
prev - returns previously checked value

Definition at line 4059 of file bmfunc.h.

References bm::set_block_size, bm::set_word_mask, and bm::set_word_shift.

template<typename T, typename F>
void bm::bit_for_each w,
F &  func
 

Templated algorithm to unpacks word into list of ON bit indexes.

Parameters:
w - value
func - bit functor

Definition at line 4173 of file bmfunc.h.

Referenced by bm::bit_list().

template<typename T, typename F>
void bm::bit_for_each_4 w,
F &  func
 

Templated algorithm to unpacks octet based word into list of ON bit indexes.

Parameters:
w - value
func - bit functor

Definition at line 4103 of file bmfunc.h.

References BM_ASSERT.

Referenced by bm::bit_list_4().

template<typename T, unsigned BPC, unsigned BPS>
void bm::bit_iblock_make_pcv const unsigned  distance[BPC][BPC],
unsigned char *  pc_vector
 

!< ibpc limiter Make a compression descriptor vector for bit-plains

Parameters:
distance - pairwise distance matrix
pc_vector - OUT compression descriptor vector
        pc_vector[] format:
            each element (pc_vector[i]) describes the plain compression:
                first 3 bits - compression code:
                    0 - plain uncompressed
                    1 - plain is ALL ZERO (000000...)
                    2 - plain is ALL ONE  (111111...)
                    3 - plain is equal to another plain J (5 high bits (max 31))
                    4 - plain is close (but not equal) to plain J
                next 5 bits - number of plain used as a XOR expression
                 ( compression codes: 3,4 )
    

Definition at line 405 of file bmtrans.h.

References BM_ASSERT, bm::ibpc_all_one, bm::ibpc_all_zero, and bm::ibpc_uncompr.

template<typename T>
void bm::bit_invert T *  start,
T *  end
 

Function inverts block of bits

Definition at line 2821 of file bmfunc.h.

References VECT_INVERT_ARR.

Referenced by bm::blocks_manager< Alloc, MS >::block_invert_func::operator()().

bool bm::bit_is_all_zero const bm::wordop_t start,
const bm::wordop_t end
[inline]
 

Returns "true" if all bits in the block are 0.

Definition at line 2863 of file bmfunc.h.

Referenced by bm::bit_operation_or_any(), bm::bit_operation_sub_any(), bm::bit_operation_xor_any(), bm::blocks_manager< Alloc, MS >::block_opt_func::operator()(), and bm::blocks_manager< Alloc, MS >::block_any_func::operator()().

template<typename T, typename B>
unsigned bm::bit_list w,
B *  bits
 

Unpacks word into list of ON bit indexes.

Parameters:
w - value
bits - pointer on the result array
Returns:
number of bits in the list

Definition at line 4311 of file bmfunc.h.

References bm::bit_for_each(), and bm::copy_to_array_functor< B >::ptr().

template<typename T, typename B>
unsigned bm::bit_list_4 w,
B *  bits
 

Unpacks word into list of ON bit indexes (quad-bit based).

Parameters:
w - value
bits - pointer on the result array
Returns:
number of bits in the list

Definition at line 4296 of file bmfunc.h.

References bm::bit_for_each_4(), and bm::copy_to_array_functor< B >::ptr().

Referenced by bm::bvector< Alloc, MS >::enumerator::go_up(), and bm::bvector< Alloc, MS >::enumerator::search_in_bitblock().

bm::word_t* bm::bit_operation_and bm::word_t dst,
const bm::word_t src
[inline]
 

bitblock AND operation.

Parameters:
dst - destination block.
src - source block.
Returns:
pointer on destination block. If returned value equal to src means that block mutation requested. NULL is valid return value.

Definition at line 3399 of file bmfunc.h.

References bm::bit_block_and(), BM_ASSERT, IS_EMPTY_BLOCK, IS_FULL_BLOCK, and IS_VALID_ADDR.

bm::id_t bm::bit_operation_and_any const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Performs bitblock AND operation test.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block.
Returns:
non zero if there is any value

Definition at line 3487 of file bmfunc.h.

References bm::bit_block_and_any(), and IS_EMPTY_BLOCK.

bm::id_t bm::bit_operation_and_count const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Performs bitblock AND operation and calculates bitcount of the result.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block.
Returns:
bitcount value

Definition at line 3464 of file bmfunc.h.

References bm::bit_block_and_count(), and IS_EMPTY_BLOCK.

bm::word_t* bm::bit_operation_or bm::word_t dst,
const bm::word_t src
[inline]
 

Block OR operation. Makes analysis if block is 0 or FULL.

Parameters:
dst - destination block.
src - source block.
Returns:
pointer on destination block. If returned value equal to src means that block mutation requested. NULL is valid return value.

Definition at line 3695 of file bmfunc.h.

References bm::bit_block_or(), BM_ASSERT, FULL_BLOCK_ADDR, IS_FULL_BLOCK, IS_VALID_ADDR, and bm::set_block_size.

bm::id_t bm::bit_operation_or_any const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Performs bitblock OR operation test.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block.
Returns:
non zero value if there are any bits

Definition at line 3625 of file bmfunc.h.

References bm::bit_block_or_any(), bm::bit_is_all_zero(), and IS_EMPTY_BLOCK.

bm::id_t bm::bit_operation_or_count const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Performs bitblock OR operation and calculates bitcount of the result.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block.
Returns:
bitcount value

Definition at line 3593 of file bmfunc.h.

References bm::bit_block_calc_count(), bm::bit_block_or_count(), and IS_EMPTY_BLOCK.

bm::word_t* bm::bit_operation_sub bm::word_t dst,
const bm::word_t src
[inline]
 

bitblock SUB operation.

Parameters:
dst - destination block.
src - source block.
Returns:
pointer on destination block. If returned value equal to src means that block mutation requested. NULL is valid return value.

Definition at line 3793 of file bmfunc.h.

References bm::bit_block_sub(), BM_ASSERT, IS_FULL_BLOCK, and IS_VALID_ADDR.

bm::id_t bm::bit_operation_sub_any const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Performs bitblock test of SUB operation.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block
Returns:
non zero value if there are any bits

Definition at line 3563 of file bmfunc.h.

References bm::bit_block_sub_any(), bm::bit_is_all_zero(), and IS_EMPTY_BLOCK.

bm::id_t bm::bit_operation_sub_count const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Performs bitblock SUB operation and calculates bitcount of the result.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block
Returns:
bitcount value

Definition at line 3512 of file bmfunc.h.

References bm::bit_block_calc_count(), bm::bit_block_sub_count(), and IS_EMPTY_BLOCK.

Referenced by bm::bit_operation_sub_count_inv().

bm::id_t bm::bit_operation_sub_count_inv const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Performs inverted bitblock SUB operation and calculates bitcount of the result.

Parameters:
src1 - first bit block.
src1_end - first bit block end
src2 - second bit block
Returns:
bitcount value

Definition at line 3542 of file bmfunc.h.

References bm::bit_operation_sub_count().

bm::word_t* bm::bit_operation_xor bm::word_t dst,
const bm::word_t src
[inline]
 

bitblock XOR operation.

Parameters:
dst - destination block.
src - source block.
Returns:
pointer on destination block. If returned value equal to src means that block mutation requested. NULL is valid return value.

Definition at line 3889 of file bmfunc.h.

References bm::bit_block_xor(), BM_ASSERT, and IS_VALID_ADDR.

bm::id_t bm::bit_operation_xor_any const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Performs bitblock XOR operation test.

Parameters:
src1 - first bit block.
src2 - second bit block.
Returns:
non zero value if there are bits

Definition at line 3952 of file bmfunc.h.

References bm::bit_block_xor_any(), bm::bit_is_all_zero(), and IS_EMPTY_BLOCK.

bm::id_t bm::bit_operation_xor_count const bm::word_t src1,
const bm::word_t src1_end,
const bm::word_t src2
[inline]
 

Performs bitblock XOR operation and calculates bitcount of the result.

Parameters:
src1 - first bit block.
src2 - second bit block.
Returns:
bitcount value

Definition at line 3927 of file bmfunc.h.

References bm::bit_block_calc_count(), bm::bit_block_xor_count(), and IS_EMPTY_BLOCK.

template<typename T>
int bm::bitcmp const T *  buf1,
const T *  buf2,
unsigned  len
 

Lexicographical comparison of BIT buffers.

Parameters:
buf1 - First buffer pointer.
buf2 - Second buffer pointer.
len - Buffer length in elements (T).
Returns:
<0 - less, =0 - equal, >0 - greater.

Definition at line 2233 of file bmfunc.h.

References BM_ASSERT.

template<typename T>
bm::id_t bm::gap_bitset_and_any const unsigned *  block,
const T *  buf
 

Bitcount test of bit block AND masked by GAP block.

Parameters:
dest - bitblock buffer pointer.
buf - GAP buffer pointer.

Definition at line 1596 of file bmfunc.h.

References bm::bit_block_any_range(), and BM_ASSERT.

template<typename T>
bm::id_t bm::gap_bitset_and_count const unsigned *  block,
const T *  buf
 

Compute bitcount of bit block AND masked by GAP block.

Parameters:
dest - bitblock buffer pointer.
buf - GAP buffer pointer.

Definition at line 1560 of file bmfunc.h.

References bm::bit_block_calc_count_range(), and BM_ASSERT.

template<typename T>
bm::id_t bm::gap_bitset_or_any const unsigned *  block,
const T *  buf
 

Compute bitcount test of bit block OR masked by GAP block.

Parameters:
dest - bitblock buffer pointer.
buf - GAP buffer pointer.

Definition at line 1834 of file bmfunc.h.

References bm::bit_block_any_range(), and BM_ASSERT.

template<typename T>
bm::id_t bm::gap_bitset_or_count const unsigned *  block,
const T *  buf
 

Compute bitcount of bit block OR masked by GAP block.

Parameters:
dest - bitblock buffer pointer.
buf - GAP buffer pointer.

Definition at line 1787 of file bmfunc.h.

References bm::bit_block_calc_count_range(), and BM_ASSERT.

template<typename T>
bm::id_t bm::gap_bitset_sub_any const unsigned *  block,
const T *  buf
 

Compute bitcount test of bit block SUB masked by GAP block.

Parameters:
dest - bitblock buffer pointer.
buf - GAP buffer pointer.

Definition at line 1668 of file bmfunc.h.

References bm::bit_block_any_range(), and BM_ASSERT.

template<typename T>
bm::id_t bm::gap_bitset_sub_count const unsigned *  block,
const T *  buf
 

Compute bitcount of bit block SUB masked by GAP block.

Parameters:
dest - bitblock buffer pointer.
buf - GAP buffer pointer.

Definition at line 1635 of file bmfunc.h.

References bm::bit_block_calc_count_range(), and BM_ASSERT.

template<typename T>
bm::id_t bm::gap_bitset_xor_any const unsigned *  block,
const T *  buf
 

Compute bitcount test of bit block XOR masked by GAP block.

Parameters:
dest - bitblock buffer pointer.
buf - GAP buffer pointer.

Definition at line 1744 of file bmfunc.h.

References bm::bit_block_any_range(), and BM_ASSERT.

template<typename T>
bm::id_t bm::gap_bitset_xor_count const unsigned *  block,
const T *  buf
 

Compute bitcount of bit block XOR masked by GAP block.

Parameters:
dest - bitblock buffer pointer.
buf - GAP buffer pointer.

Definition at line 1706 of file bmfunc.h.

References bm::bit_block_calc_count_range(), and BM_ASSERT.

bool bm::is_bits_one const bm::wordop_t start,
const bm::wordop_t end
[inline]
 

Returns "true" if all bits in the block are 1.

Definition at line 2842 of file bmfunc.h.

References bm::all_bits_mask.

Referenced by bm::blocks_manager< Alloc, MS >::is_block_one(), and bm::blocks_manager< Alloc, MS >::block_opt_func::operator()().

void bm::or_bit_block unsigned *  dest,
unsigned  bitpos,
unsigned  bitcount
[inline]
 

Sets bits to 1 in the bitblock.

Parameters:
dest - Bitset buffer.
bitpos - Offset of the start bit.
bitcount - number of bits to set.

Definition at line 1245 of file bmfunc.h.

References mask, bm::set_block_mask, bm::set_word_mask, and bm::set_word_shift.

Referenced by bm::bvector< Alloc, MS >::combine_operation_with_block(), and bm::gap_add_to_bitset().

void bm::set_bit unsigned *  dest,
unsigned  bitpos
[inline]
 

Set 1 bit in a block.

Definition at line 1215 of file bmfunc.h.

References bm::set_block_mask, bm::set_word_mask, and bm::set_word_shift.

Referenced by CNcbi2naRandomizer::CNcbi2naRandomizer(), bm::serial_stream_iterator< DEC >::get_arr_bit(), bm::bvector< Alloc, MS >::set(), and set_start_bits().

void bm::sub_bit_block unsigned *  dest,
unsigned  bitpos,
unsigned  bitcount
[inline]
 

SUB (AND NOT) bit interval to 1 in the bitblock.

Parameters:
dest - Bitset buffer.
bitpos - Offset of the start bit.
bitcount - number of bits to set.

Definition at line 1307 of file bmfunc.h.

References mask, bm::set_block_mask, bm::set_word_mask, and bm::set_word_shift.

Referenced by bm::gap_and_to_bitset(), and bm::gap_sub_to_bitset().

unsigned bm::test_bit const unsigned *  block,
unsigned  bitpos
[inline]
 

Test 1 bit in a block.

Definition at line 1228 of file bmfunc.h.

References bm::set_block_mask, bm::set_word_mask, and bm::set_word_shift.

Referenced by bm::bvector< Alloc, MS >::combine_operation_with_block().

template<typename T, unsigned BPC, unsigned BPS>
void bm::tmatrix_distance const T  tmatrix[BPC][BPS],
unsigned  distance[BPC][BPC]
 

Compute pairwise Row x Row Humming distances on plains(rows) of the transposed bit block.

Parameters:
tmatrix - bit-block transposition matrix (bit-plains)
distance - pairwise NxN Humming distance matrix (diagonal is popcnt)

Definition at line 332 of file bmtrans.h.

References bm::bit_block_calc_count(), and BM_INCWORD_BITCOUNT.

bm::id_t bm::word_bitcount bm::id_t  w  )  [inline]
 

Returns bit count

Definition at line 165 of file bmfunc.h.

Referenced by bm::serial_stream_iterator< DEC >::get_bit_block_COUNT(), bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_AND(), bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_OR(), bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_SUB_AB(), bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_SUB_BA(), and bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_XOR().

template<typename T>
int bm::wordcmp a,
b
 

Lexicographical comparison of two words as bit strings. Auxiliary implementation for testing and reference purposes.

Parameters:
buf1 - First word.
buf2 - Second word.
Returns:
<0 - less, =0 - equal, >0 - greater.

Definition at line 336 of file bmfunc.h.

Referenced by WordCmpTest().

template<typename T>
int bm::wordcmp0 w1,
w2
 

Lexicographical comparison of two words as bit strings. Auxiliary implementation for testing and reference purposes.

Parameters:
buf1 - First word.
buf2 - Second word.
Returns:
<0 - less, =0 - equal, >0 - greater.

Definition at line 306 of file bmfunc.h.

Referenced by WordCmpTest().

void bm::xor_bit_block unsigned *  dest,
unsigned  bitpos,
unsigned  bitcount
[inline]
 

XOR bit interval to 1 in the bitblock.

Parameters:
dest - Bitset buffer.
bitpos - Offset of the start bit.
bitcount - number of bits to set.

Definition at line 1369 of file bmfunc.h.

References mask, bm::set_block_mask, bm::set_word_mask, and bm::set_word_shift.

Referenced by bm::gap_xor_to_bitset().


Generated on Mon Dec 7 16:05:28 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:24:37 2009 by modify_doxy.py rev. 173732