Suppose a bit sequence of size M, and another bit sequence of size N, with M >> N. Both M and N can be saved inside integer arrays: If N has a length of 30 then an array with only one integer will be needed, but if N has a length of 300 then an array with 10 integers will be needed to store it.
What I am trying to do is to shift N inside M, and for each possible position k inside M to find the number of differences (by XORing) between N and M(k). If M has 10000 bits and N has 100 bits then there are 10000-100=9900 positions in which an XOR comparison will be performed.
Are you aware of a library that could do that or maybe propose an algorithm ? I know that it can be done with many other ways however I believe that the fastest possible method is the one proposed here. If you can think of a faster way then I'm open to suggestions !
I'd prefer something in C or C++ but other languages, even pseudocode are also acceptable.
Thanks in advance.