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.
in thread [OT] The interesting problem of comparing bit-strings. by BrowserUk
<code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>