File tree 1 file changed +1
-20
lines changed
1 file changed +1
-20
lines changed Original file line number Diff line number Diff line change @@ -733,28 +733,9 @@ fn udiv_1e19(n: u128) -> (u128, u64) {
733
733
let quot = if n < 1 << 83 {
734
734
( ( n >> 19 ) as u64 / ( DIV >> 19 ) ) as u128
735
735
} else {
736
- u128_mulhi ( n , FACTOR ) >> 62
736
+ n . widening_mul ( FACTOR ) . 1 >> 62
737
737
} ;
738
738
739
739
let rem = ( n - quot * DIV as u128 ) as u64 ;
740
740
( quot, rem)
741
741
}
742
-
743
- /// Multiply unsigned 128 bit integers, return upper 128 bits of the result
744
- #[ inline]
745
- fn u128_mulhi ( x : u128 , y : u128 ) -> u128 {
746
- let x_lo = x as u64 ;
747
- let x_hi = ( x >> 64 ) as u64 ;
748
- let y_lo = y as u64 ;
749
- let y_hi = ( y >> 64 ) as u64 ;
750
-
751
- // handle possibility of overflow
752
- let carry = ( x_lo as u128 * y_lo as u128 ) >> 64 ;
753
- let m = x_lo as u128 * y_hi as u128 + carry;
754
- let high1 = m >> 64 ;
755
-
756
- let m_lo = m as u64 ;
757
- let high2 = ( x_hi as u128 * y_lo as u128 + m_lo as u128 ) >> 64 ;
758
-
759
- x_hi as u128 * y_hi as u128 + high1 + high2
760
- }
You can’t perform that action at this time.
0 commit comments