Repository navigation
Add extra unchecked_disjoint_bitor implementations. - #147368
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use |
|
@rustbot label +T-libs-api -T-libs r? libs-api |
This comment has been minimized.
This comment has been minimized.
943d050 to
845a872
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
r? libs-api |
This comment has been minimized.
This comment has been minimized.
845a872 to
39c4367
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
39c4367 to
ac624b5
Compare
This comment has been minimized.
This comment has been minimized.
ac624b5 to
41533fe
Compare
This comment has been minimized.
This comment has been minimized.
41533fe to
4f310fa
Compare
This comment has been minimized.
This comment has been minimized.
4f310fa to
c24ec23
Compare
There was a problem hiding this comment.
Seems reasonable to me but should get a @rust-lang/libs-api okay.
@rustbot label +I-libs-api-nominated
r? tgross35
|
We discussed this in today's libs-api meeting; we're happy to add these functions. Thanks! |
|
Just a couple of small remaining review comments @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
|
@bjoernager gentle ping since this is pretty close, just needs the few small things addressed |
7d9b4e4 to
38d1c3a
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
…'i64', 'i128', and 'isize'; Update existing 'unchecked_disjoint_bitor' docs; Add 'must_use' to 'unchecked_disjoint_bitor';
38d1c3a to
d42b8ca
Compare
|
@rustbot ready |
…uwer Rollup of 5 pull requests Successful merges: - #163766 (Outline constant messages from panicking macros) - #147368 (Add extra `unchecked_disjoint_bitor` implementations.) - #164748 (Use 64-bit futex syscalls on RV32 Linux) - #164520 (powerpc: implement c-variadic correctly for softfloat targets) - #164671 (add maintainers for tier 2 riscv64 targets (baremetal only))
Rollup merge of #147368 - bjoernager:disjoint-bitor, r=tgross35 Add extra `unchecked_disjoint_bitor` implementations. Tracking issue: #135758. This PR implements the `unchecked_disjoint_bitor` method for additional types: ```rust impl bool { pub const unsafe fn unchecked_disjoint_bitor(self, rhs: Self) -> Self; } impl i8 { pub const unsafe fn unchecked_disjoint_bitor(self, rhs: Self) -> Self; } impl i16 { pub const unsafe fn unchecked_disjoint_bitor(self, rhs: Self) -> Self; } impl i32 { pub const unsafe fn unchecked_disjoint_bitor(self, rhs: Self) -> Self; } impl i64 { pub const unsafe fn unchecked_disjoint_bitor(self, rhs: Self) -> Self; } impl i128 { pub const unsafe fn unchecked_disjoint_bitor(self, rhs: Self) -> Self; } impl isize { pub const unsafe fn unchecked_disjoint_bitor(self, rhs: Self) -> Self; } ``` Our `disjoint_bitor` intrinsic is already implemented for these types. This method specifically is also already present on unsigned, integral types. Additionally, this PR rewrites the existing docs for `unchecked_disjoint_bitor` and adds the `must_use` attribute to the method.
…uwer Rollup of 5 pull requests Successful merges: - rust-lang/rust#163766 (Outline constant messages from panicking macros) - rust-lang/rust#147368 (Add extra `unchecked_disjoint_bitor` implementations.) - rust-lang/rust#164748 (Use 64-bit futex syscalls on RV32 Linux) - rust-lang/rust#164520 (powerpc: implement c-variadic correctly for softfloat targets) - rust-lang/rust#164671 (add maintainers for tier 2 riscv64 targets (baremetal only))
| /// This is a situational micro-optimization for places where you'd rather | ||
| /// use addition on some platforms and bitwise or on other platforms, based | ||
| /// on exactly which instructions combine better with whatever else you're | ||
| /// doing. Note that there's no reason to bother using this for places | ||
| /// where it's clear from the operations involved that they can't overlap. | ||
| /// For example, if you're combining `u16`s into a `u32` with | ||
| /// `((a as u32) << 16) | (b as u32)`, that's fine, as the backend will | ||
| /// know those sides of the `|` are disjoint without needing help. |
View all comments
Tracking issue: #135758.
This PR implements the
unchecked_disjoint_bitormethod for additional types:Our
disjoint_bitorintrinsic is already implemented for these types. This method specifically is also already present on unsigned, integral types.Additionally, this PR rewrites the existing docs for
unchecked_disjoint_bitorand adds themust_useattribute to the method.