@@ -14,6 +14,9 @@ macro_rules! uint_impl {
1414 rot = $rot: literal,
1515 rot_op = $rot_op: literal,
1616 rot_result = $rot_result: literal,
17+ fsh_op = $fsh_op: literal,
18+ fshl_result = $fshl_result: literal,
19+ fshr_result = $fshr_result: literal,
1720 swap_op = $swap_op: literal,
1821 swapped = $swapped: literal,
1922 reversed = $reversed: literal,
@@ -375,6 +378,62 @@ macro_rules! uint_impl {
375378 return intrinsics:: rotate_right( self , n) ;
376379 }
377380
381+ /// Performs a left funnel shift (concatenates `self` with `rhs`, with `self`
382+ /// making up the most significant half, then shifts the combined value left
383+ /// by `n`, and most significant half is extracted to produce the result).
384+ ///
385+ /// Please note this isn't the same operation as the `<<` shifting operator or
386+ /// [`rotate_left`](Self::rotate_left), although `a.funnel_shl(a, n)` is *equivalent*
387+ /// to `a.rotate_left(n)`.
388+ ///
389+ /// # Examples
390+ ///
391+ /// Basic usage:
392+ ///
393+ /// ```
394+ #[ doc = concat!( "let a = " , $rot_op, stringify!( $SelfT) , ";" ) ]
395+ #[ doc = concat!( "let b = " , $fsh_op, stringify!( $SelfT) , ";" ) ]
396+ #[ doc = concat!( "let m = " , $fshl_result, ";" ) ]
397+ ///
398+ #[ doc = concat!( "assert_eq!(a.funnel_shl(b, " , $rot, "), m);" ) ]
399+ /// ```
400+ #[ rustc_const_unstable( feature = "funnel_shifts" , issue = "145686" ) ]
401+ #[ unstable( feature = "funnel_shifts" , issue = "145686" ) ]
402+ #[ must_use = "this returns the result of the operation, \
403+ without modifying the original"]
404+ #[ inline( always) ]
405+ pub const fn funnel_shl( self , rhs: Self , n: u32 ) -> Self {
406+ return intrinsics:: funnel_shl( self , rhs, n) ;
407+ }
408+
409+ /// Performs a right funnel shift (concatenates `self` and `rhs`, with `self`
410+ /// making up the most significant half, then shifts the combined value right
411+ /// by `n`, and least significant half is extracted to produce the result).
412+ ///
413+ /// Please note this isn't the same operation as the `>>` shifting operator or
414+ /// [`rotate_right`](Self::rotate_right), although `a.funnel_shr(a, n)` is *equivalent*
415+ /// to `a.rotate_right(n)`.
416+ ///
417+ /// # Examples
418+ ///
419+ /// Basic usage:
420+ ///
421+ /// ```
422+ #[ doc = concat!( "let a = " , $rot_op, stringify!( $SelfT) , ";" ) ]
423+ #[ doc = concat!( "let b = " , $fsh_op, stringify!( $SelfT) , ";" ) ]
424+ #[ doc = concat!( "let m = " , $fshr_result, ";" ) ]
425+ ///
426+ #[ doc = concat!( "assert_eq!(a.funnel_shr(b, " , $rot, "), m);" ) ]
427+ /// ```
428+ #[ rustc_const_unstable( feature = "funnel_shifts" , issue = "145686" ) ]
429+ #[ unstable( feature = "funnel_shifts" , issue = "145686" ) ]
430+ #[ must_use = "this returns the result of the operation, \
431+ without modifying the original"]
432+ #[ inline( always) ]
433+ pub const fn funnel_shr( self , rhs: Self , n: u32 ) -> Self {
434+ return intrinsics:: funnel_shr( self , rhs, n) ;
435+ }
436+
378437 /// Reverses the byte order of the integer.
379438 ///
380439 /// # Examples
0 commit comments