diff --git a/library/core/src/intrinsics/fallback.rs b/library/core/src/intrinsics/fallback.rs index aa9033ee3d260..78e60626f6007 100644 --- a/library/core/src/intrinsics/fallback.rs +++ b/library/core/src/intrinsics/fallback.rs @@ -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 { @@ -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) }; @@ -181,7 +181,7 @@ 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), ) } } @@ -189,12 +189,12 @@ macro_rules! impl_funnel_shifts { #[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` @@ -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), ) } } diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs index 333e44649d8f6..430f0a8cff32f 100644 --- a/library/core/src/num/mod.rs +++ b/library/core/src/num/mod.rs @@ -347,11 +347,11 @@ impl i8 { Min = -128, Max = 127, rot = 2, - rot_op = "-0x7e", - rot_result = "0xa", - swap_op = "0x12", - swapped = "0x12", - reversed = "0x48", + rot_op = "-0x7e", + rot_result = "0x0a", + swap_op = "0x12", + swapped = "0x12", + reversed = "0x48", le_bytes = "[0x12]", be_bytes = "[0x12]", to_xe_bytes_doc = i8_xe_bytes_doc!(), @@ -371,11 +371,11 @@ impl i16 { Min = -32768, Max = 32767, rot = 4, - rot_op = "-0x5ffd", - rot_result = "0x3a", - swap_op = "0x1234", - swapped = "0x3412", - reversed = "0x2c48", + rot_op = "-0x5ffd", + rot_result = "0x003a", + swap_op = "0x1234", + swapped = "0x3412", + reversed = "0x2c48", le_bytes = "[0x34, 0x12]", be_bytes = "[0x12, 0x34]", to_xe_bytes_doc = "", @@ -395,11 +395,11 @@ impl i32 { Min = -2147483648, Max = 2147483647, rot = 8, - rot_op = "0x10000b3", - rot_result = "0xb301", - swap_op = "0x12345678", - swapped = "0x78563412", - reversed = "0x1e6a2c48", + rot_op = "0x010000b3", + rot_result = "0x0000b301", + swap_op = "0x12345678", + swapped = "0x78563412", + reversed = "0x1e6a2c48", le_bytes = "[0x78, 0x56, 0x34, 0x12]", be_bytes = "[0x12, 0x34, 0x56, 0x78]", to_xe_bytes_doc = "", @@ -419,11 +419,11 @@ impl i64 { Min = -9223372036854775808, Max = 9223372036854775807, rot = 12, - rot_op = "0xaa00000000006e1", - rot_result = "0x6e10aa", - swap_op = "0x1234567890123456", - swapped = "0x5634129078563412", - reversed = "0x6a2c48091e6a2c48", + rot_op = "0x0aa00000000006e1", + rot_result = "0x00000000006e10aa", + swap_op = "0x1234567890123456", + swapped = "0x5634129078563412", + reversed = "0x6a2c48091e6a2c48", le_bytes = "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]", be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", to_xe_bytes_doc = "", @@ -443,11 +443,11 @@ impl i128 { Min = -170141183460469231731687303715884105728, Max = 170141183460469231731687303715884105727, rot = 16, - rot_op = "0x13f40000000000000000000000004f76", - rot_result = "0x4f7613f4", - swap_op = "0x12345678901234567890123456789012", - swapped = "0x12907856341290785634129078563412", - reversed = "0x48091e6a2c48091e6a2c48091e6a2c48", + rot_op = "0x13f40000000000000000000000004f76", + rot_result = "0x0000000000000000000000004f7613f4", + swap_op = "0x12345678901234567890123456789012", + swapped = "0x12907856341290785634129078563412", + reversed = "0x48091e6a2c48091e6a2c48091e6a2c48", le_bytes = "[0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, \ 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]", be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \ @@ -470,11 +470,11 @@ impl isize { Min = -32768, Max = 32767, rot = 4, - rot_op = "-0x5ffd", - rot_result = "0x3a", - swap_op = "0x1234", - swapped = "0x3412", - reversed = "0x2c48", + rot_op = "-0x5ffd", + rot_result = "0x003a", + swap_op = "0x1234", + swapped = "0x3412", + reversed = "0x2c48", le_bytes = "[0x34, 0x12]", be_bytes = "[0x12, 0x34]", to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(), @@ -495,11 +495,11 @@ impl isize { Min = -2147483648, Max = 2147483647, rot = 8, - rot_op = "0x10000b3", - rot_result = "0xb301", - swap_op = "0x12345678", - swapped = "0x78563412", - reversed = "0x1e6a2c48", + rot_op = "0x010000b3", + rot_result = "0x0000b301", + swap_op = "0x12345678", + swapped = "0x78563412", + reversed = "0x1e6a2c48", le_bytes = "[0x78, 0x56, 0x34, 0x12]", be_bytes = "[0x12, 0x34, 0x56, 0x78]", to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(), @@ -520,11 +520,11 @@ impl isize { Min = -9223372036854775808, Max = 9223372036854775807, rot = 12, - rot_op = "0xaa00000000006e1", - rot_result = "0x6e10aa", - swap_op = "0x1234567890123456", - swapped = "0x5634129078563412", - reversed = "0x6a2c48091e6a2c48", + rot_op = "0x0aa00000000006e1", + rot_result = "0x00000000006e10aa", + swap_op = "0x1234567890123456", + swapped = "0x5634129078563412", + reversed = "0x6a2c48091e6a2c48", le_bytes = "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]", be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(), @@ -546,17 +546,17 @@ impl u8 { BITS_MINUS_ONE = 7, MAX = 255, rot = 2, - rot_op = "0x82", - rot_result = "0xa", - fsh_op = "0x36", - fshl_result = "0x8", - fshr_result = "0x8d", - clmul_lhs = "0x12", - clmul_rhs = "0x34", + rot_op = "0x82", + rot_result = "0x0a", + fsh_op = "0x36", + fshl_result = "0x08", + fshr_result = "0x8d", + clmul_lhs = "0x12", + clmul_rhs = "0x34", clmul_result = "0x28", - swap_op = "0x12", - swapped = "0x12", - reversed = "0x48", + swap_op = "0x12", + swapped = "0x12", + reversed = "0x48", le_bytes = "[0x12]", be_bytes = "[0x12]", to_xe_bytes_doc = u8_xe_bytes_doc!(), @@ -1188,17 +1188,17 @@ impl u16 { BITS_MINUS_ONE = 15, MAX = 65535, rot = 4, - rot_op = "0xa003", - rot_result = "0x3a", - fsh_op = "0x2de", - fshl_result = "0x30", - fshr_result = "0x302d", - clmul_lhs = "0x9012", - clmul_rhs = "0xcd34", - clmul_result = "0x928", - swap_op = "0x1234", - swapped = "0x3412", - reversed = "0x2c48", + rot_op = "0xa003", + rot_result = "0x003a", + fsh_op = "0x02de", + fshl_result = "0x0030", + fshr_result = "0x302d", + clmul_lhs = "0x9012", + clmul_rhs = "0xcd34", + clmul_result = "0x0928", + swap_op = "0x1234", + swapped = "0x3412", + reversed = "0x2c48", le_bytes = "[0x34, 0x12]", be_bytes = "[0x12, 0x34]", to_xe_bytes_doc = "", @@ -1243,17 +1243,17 @@ impl u32 { BITS_MINUS_ONE = 31, MAX = 4294967295, rot = 8, - rot_op = "0x10000b3", - rot_result = "0xb301", - fsh_op = "0x2fe78e45", - fshl_result = "0xb32f", - fshr_result = "0xb32fe78e", - clmul_lhs = "0x56789012", - clmul_rhs = "0xf52ecd34", + rot_op = "0x010000b3", + rot_result = "0x0000b301", + fsh_op = "0x2fe78e45", + fshl_result = "0x0000b32f", + fshr_result = "0xb32fe78e", + clmul_lhs = "0x56789012", + clmul_rhs = "0xf52ecd34", clmul_result = "0x9b980928", - swap_op = "0x12345678", - swapped = "0x78563412", - reversed = "0x1e6a2c48", + swap_op = "0x12345678", + swapped = "0x78563412", + reversed = "0x1e6a2c48", le_bytes = "[0x78, 0x56, 0x34, 0x12]", be_bytes = "[0x12, 0x34, 0x56, 0x78]", to_xe_bytes_doc = "", @@ -1274,17 +1274,17 @@ impl u64 { BITS_MINUS_ONE = 63, MAX = 18446744073709551615, rot = 12, - rot_op = "0xaa00000000006e1", - rot_result = "0x6e10aa", - fsh_op = "0x2fe78e45983acd98", - fshl_result = "0x6e12fe", - fshr_result = "0x6e12fe78e45983ac", - clmul_lhs = "0x7890123456789012", - clmul_rhs = "0xdd358416f52ecd34", - clmul_result = "0xa6299579b980928", - swap_op = "0x1234567890123456", - swapped = "0x5634129078563412", - reversed = "0x6a2c48091e6a2c48", + rot_op = "0x0aa00000000006e1", + rot_result = "0x00000000006e10aa", + fsh_op = "0x2fe78e45983acd98", + fshl_result = "0x00000000006e12fe", + fshr_result = "0x6e12fe78e45983ac", + clmul_lhs = "0x7890123456789012", + clmul_rhs = "0xdd358416f52ecd34", + clmul_result = "0x0a6299579b980928", + swap_op = "0x1234567890123456", + swapped = "0x5634129078563412", + reversed = "0x6a2c48091e6a2c48", le_bytes = "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]", be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", to_xe_bytes_doc = "", @@ -1305,17 +1305,17 @@ impl u128 { BITS_MINUS_ONE = 127, MAX = 340282366920938463463374607431768211455, rot = 16, - rot_op = "0x13f40000000000000000000000004f76", - rot_result = "0x4f7613f4", - fsh_op = "0x2fe78e45983acd98039000008736273", - fshl_result = "0x4f7602fe", - fshr_result = "0x4f7602fe78e45983acd9803900000873", - clmul_lhs = "0x12345678901234567890123456789012", - clmul_rhs = "0x4317e40ab4ddcf05dd358416f52ecd34", + rot_op = "0x13f40000000000000000000000004f76", + rot_result = "0x0000000000000000000000004f7613f4", + fsh_op = "0x02fe78e45983acd98039000008736273", + fshl_result = "0x0000000000000000000000004f7602fe", + fshr_result = "0x4f7602fe78e45983acd9803900000873", + clmul_lhs = "0x12345678901234567890123456789012", + clmul_rhs = "0x4317e40ab4ddcf05dd358416f52ecd34", clmul_result = "0xb9cf660de35d0c170a6299579b980928", - swap_op = "0x12345678901234567890123456789012", - swapped = "0x12907856341290785634129078563412", - reversed = "0x48091e6a2c48091e6a2c48091e6a2c48", + swap_op = "0x12345678901234567890123456789012", + swapped = "0x12907856341290785634129078563412", + reversed = "0x48091e6a2c48091e6a2c48091e6a2c48", le_bytes = "[0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, \ 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]", be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \ @@ -1338,17 +1338,17 @@ impl usize { BITS_MINUS_ONE = 15, MAX = 65535, rot = 4, - rot_op = "0xa003", - rot_result = "0x3a", - fsh_op = "0x2de", - fshl_result = "0x30", - fshr_result = "0x302d", - clmul_lhs = "0x9012", - clmul_rhs = "0xcd34", - clmul_result = "0x928", - swap_op = "0x1234", - swapped = "0x3412", - reversed = "0x2c48", + rot_op = "0xa003", + rot_result = "0x003a", + fsh_op = "0x02de", + fshl_result = "0x0030", + fshr_result = "0x302d", + clmul_lhs = "0x9012", + clmul_rhs = "0xcd34", + clmul_result = "0x0928", + swap_op = "0x1234", + swapped = "0x3412", + reversed = "0x2c48", le_bytes = "[0x34, 0x12]", be_bytes = "[0x12, 0x34]", to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(), @@ -1369,17 +1369,17 @@ impl usize { BITS_MINUS_ONE = 31, MAX = 4294967295, rot = 8, - rot_op = "0x10000b3", - rot_result = "0xb301", - fsh_op = "0x2fe78e45", - fshl_result = "0xb32f", - fshr_result = "0xb32fe78e", - clmul_lhs = "0x56789012", - clmul_rhs = "0xf52ecd34", + rot_op = "0x010000b3", + rot_result = "0x0000b301", + fsh_op = "0x2fe78e45", + fshl_result = "0x0000b32f", + fshr_result = "0xb32fe78e", + clmul_lhs = "0x56789012", + clmul_rhs = "0xf52ecd34", clmul_result = "0x9b980928", - swap_op = "0x12345678", - swapped = "0x78563412", - reversed = "0x1e6a2c48", + swap_op = "0x12345678", + swapped = "0x78563412", + reversed = "0x1e6a2c48", le_bytes = "[0x78, 0x56, 0x34, 0x12]", be_bytes = "[0x12, 0x34, 0x56, 0x78]", to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(), @@ -1400,17 +1400,17 @@ impl usize { BITS_MINUS_ONE = 63, MAX = 18446744073709551615, rot = 12, - rot_op = "0xaa00000000006e1", - rot_result = "0x6e10aa", - fsh_op = "0x2fe78e45983acd98", - fshl_result = "0x6e12fe", - fshr_result = "0x6e12fe78e45983ac", - clmul_lhs = "0x7890123456789012", - clmul_rhs = "0xdd358416f52ecd34", + rot_op = "0x0aa00000000006e1", + rot_result = "0x00000000006e10aa", + fsh_op = "0x2fe78e45983acd98", + fshl_result = "0x00000000006e12fe", + fshr_result = "0x6e12fe78e45983ac", + clmul_lhs = "0x7890123456789012", + clmul_rhs = "0xdd358416f52ecd34", clmul_result = "0xa6299579b980928", - swap_op = "0x1234567890123456", - swapped = "0x5634129078563412", - reversed = "0x6a2c48091e6a2c48", + swap_op = "0x1234567890123456", + swapped = "0x5634129078563412", + reversed = "0x6a2c48091e6a2c48", le_bytes = "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]", be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(), diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index ae8324c13f0cb..3743a842786d0 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -415,74 +415,118 @@ macro_rules! uint_impl { return intrinsics::rotate_right(self, n); } - /// Performs a left funnel shift (concatenates `self` with `rhs`, with `self` - /// making up the most significant half, then shifts the combined value left - /// by `n`, and most significant half is extracted to produce the result). + /// Performs a left funnel shift. /// - /// Please note this isn't the same operation as the `<<` shifting operator or - /// [`rotate_left`](Self::rotate_left), although `a.funnel_shl(a, n)` is *equivalent* - /// to `a.rotate_left(n)`. + /// This operation can be thought of as concatenating `self` and `right` into an + /// integer twice the size of + #[doc = concat!("`", stringify!($SelfT) , "`,")] + /// performing a left shift by `n`, and returning the **upper half** of the result. + /// + /// The name comes from "funneling" a wider integer to a narrower integer. /// /// # Panics /// - /// If `n` is greater than or equal to the number of bits in `self` + /// This function will panic if `n` is greater than or equal to the number of + /// bits in `self`. /// /// # Examples /// - /// Basic usage: + /// ``` + /// #![feature(funnel_shifts)] + /// + #[doc = concat!("let a = ", $rot_op, "_", stringify!($SelfT), ";")] + #[doc = concat!("let b = ", $fsh_op, "_", stringify!($SelfT), ";")] + /// + #[doc = concat!("assert_eq!(a.funnel_shl(b, ", $rot, "), ", $fshl_result, ");")] /// + /// // Using zeros as the right operand acts as a normal shift + #[doc = concat!("assert_eq!(a.funnel_shl(0, ", $rot, "), a << ", $rot, ");")] + /// + /// // Shifting by 0 returns `self` unchanged + #[doc = concat!("assert_eq!(a.funnel_shl(0, 0), a);")] + /// + /// // Using the same value as the right operand acts as a rotate + #[doc = concat!("assert_eq!(a.funnel_shl(a, ", $rot, "), a.rotate_left(", $rot, "));")] /// ``` + /// + /// Note that while `funnel_shl` can act as a rotate, it does not allow for + /// rotating by an unbounded amount like [`rotate_left`](Self::rotate_left) does: + /// + /// ```should_panic /// #![feature(funnel_shifts)] - #[doc = concat!("let a = ", $rot_op, stringify!($SelfT), ";")] - #[doc = concat!("let b = ", $fsh_op, stringify!($SelfT), ";")] - #[doc = concat!("let m = ", $fshl_result, ";")] /// - #[doc = concat!("assert_eq!(a.funnel_shl(b, ", $rot, "), m);")] + #[doc = concat!("let a = ", stringify!($SelfT), "::MAX;")] + /// // Okay + #[doc = concat!("let _ = a.rotate_left(", stringify!($SelfT), "::BITS);")] + /// // Panics + #[doc = concat!("let _ = a.funnel_shl(a, ", stringify!($SelfT), "::BITS);")] /// ``` #[rustc_const_unstable(feature = "funnel_shifts", issue = "145686")] #[unstable(feature = "funnel_shifts", issue = "145686")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] - pub const fn funnel_shl(self, rhs: Self, n: u32) -> Self { + pub const fn funnel_shl(self, right: Self, n: u32) -> Self { assert!(n < Self::BITS, "attempt to funnel shift left with overflow"); // SAFETY: just checked that `shift` is in-range - unsafe { intrinsics::unchecked_funnel_shl(self, rhs, n) } + unsafe { intrinsics::unchecked_funnel_shl(self, right, n) } } - /// Performs a right funnel shift (concatenates `self` and `rhs`, with `self` - /// making up the most significant half, then shifts the combined value right - /// by `n`, and least significant half is extracted to produce the result). + /// Performs a right funnel shift. /// - /// Please note this isn't the same operation as the `>>` shifting operator or - /// [`rotate_right`](Self::rotate_right), although `a.funnel_shr(a, n)` is *equivalent* - /// to `a.rotate_right(n)`. + /// This operation can be thought of as concatenating `self` and `right` into an + /// integer twice the size of + #[doc = concat!("`", stringify!($SelfT) , "`,")] + /// performing a right shift by `n`, and returning the **lower half** of the result. + /// + /// The name comes from "funneling" a wider integer to a narrower integer. /// /// # Panics /// - /// If `n` is greater than or equal to the number of bits in `self` + /// This function will panic if `n` is greater than or equal to the number of + /// bits in `self`. /// /// # Examples /// - /// Basic usage: + /// ``` + /// #![feature(funnel_shifts)] + /// + #[doc = concat!("let a = ", $rot_op, "_", stringify!($SelfT), ";")] + #[doc = concat!("let b = ", $fsh_op, "_", stringify!($SelfT), ";")] + /// + #[doc = concat!("assert_eq!(a.funnel_shr(b, ", $rot, "), ", $fshr_result, ");")] /// + /// // Using zeros as the high operand acts as a normal shift + #[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".funnel_shr(a, ", $rot, "), a >> ", $rot, ");")] + /// + /// // Shifting by 0 returns `right` unchanged + #[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".funnel_shr(a, 0), a);")] + /// + /// // Using the same value as the right operand acts as a rotate + #[doc = concat!("assert_eq!(a.funnel_shr(a, ", $rot, "), a.rotate_right(", $rot, "));")] /// ``` + /// + /// Note that while `funnel_shr` can act as a rotate, it does not allow for + /// rotating by an unbounded amount like [`rotate_right`](Self::rotate_right) does: + /// + /// ```should_panic /// #![feature(funnel_shifts)] - #[doc = concat!("let a = ", $rot_op, stringify!($SelfT), ";")] - #[doc = concat!("let b = ", $fsh_op, stringify!($SelfT), ";")] - #[doc = concat!("let m = ", $fshr_result, ";")] /// - #[doc = concat!("assert_eq!(a.funnel_shr(b, ", $rot, "), m);")] + #[doc = concat!("let a = ", stringify!($SelfT), "::MAX;")] + /// // Okay + #[doc = concat!("let _ = a.rotate_right(", stringify!($SelfT), "::BITS);")] + /// // Panics + #[doc = concat!("let _ = a.funnel_shr(a, ", stringify!($SelfT), "::BITS);")] /// ``` #[rustc_const_unstable(feature = "funnel_shifts", issue = "145686")] #[unstable(feature = "funnel_shifts", issue = "145686")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] - pub const fn funnel_shr(self, rhs: Self, n: u32) -> Self { + pub const fn funnel_shr(self, right: Self, n: u32) -> Self { assert!(n < Self::BITS, "attempt to funnel shift right with overflow"); // SAFETY: just checked that `shift` is in-range - unsafe { intrinsics::unchecked_funnel_shr(self, rhs, n) } + unsafe { intrinsics::unchecked_funnel_shr(self, right, n) } } /// Performs a carry-less multiplication, returning the lower bits.