fixedbitset
fixedbitset copied to clipboard
Add zeros iterator
This closes #7 and #9. I have written the code such that it 'just works' and is not pathological in terms of speed. As mentioned in #9 once i will have more time i will gladly make both iterators optimal. @bluss tell me what do you think about the proposed implementation.
Looks good. If you need this for your project, please use it locally.
While using the zeros
iterator i have hit an edge-case -- if the bitset consisted of only one block, then such block wouldn't get masked and so iterator would yield indices higher than length of the bitset. I have fixed that behavior and added unit tests to test this case for both zeros
and ones
iterators. Hopefully this was the last bug in this PR :)
I cherry-picked inline count_ones
inline commit to this branch, as i'm using it for the project. If this is a problem then i will revert it and manage otherwise, although for simplicity reasons i would like to leave it here, especially if you are not planning on merging this PR soon. Btw i think that it is ready to be merged as-is.
Closing in favor of #89. Will try to adopt the benchmarks you have here for that implementation.