00001
00019 #ifndef BITVEC_H
00020 #define BITVEC_H
00021
00022
00023
00024
00025 #define BITSINLONG 32
00026
00031 typedef unsigned int *BIT_VECTOR;
00032
00033
00034
00035
00036 #define zero_all_bits(array,length) \
00037 {\
00038 register int index; \
00039 \
00040 for (index=0;index<length;index++)\
00041 array[index]=0; \
00042 }
00043
00044 #define set_all_bits(array,length) \
00045 {\
00046 register int index; \
00047 \
00048 for (index=0;index<length;index++)\
00049 array[index]= ~0; \
00050 }
00051
00052 #define copy_all_bits(source,dest,length) \
00053 {\
00054 register int index; \
00055 \
00056 for (index=0;index<length;index++)\
00057 dest[index]=source[index]; \
00058 }
00059
00060 #define SET_BIT(array,bit) (array[bit/BITSINLONG]|=1<<(bit&(BITSINLONG-1)))
00061
00062 #define reset_bit(array,bit) (array[bit/BITSINLONG]&=~(1<<(bit&(BITSINLONG-1))))
00063
00064 #define test_bit(array,bit) (array[bit/BITSINLONG] & (1<<(bit&(BITSINLONG-1))))
00065
00066 #define WordsInVectorOfSize(NumBits) \
00067 (((NumBits) + BITSINLONG - 1) / BITSINLONG)
00068
00069
00070
00071
00072 BIT_VECTOR ExpandBitVector(BIT_VECTOR Vector, int NewNumBits);
00073
00074 void FreeBitVector(BIT_VECTOR BitVector);
00075
00076 int hamming_distance(register unsigned long *array1,
00077 register unsigned long *array2,
00078 register int length);
00079
00080 BIT_VECTOR NewBitVector(int NumBits);
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106 #endif