Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals | Examples

BIT functions
[BitMagic C++ Library]

Collaboration diagram for BIT functions:


Data Structures

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::first_bit_table< T >
 Structure keeps index of first ON bit for every byte. 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

BMFORCEINLINE bm::id_t bm::word_bitcount (bm::id_t w)
bm::id_t bm::word_bitcount64 (bm::id64_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::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 *BMRESTRICT 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.
template<typename T>
bm::bit_convert_to_arr (T *BMRESTRICT dest, const unsigned *BMRESTRICT src, bm::id_t bits, unsigned dest_len)
 Convert bit block into an array of ints corresponding to 1 bits.
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)
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 *BMRESTRICT dst, const bm::word_t *BMRESTRICT src)
 Bitblock copy operation.
void bm::bit_block_and (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT 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 *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT 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 *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT 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 *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT 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 *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT 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 *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT 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 *BMRESTRICT dst, const bm::word_t *BMRESTRICT src)
 bitblock AND operation.
bm::id_t bm::bit_operation_and_count (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT src2)
 Performs bitblock AND operation and calculates bitcount of the result.
bm::id_t bm::bit_operation_and_any (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT src2)
 Performs bitblock AND operation test.
bm::id_t bm::bit_operation_sub_count (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT src2)
 Performs bitblock SUB operation and calculates bitcount of the result.
bm::id_t bm::bit_operation_sub_count_inv (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT src2)
 Performs inverted bitblock SUB operation and calculates bitcount of the result.
bm::id_t bm::bit_operation_sub_any (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT src2)
 Performs bitblock test of SUB operation.
bm::id_t bm::bit_operation_or_count (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT src2)
 Performs bitblock OR operation and calculates bitcount of the result.
bm::id_t bm::bit_operation_or_any (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT src2)
 Performs bitblock OR operation test.
void bm::bit_block_or (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src)
 Plain bitblock OR operation. Function does not analyse availability of source and destination blocks.
bm::word_tbm::bit_operation_or (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src)
 Block OR operation. Makes analysis if block is 0 or FULL.
void bm::bit_block_sub (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT 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 *BMRESTRICT dst, const bm::word_t *BMRESTRICT src)
 bitblock SUB operation.
void bm::bit_block_xor (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src)
 Plain bitblock XOR operation. Function does not analyse availability of source and destination blocks.
bm::word_tbm::bit_operation_xor (bm::word_t *BMRESTRICT dst, const bm::word_t *BMRESTRICT src)
 bitblock XOR operation.
bm::id_t bm::bit_operation_xor_count (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT src2)
 Performs bitblock XOR operation and calculates bitcount of the result.
bm::id_t bm::bit_operation_xor_any (const bm::word_t *BMRESTRICT src1, const bm::word_t *BMRESTRICT src1_end, const bm::word_t *BMRESTRICT src2)
 Performs bitblock XOR operation test.
void bm::bit_find_head_tail (const bm::word_t *data, unsigned *head_idx, unsigned *tail_idx)
 Inspects bit block for zero words at the head and at the end.
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 B>
unsigned bm::bit_list (T w, B *bits)
 Unpacks word into list of ON bit indexes.

Detailed Description

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

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 209 of file bmfunc.h.

Referenced by bm::bit_block_and_count(), bm::bit_block_calc_count(), bm::bit_block_calc_count_change(), 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()(), and bm::bit_COUNT< W >::operator()().


Function Documentation

void bit_block_and bm::word_t *BMRESTRICT  dst,
const bm::word_t *BMRESTRICT  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 2960 of file bmfunc.h.

References BMRESTRICT, and VECT_AND_ARR.

Referenced by bm::bit_operation_and().

unsigned 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 3029 of file bmfunc.h.

Referenced by bm::bit_operation_and_any().

unsigned 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 2994 of file bmfunc.h.

References BM_INCWORD_BITCOUNT, and VECT_BITCOUNT_AND.

Referenced by bm::bit_operation_and_count().

bm::id_t 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 2622 of file bmfunc.h.

