Replace __builtin_ffs with std::countr_zero#827
Conversation
WalkthroughReplaces __builtin_ffs()-based index calculation with std::countr_zero()-based logic in art_internal_impl.hpp, adds an early contains_byte() zero-check returning child_not_found, simplifies the boundary check to result >= children_count, and adjusts returned index and comments accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)art_internal_impl.hpp (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude finished @laurynas-biveinis's task —— View job Code Review: Replace __builtin_ffs with std::countr_zeroTodo List:
✅ Overall Assessment: APPROVEDThis is a well-executed refactor that improves portability and consistency. The logic transformation is mathematically correct and the implementation is sound. 📋 Detailed ReviewCode Quality & Best Practices ✅
Logic Correctness ✅The transformation from Before (art_internal_impl.hpp:1516-1530):
After:
Both approaches correctly map the bit position to array index. Critical Bug Prevention ✅
Performance Considerations ✅
Security Concerns ✅
Test Coverage
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #827 +/- ##
==========================================
- Coverage 98.39% 98.33% -0.07%
==========================================
Files 35 35
Lines 6480 6483 +3
==========================================
- Hits 6376 6375 -1
- Misses 104 108 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Replace GCC/Clang intrinsic __builtin_ffs with C++20 std::countr_zero in the generic fallback path of N4::find_child(). This improves MSVC portability and consistency with 10+ other std::countr_zero uses in the codebase. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
96ff513 to
35bc1b4
Compare
|
|
Claude finished @laurynas-biveinis's task —— View job Code Review: Replace __builtin_ffs with std::countr_zeroTodo List:
✅ Overall Assessment: APPROVEDThis is a well-executed refactor that improves portability and consistency. The logic transformation is mathematically correct and the implementation is sound. 📋 Detailed ReviewCode Quality & Best Practices ✅
Logic Correctness ✅The transformation from Before (art_internal_impl.hpp:1516-1530):
After:
Both approaches correctly map the bit position to array index. Critical Bug Prevention ✅
Performance Considerations ✅
Security Concerns ✅
Test Coverage
|



Replace GCC/Clang intrinsic __builtin_ffs with C++20 std::countr_zero
in the generic fallback path of N4::find_child(). This improves MSVC
portability and consistency with 10+ other std::countr_zero uses in
the codebase.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.