Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.5k
feat: add binary count trailing zeros algorithm#972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
feat: add binary count trailing zeros algorithm#972
Conversation
codecov-commenter commentedDec 17, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## master #972 +/- ##======================================= Coverage 95.70% 95.70% ======================================= Files 345 346 +1 Lines 22569 22608 +39 =======================================+ Hits 21599 21638 +39 Misses 970 970 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
AliAlimohammadi commentedDec 17, 2025
@siriak, this is ready to be merged. |
7a261d7 intoTheAlgorithms:masterUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Description
Adds an algorithm to count trailing zeros in the binary representation of a number.
Algorithm
Counts the number of consecutive zeros from the least significant bit (rightmost) in the binary representation of an unsigned integer.
Time Complexity: O(1) - uses CPU instruction
Space Complexity: O(1)
Example
Implementation Details
trailing_zeros()methodlog2(num & -num)tricku64for compile-time guaranteesTesting
Checklist