Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions library/core/src/intrinsics/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ impl_disjoint_bitor! {
pub const trait FunnelShift: Copy + 'static {
/// See [`super::unchecked_funnel_shl`]; we just need the trait indirection to handle
/// different types since calling intrinsics with generics doesn't work.
unsafe fn unchecked_funnel_shl(self, rhs: Self, shift: u32) -> Self;
unsafe fn unchecked_funnel_shl(self, right: Self, shift: u32) -> Self;

/// See [`super::unchecked_funnel_shr`]; we just need the trait indirection to handle
/// different types since calling intrinsics with generics doesn't work.
unsafe fn unchecked_funnel_shr(self, rhs: Self, shift: u32) -> Self;
unsafe fn unchecked_funnel_shr(self, right: Self, shift: u32) -> Self;
}

macro_rules! impl_funnel_shifts {
Expand All @@ -164,7 +164,7 @@ macro_rules! impl_funnel_shifts {
impl const FunnelShift for $type {
#[cfg_attr(miri, track_caller)]
#[inline]
unsafe fn unchecked_funnel_shl(self, rhs: Self, shift: u32) -> Self {
unsafe fn unchecked_funnel_shl(self, right: Self, shift: u32) -> Self {
// This implementation is also used by Miri so we have to check the precondition.
// SAFETY: this is guaranteed by the caller
unsafe { super::assume(shift < $type::BITS) };
Expand All @@ -181,20 +181,20 @@ macro_rules! impl_funnel_shifts {
unsafe {
super::disjoint_bitor(
super::unchecked_shl(self, shift),
super::unchecked_shr(rhs, $type::BITS - shift),
super::unchecked_shr(right, $type::BITS - shift),
)
}
}
}

#[cfg_attr(miri, track_caller)]
#[inline]
unsafe fn unchecked_funnel_shr(self, rhs: Self, shift: u32) -> Self {
unsafe fn unchecked_funnel_shr(self, right: Self, shift: u32) -> Self {
// This implementation is also used by Miri so we have to check the precondition.
// SAFETY: this is guaranteed by the caller
unsafe { super::assume(shift < $type::BITS) };
if shift == 0 {
rhs
right
} else {
// SAFETY:
// - `shift < T::BITS`, which satisfies `unchecked_shr`
Expand All @@ -206,7 +206,7 @@ macro_rules! impl_funnel_shifts {
unsafe {
super::disjoint_bitor(
super::unchecked_shl(self, $type::BITS - shift),
super::unchecked_shr(rhs, shift),
super::unchecked_shr(right, shift),
)
}
}
Expand Down
Loading
Loading