@@ -6,13 +6,13 @@ trait Ashl: DInt {
6
6
let n_h = Self :: H :: BITS ;
7
7
if shl & n_h != 0 {
8
8
// 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 ( )
10
10
} else if shl == 0 {
11
11
self
12
12
} else {
13
13
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) ,
16
16
)
17
17
}
18
18
}
@@ -28,16 +28,16 @@ trait Ashr: DInt {
28
28
let n_h = Self :: H :: BITS ;
29
29
if shr & n_h != 0 {
30
30
Self :: from_lo_hi (
31
- self . hi ( ) >> ( shr - n_h) ,
31
+ self . hi ( ) . wrapping_shr ( shr - n_h) ,
32
32
// smear the sign bit
33
- self . hi ( ) >> ( n_h - 1 ) ,
33
+ self . hi ( ) . wrapping_shr ( n_h - 1 ) ,
34
34
)
35
35
} else if shr == 0 {
36
36
self
37
37
} else {
38
38
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) ,
41
41
)
42
42
}
43
43
}
@@ -57,7 +57,7 @@ trait Lshr: DInt {
57
57
self
58
58
} else {
59
59
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) ,
61
61
self . hi ( ) . logical_shr ( shr) ,
62
62
)
63
63
}
0 commit comments