-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Implement feature int_lowest_highest_one
for integer and NonZero types
#145381
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
ed51b06
to
520868b
Compare
This comment has been minimized.
This comment has been minimized.
Urk, I overlook something with the |
You can use |
Reminder, once the PR becomes ready for a review, use |
Implement the accepted ACP for methods that find the index of the least significant (lowest) and most significant (highest) set bit in an integer for signed, unsigned, and NonZero types. Also add unit tests for all these types.
520868b
to
c140bc1
Compare
/// Returns the index of the highest bit set to one in `self`, or `None` | ||
/// if `self` is `0`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Returns the index of the highest bit set to one in `self`, or `None` | |
/// if `self` is `0`. | |
/// Returns the index of the highest bit set to one in `self`. |
not needed for NonZero
const ONE: $T = 1; | ||
const MINUS_ONE: $T = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these constants necessary?
Tracking issue: #145203
Implement the accepted ACP #145203 for methods that find the index of the least significant (lowest) and most significant (highest) set bit in an integer for signed, unsigned, and NonZero types.
Also add unit tests for all these types.