-
Couldn't load subscription status.
- Fork 13.9k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(exact_bitshifts)]
This is a tracking issue for checked bitshifts, i.e. bitshifts that can be losslessly reversed.
ACP: rust-lang/libs-team#570
Public API
impl iX/uX {
// Shift succeeds if `shift < Self::BITS` and right shifting the result returns the original value.
fn exact_shl(self, shift: u32) -> Option<Self>;
unsafe fn unchecked_exact_shl(self, shift: u32) -> Self;
// Shift succeeds if `shift < Self::BITS` and left shifting the result returns the original value.
fn exact_shr(self, shift: u32) -> Option<Self>;
unsafe fn unchecked_exact_shr(self, shift: u32) -> Self;
}Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
- Implementation: add exact bitshifts #144342
- Add new intrinsics rather than building on
unchecked_sh{l,r}actually checked bitshifts libs-team#570 (comment) - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
-
Should
exact_shlpanic instead of returnNone, then introduce a newchecked_exact_shl -> Option? add exact bitshifts #144342 (comment) -
None yet.
Footnotes
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.