Low level C programming is not my strength, so I stay with bit strings in Perl. Based on a block size of 8 bits, you would have 8 alignments of the needle. Each of this 8 alignments has a middle part of complete 8 bit blocks and a left and right partial block. I would use something like index to search for the middle block in the haystack bit string and then check whether or not the left and right partial blocks match or not.

Apologies if anyone's proposal above is materially the same but the fact eluded me.


In reply to Re: [OT] The interesting problem of comparing bit-strings. by hdb
in thread [OT] The interesting problem of comparing bit-strings. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":