I am writing a function which process a BitVector of length N. Each time, it processes a chunk of k bits (k is often between 1 and 20). Basically, I need to compute the hamming hamming distance of this chunk of bits with some other BitArray of length k.
Currently, for small value of k, i just convert all chunk of bits to decimal number and do lookup with a pre-created table. So everytime, I have to do some overhead calculation to get the decimal number from the input bits.
Is there any fast way to compute hamming distance of two BitVectors? Or is there any fast convertion to decimal number?