References BM_ASSERT.

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 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 2373 of file bmfunc.h.

References BM_ASSERT, BM_INCWORD_BITCOUNT, and bm::word_bitcount64().

Referenced by bm::bit_operation_or_count(), bm::bit_operation_sub_count(), bm::bit_operation_xor_count(), and bm::bvector< Alloc, MS >::stat().

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

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

Definition at line 2465 of file bmfunc.h.

References BM_ASSERT, BM_INCWORD_BITCOUNT, and bm::word_bitcount64().

bm::id_t 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 2553 of file bmfunc.h.

References BM_ASSERT, and BM_INCWORD_BITCOUNT.

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 bit_block_copy bm::word_t *BMRESTRICT  dst,
const bm::word_t *BMRESTRICT  src
[inline]
 

Bitblock copy operation.

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

Definition at line 2940 of file bmfunc.h.

References VECT_COPY_BLOCK.

void bit_block_or bm::word_t *BMRESTRICT  dst,
const bm::word_t *BMRESTRICT  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 3513 of file bmfunc.h.

References BMRESTRICT, and VECT_OR_ARR.

Referenced by bm::bit_operation_or().

unsigned bit_block_or_any const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3224 of file bmfunc.h.

Referenced by bm::bit_operation_or_any().

unsigned 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 3190 of file bmfunc.h.

References BM_INCWORD_BITCOUNT, and VECT_BITCOUNT_OR.

Referenced by bm::bit_operation_or_count().

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

Bitblock memset operation.

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

Definition at line 1790 of file bmfunc.h.

Referenced by bm::gap_convert_to_bitset().

void bit_block_sub bm::word_t *BMRESTRICT  dst,
const bm::word_t *BMRESTRICT  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 3609 of file bmfunc.h.

References BMRESTRICT, and VECT_SUB_ARR.

Referenced by bm::bit_operation_sub().

unsigned bit_block_sub_any const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3160 of file bmfunc.h.

Referenced by bm::bit_operation_sub_any().

unsigned bit_block_sub_count const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3126 of file bmfunc.h.

References BM_INCWORD_BITCOUNT, and VECT_BITCOUNT_SUB.

Referenced by bm::bit_operation_sub_count().

void bit_block_xor bm::word_t *BMRESTRICT  dst,
const bm::word_t *BMRESTRICT  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 3705 of file bmfunc.h.

References BMRESTRICT, and VECT_XOR_ARR.

Referenced by bm::bit_operation_xor().

unsigned bit_block_xor_any const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3095 of file bmfunc.h.

Referenced by bm::bit_operation_xor_any().

unsigned bit_block_xor_count const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3060 of file bmfunc.h.

References BM_INCWORD_BITCOUNT, and VECT_BITCOUNT_XOR.

Referenced by bm::bit_operation_xor_count().

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

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

Definition at line 2308 of file bmfunc.h.

References BMRESTRICT.

bm::id_t 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 2447 of file bmfunc.h.

References BM_INCWORD_BITCOUNT.

void bit_find_head_tail const bm::word_t data,
unsigned *  head_idx,
unsigned *  tail_idx
[inline]
 

Inspects bit block for zero words at the head and at the end.

If there are no head-tail zeroes output parameters head_idx and tail_idx are going to be [0, bm::set_block_size-1]. If block is all-zero head_idx is -1

Parameters:
data - bit block pointer
head_idx - index of first non-zero word in block
tail_idx - index of the last non-zero word in block

Definition at line 3837 of file bmfunc.h.

References BM_ASSERT.

int 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 3878 of file bmfunc.h.

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

Function inverts block of bits

Definition at line 2687 of file bmfunc.h.

References VECT_INVERT_ARR.

bool 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 2729 of file bmfunc.h.

Referenced by bm::bit_operation_or_any(), bm::bit_operation_sub_any(), bm::bit_operation_xor_any(), and bm::bvector< Alloc, MS >::compare().

template<typename T, typename B>
unsigned 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 3921 of file bmfunc.h.

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

