Go to the source code of this file.
Defines |
#define | BITSINLONG 32 |
#define | zero_all_bits(array, length) |
#define | set_all_bits(array, length) |
#define | copy_all_bits(source, dest, length) |
#define | SET_BIT(array, bit) (array[bit/BITSINLONG]|=1<<(bit&(BITSINLONG-1))) |
#define | reset_bit(array, bit) (array[bit/BITSINLONG]&=~(1<<(bit&(BITSINLONG-1)))) |
#define | test_bit(array, bit) (array[bit/BITSINLONG] & (1<<(bit&(BITSINLONG-1)))) |
#define | WordsInVectorOfSize(NumBits) (((NumBits) + BITSINLONG - 1) / BITSINLONG) |
Typedefs |
typedef uinT32 * | BIT_VECTOR |
Functions |
BIT_VECTOR | ExpandBitVector (BIT_VECTOR Vector, int NewNumBits) |
void | FreeBitVector (BIT_VECTOR BitVector) |
int | hamming_distance (uinT32 *array1, uinT32 *array2, int length) |
BIT_VECTOR | NewBitVector (int NumBits) |
Define Documentation
no of bits in a long
Definition at line 27 of file bitvec.h.
#define copy_all_bits |
( |
|
source, |
|
|
|
dest, |
|
|
|
length |
|
) |
| |
Value:{\
register int index; \
\
for (index=0;index<length;index++)\
dest[index]=source[index]; \
}
Definition at line 49 of file bitvec.h.
#define reset_bit |
( |
|
array, |
|
|
|
bit |
|
) |
| (array[bit/BITSINLONG]&=~(1<<(bit&(BITSINLONG-1)))) |
#define set_all_bits |
( |
|
array, |
|
|
|
length |
|
) |
| |
Value:{\
register int index; \
\
for (index=0;index<length;index++)\
array[index]= ~0; \
}
Definition at line 41 of file bitvec.h.
#define SET_BIT |
( |
|
array, |
|
|
|
bit |
|
) |
| (array[bit/BITSINLONG]|=1<<(bit&(BITSINLONG-1))) |
#define test_bit |
( |
|
array, |
|
|
|
bit |
|
) |
| (array[bit/BITSINLONG] & (1<<(bit&(BITSINLONG-1)))) |
#define WordsInVectorOfSize |
( |
|
NumBits | ) |
(((NumBits) + BITSINLONG - 1) / BITSINLONG) |
#define zero_all_bits |
( |
|
array, |
|
|
|
length |
|
) |
| |
Value:{\
register int index; \
\
for (index=0;index<length;index++)\
array[index]=0; \
}
Definition at line 33 of file bitvec.h.
Typedef Documentation
Function Documentation
This routine uses realloc to increase the size of the specified bit vector.
Globals:
- Parameters:
-
Vector | bit vector to be expanded |
NewNumBits | new size of bit vector |
- Returns:
- New expanded bit vector.
- Note:
- Exceptions: none
-
History: Fri Nov 16 10:11:16 1990, DSJ, Created.
Definition at line 48 of file bitvec.cpp.
This routine frees a bit vector. It also decrements the global counter that keeps track of the number of bit vectors allocated. If BitVector is NULL, then the count is printed to stderr.
Globals:
- BitVectorCount count of number of bit vectors allocated
- Parameters:
-
BitVector | bit vector to be freed |
- Note:
- Exceptions: none
-
History: Tue Oct 23 16:46:09 1990, DSJ, Created.
Definition at line 55 of file bitvec.cpp.
{
if (BitVector) {
Efree(BitVector);
}
}
int hamming_distance |
( |
uinT32 * |
array1, |
|
|
uinT32 * |
array2, |
|
|
int |
length |
|
) |
| |
hamming_distance(array1,array2,length) computes the hamming distance between two bit strings.
Definition at line 81 of file bitvec.cpp.
{
register uinT32 diff;
register int dist;
dist = 0;
for (; length > 0; length--) {
diff = *array1++ ^ *array2++;
while (diff) {
diff &= diff - 1;
dist++;
}
}
return dist;
}
Allocate and return a new bit vector large enough to hold the specified number of bits.
Globals:
- BitVectorCount number of bit vectors allocated
- Parameters:
-
NumBits | number of bits in new bit vector |
- Returns:
- New bit vector.
- Note:
- Exceptions: none
-
History: Tue Oct 23 16:51:27 1990, DSJ, Created.
Definition at line 111 of file bitvec.cpp.