@@ -492,6 +492,24 @@ pub trait PrimitiveInteger:
492492 /// Self::MIN`, i.e. when [`checked_mul`][Self::checked_mul] would return `None`.
493493 unsafe fn unchecked_mul ( self , rhs : Self ) -> Self ;
494494
495+ /// Unchecked shift left. Computes `self << rhs`, assuming that
496+ /// `rhs` is less than the number of bits in `self`.
497+ ///
498+ /// # Safety
499+ ///
500+ /// This results in undefined behavior if `rhs` is larger than or equal to the number of bits
501+ /// in `self`, i.e. when [`checked_shl`][Self::checked_shl] would return `None`.
502+ unsafe fn unchecked_shl ( self , rhs : u32 ) -> Self ;
503+
504+ /// Unchecked shift right. Computes `self >> rhs`, assuming that
505+ /// `rhs` is less than the number of bits in `self`.
506+ ///
507+ /// # Safety
508+ ///
509+ /// This results in undefined behavior if `rhs` is larger than or equal to the number of bits
510+ /// in `self`, i.e. when [`checked_shr`][Self::checked_shr] would return `None`.
511+ unsafe fn unchecked_shr ( self , rhs : u32 ) -> Self ;
512+
495513 /// Unchecked integer subtraction. Computes `self - rhs`, assuming overflow cannot occur.
496514 ///
497515 /// # Safety
@@ -668,6 +686,8 @@ macro_rules! impl_integer {
668686 forward! {
669687 unsafe fn unchecked_add( self , rhs: Self ) -> Self ;
670688 unsafe fn unchecked_mul( self , rhs: Self ) -> Self ;
689+ unsafe fn unchecked_shl( self , rhs: u32 ) -> Self ;
690+ unsafe fn unchecked_shr( self , rhs: u32 ) -> Self ;
671691 unsafe fn unchecked_sub( self , rhs: Self ) -> Self ;
672692 }
673693 }
0 commit comments