bm::word_t* bit_operation_and bm::word_t *BMRESTRICT  dst,
const bm::word_t *BMRESTRICT  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 3256 of file bmfunc.h.

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

bm::id_t bit_operation_and_any const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3344 of file bmfunc.h.

References bm::bit_block_and_any(), and IS_EMPTY_BLOCK.

bm::id_t bit_operation_and_count const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3321 of file bmfunc.h.

References bm::bit_block_and_count(), and IS_EMPTY_BLOCK.

bm::word_t* bit_operation_or bm::word_t *BMRESTRICT  dst,
const bm::word_t *BMRESTRICT  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 3551 of file bmfunc.h.

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

bm::id_t bit_operation_or_any const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3482 of file bmfunc.h.

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

bm::id_t bit_operation_or_count const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3450 of file bmfunc.h.

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

bm::word_t* bit_operation_sub bm::word_t *BMRESTRICT  dst,
const bm::word_t *BMRESTRICT  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 3649 of file bmfunc.h.

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

bm::id_t bit_operation_sub_any const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3420 of file bmfunc.h.

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

bm::id_t bit_operation_sub_count const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3369 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 bit_operation_sub_count_inv const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3399 of file bmfunc.h.

References bm::bit_operation_sub_count().

bm::word_t* bit_operation_xor bm::word_t *BMRESTRICT  dst,
const bm::word_t *BMRESTRICT  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 3745 of file bmfunc.h.

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

bm::id_t bit_operation_xor_any const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3808 of file bmfunc.h.

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

bm::id_t bit_operation_xor_count const bm::word_t *BMRESTRICT  src1,
const bm::word_t *BMRESTRICT  src1_end,
const bm::word_t *BMRESTRICT  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 3783 of file bmfunc.h.

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

template<typename T>
int 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 2138 of file bmfunc.h.

References BM_ASSERT.

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

template<typename T>
bm::id_t 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 1500 of file bmfunc.h.

References bm::bit_block_any_range(), and BM_ASSERT.

template<typename T>
bm::id_t 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 1464 of file bmfunc.h.

References bm::bit_block_calc_count_range(), and BM_ASSERT.

template<typename T>
bm::id_t 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 1739 of file bmfunc.h.

References bm::bit_block_any_range(), and BM_ASSERT.

template<typename T>
bm::id_t 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 1692 of file bmfunc.h.

References bm::bit_block_calc_count_range(), and BM_ASSERT.

template<typename T>
bm::id_t 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 1572 of file bmfunc.h.

References bm::bit_block_any_range(), and BM_ASSERT.

template<typename T>
bm::id_t 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 1539 of file bmfunc.h.

References bm::bit_block_calc_count_range(), and BM_ASSERT.

template<typename T>
bm::id_t 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 1649 of file bmfunc.h.

References bm::bit_block_any_range(), and BM_ASSERT.

template<typename T>
bm::id_t 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 1610 of file bmfunc.h.

References bm::bit_block_calc_count_range(), and BM_ASSERT.

bool 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 2708 of file bmfunc.h.

void 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 1149 of file bmfunc.h.

Referenced by bm::gap_add_to_bitset().

void 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 1211 of file bmfunc.h.

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

BMFORCEINLINE bm::id_t word_bitcount bm::id_t  w  ) 
 

Returns bit count

Definition at line 220 of file bmfunc.h.

bm::id_t word_bitcount64 bm::id64_t  w  )  [inline]
 

Function calculates number of 1 bits in 64-bit word.

Definition at line 234 of file bmfunc.h.

Referenced by bm::bit_block_calc_count(), and bm::bit_block_calc_count_change().

template<typename T>
int 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 379 of file bmfunc.h.

template<typename T>
int 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 349 of file bmfunc.h.

void 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 1273 of file bmfunc.h.

Referenced by bm::gap_xor_to_bitset().


Generated on Sun Aug 5 14:12:36 2007 for BitMagic by  doxygen 1.4.1