BurntSushi / memchr

Optimized string search routines for Rust.
The Unlicense
799 stars 97 forks source link

arch/all/count: remove SWAR implementation of byte counting #137

Closed BurntSushi closed 10 months ago

BurntSushi commented 10 months ago

It turns out that it was wrong. (See regression test that failed.) Namely, the bit tricks used for the scalar version of memchr only tell us whether a byte occurs within a usize, but not how many there are. It seems like it should be able to be adapted to do a count, but I couldn't quite figure it out. So for now, we just fall back to a byte-at-a-time loop.