Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gnurou
Copy link

@Gnurou Gnurou commented Aug 14, 2025

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.

@rustbot
Copy link
Collaborator

rustbot commented Aug 14, 2025

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 14, 2025
@rustbot

This comment has been minimized.

@Gnurou Gnurou force-pushed the int_lowest_highest_one branch from ed51b06 to 520868b Compare August 14, 2025 05:54
@rust-log-analyzer

This comment has been minimized.

@Gnurou
Copy link
Author

Gnurou commented Aug 14, 2025

Urk, I overlook something with the NonZero tests... Please hold on a bit until I fix the failures. 🙇

@xizheyin
Copy link
Member

You can use @rustbot author to set it to incomplete status. When ready, you can use @rustbot ready to set it to pending review.

@Gnurou
Copy link
Author

Gnurou commented Aug 14, 2025

@rustbot author

Thanks @xizheyin !

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 14, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 14, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

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.
@Gnurou Gnurou force-pushed the int_lowest_highest_one branch from 520868b to c140bc1 Compare August 14, 2025 13:49
Comment on lines +684 to +685
/// Returns the index of the highest bit set to one in `self`, or `None`
/// if `self` is `0`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// 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

Comment on lines +472 to +473
const ONE: $T = 1;
const MINUS_ONE: $T = -1;
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants