@@ -6,13 +6,13 @@ trait Ashl: DInt {
66 let n_h = Self :: H :: BITS ;
77 if shl & n_h != 0 {
88 // we only need `self.lo()` because `self.hi()` will be shifted out entirely
9- ( self . lo ( ) << ( shl - n_h) ) . widen_hi ( )
9+ self . lo ( ) . wrapping_shl ( shl - n_h) . widen_hi ( )
1010 } else if shl == 0 {
1111 self
1212 } else {
1313 Self :: from_lo_hi (
14- self . lo ( ) << shl,
15- self . lo ( ) . logical_shr ( n_h - shl) | ( self . hi ( ) << shl) ,
14+ self . lo ( ) . wrapping_shl ( shl) ,
15+ self . lo ( ) . logical_shr ( n_h - shl) | self . hi ( ) . wrapping_shl ( shl) ,
1616 )
1717 }
1818 }
@@ -28,16 +28,16 @@ trait Ashr: DInt {
2828 let n_h = Self :: H :: BITS ;
2929 if shr & n_h != 0 {
3030 Self :: from_lo_hi (
31- self . hi ( ) >> ( shr - n_h) ,
31+ self . hi ( ) . wrapping_shr ( shr - n_h) ,
3232 // smear the sign bit
33- self . hi ( ) >> ( n_h - 1 ) ,
33+ self . hi ( ) . wrapping_shr ( n_h - 1 ) ,
3434 )
3535 } else if shr == 0 {
3636 self
3737 } else {
3838 Self :: from_lo_hi (
39- self . lo ( ) . logical_shr ( shr) | ( self . hi ( ) << ( n_h - shr) ) ,
40- self . hi ( ) >> shr,
39+ self . lo ( ) . logical_shr ( shr) | self . hi ( ) . wrapping_shl ( n_h - shr) ,
40+ self . hi ( ) . wrapping_shr ( shr) ,
4141 )
4242 }
4343 }
@@ -57,7 +57,7 @@ trait Lshr: DInt {
5757 self
5858 } else {
5959 Self :: from_lo_hi (
60- self . lo ( ) . logical_shr ( shr) | ( self . hi ( ) << ( n_h - shr) ) ,
60+ self . lo ( ) . logical_shr ( shr) | self . hi ( ) . wrapping_shl ( n_h - shr) ,
6161 self . hi ( ) . logical_shr ( shr) ,
6262 )
6363 }
0 commit comments