File tree 2 files changed +7
-7
lines changed
2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ trait Ashl: DInt {
12
12
} else {
13
13
Self :: from_lo_hi (
14
14
self . lo ( ) . wrapping_shl ( shl) ,
15
- self . lo ( ) . logical_shr ( n_h - shl) | self . hi ( ) . wrapping_shl ( shl) ,
15
+ self . lo ( ) . logical_shr ( n_h. wrapping_sub ( shl) ) | self . hi ( ) . wrapping_shl ( shl) ,
16
16
)
17
17
}
18
18
}
@@ -36,7 +36,7 @@ trait Ashr: DInt {
36
36
self
37
37
} else {
38
38
Self :: from_lo_hi (
39
- self . lo ( ) . logical_shr ( shr) | self . hi ( ) . wrapping_shl ( n_h - shr) ,
39
+ self . lo ( ) . logical_shr ( shr) | self . hi ( ) . wrapping_shl ( n_h. wrapping_sub ( shr) ) ,
40
40
self . hi ( ) . wrapping_shr ( shr) ,
41
41
)
42
42
}
@@ -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 ( ) . wrapping_shl ( n_h - shr) ,
60
+ self . lo ( ) . logical_shr ( shr) | self . hi ( ) . wrapping_shl ( n_h. wrapping_sub ( shr) ) ,
61
61
self . hi ( ) . logical_shr ( shr) ,
62
62
)
63
63
}
Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ intrinsics! {
19
19
// https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/builtins/riscv/int_mul_impl.inc
20
20
pub extern "C" fn __mulsi3( a: u32 , b: u32 ) -> u32 {
21
21
let ( mut a, mut b) = ( a, b) ;
22
- let mut r = 0 ;
22
+ let mut r: u32 = 0 ;
23
23
24
24
while a > 0 {
25
25
if a & 1 > 0 {
26
- r += b ;
26
+ r = r . wrapping_add ( b ) ;
27
27
}
28
28
a >>= 1 ;
29
29
b <<= 1 ;
@@ -35,11 +35,11 @@ intrinsics! {
35
35
#[ cfg( not( target_feature = "m" ) ) ]
36
36
pub extern "C" fn __muldi3( a: u64 , b: u64 ) -> u64 {
37
37
let ( mut a, mut b) = ( a, b) ;
38
- let mut r = 0 ;
38
+ let mut r: u64 = 0 ;
39
39
40
40
while a > 0 {
41
41
if a & 1 > 0 {
42
- r += b ;
42
+ r = r . wrapping_add ( b ) ;
43
43
}
44
44
a >>= 1 ;
45
45
b <<= 1 ;
You can’t perform that action at this time.
0 commit comments