File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -402,11 +402,11 @@ impl DInt64 {
402
402
}
403
403
404
404
let c: u64 = if b < 0 { -b } else { b } as u64 ;
405
- let sign = if b < 0 { ! self . sign } else { self . sign } ;
405
+ let sign = if b < 0 { ( self . sign == 0 ) as u64 } else { self . sign } ;
406
406
407
407
let mut t = self . hi as u128 * c as u128 ;
408
408
409
- let mut m = if t >> 64 != 0 { ( t >> 64 ) . leading_zeros ( ) } else { 64 } ;
409
+ let mut m = if t >> 64 != 0 { t . hi ( ) . leading_zeros ( ) } else { 64 } ;
410
410
411
411
t <<= m;
412
412
@@ -415,8 +415,9 @@ impl DInt64 {
415
415
let mut l: u128 = self . lo as u128 * c as u128 ;
416
416
l = ( l << ( m - 1 ) ) >> 63 ;
417
417
418
- t = l + t;
419
- if t != 0 {
418
+ let oflow;
419
+ ( t, oflow) = l. overflowing_add ( t) ;
420
+ if oflow {
420
421
t += t & 0x1 ;
421
422
t = 1u128 << 127 | t >> 1 ;
422
423
m -= 1 ;
You can’t perform that action at this time.
0 commit comments