-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Add is_bit_one method to ints and uints #147336
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
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use |
The job Click to see the possible cause of the failure (guessed by this bot)
|
Does this implementation work for checking if the sign bit is one? |
I think this should go through an ACP. Also, the implementation is broken, in debug mode it will panic for shifts greater than the width, in release mode it will wrap so |
Hi, thanks for the PR! Before we can review this, it requires an API Change Proposal (ACP). The libs-api team uses this process to evaluate if the change is a good fit for the standard library. Please follow the process here to get started: Blocked on ACP. @rustbot blocked |
Thank you for the quick replies 💜. I did not know about ACPs before, but here we go: rust-lang/libs-team#667 Given that the logic for returning |
Hi,
this small PR adds a small method to int and uint types in
core
, for easily checking whether a particular bit is set to one or not:A couple of questions:
core
at all? I found myself repeatedly implementing this method in multiple projects, and to me it does feel quite at home in core with the other bit-level operations and ints and uints.#[stable]
and#[rust_const_stable]
attributes of another method. This obviously needs to change before merging. To what do I need to change it?