Feat/u64 bit ops - #15
Merged
Merged
Conversation
BitStr::leading_zeros() counts consecutive false bits from the start of a view. Internally delegates to BitsArith::leading_zero_words() on [u64], which uses SIMD (AVX2/SSE2/NEON) to skip over zero words in batches of 4 or 2, falling back to scalar for short inputs. Backend equivalence tests validate all SIMD paths against the scalar oracle. Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: DeepSeek AI <service@deepseek.com>
- BitStr::leading_zeros() and leading_ones() share a parameterised internal helper (leading_value_count) that dispatches fill=0 or !0 - BitsArith gains leading_one_words() alongside leading_zero_words() Both delegate to leading_value_words(words, fill) which uses AVX2/SSE4.1/NEON backends with a scalar fallback - Rename funcs_for_leading_zero_words → funcs_for_leading_value_words Module parameterised by fill value, zero and one tests unified - Fix _mm_cmpeq_epi64 requires SSE4.1, not SSE2 Rename sse2→sse41 in 8 module files that use the intrinsic: leading_value_words, eq_words_aligned, eq_words_unaligned, contains, find, rfind, cmp_aligned, cmp_unaligned - CI: linux-x64-ssse3 → linux-x64-sse4.1 so SSE4.1 backend equivalence tests are covered Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: DeepSeek AI <service@deepseek.com>
… BitStr Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: DeepSeek AI <service@deepseek.com>
Move the two delegation methods from impls_for_count_ones.rs into a new impls_for_leading_zeros.rs — mirroring the BitStr side. No separate tests needed; coverage is on the BitStr implementation. Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: DeepSeek AI <service@deepseek.com>
BitString methods that delegate one-to-one to BitStr (matches_at, starts_with, ends_with, contains, find, rfind, strip_prefix, strip_suffix, cmp) no longer carry separate test modules. The logic is already exercised by the BitStr test suite. Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: DeepSeek AI <service@deepseek.com>
- BitStr::trailing_zeros() / trailing_ones() count consecutive bits from the end of a view — mirroring leading_* but scanning from the last bit backwards (uses u64::leading_zeros for within-word scan) - BitsArith::trailing_zero_words() / trailing_one_words() with trailing_value_words(words, fill) dispatch — AVX2/SSE4.1/NEON backends process chunks in reverse order - BitString delegates to BitStr - 27 unit tests + 2 AVX2 backend equivalence tests for trailing scan Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: DeepSeek AI <service@deepseek.com>
Three-step word-level algorithm: 1. Reverse bits within each u64 word via u64::reverse_bits() 2. Reverse word order 3. Right-shift by unused bits to align to LSB reverse_bits_assign() delegates to reverse_bits() via reassignment. Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: DeepSeek AI <service@deepseek.com>
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.