feat: implement u128 and i128 operations for BigInt
This commit is contained in:
parent
f3b1e7c1a2
commit
bdb187d1ee
@ -1468,6 +1468,7 @@ impl Mul<u64> for BigInt {
|
||||
}
|
||||
|
||||
impl MulAssign<u64> for BigInt {
|
||||
<<<<<<< HEAD
|
||||
#[inline]
|
||||
fn mul_assign(&mut self, other: u64) {
|
||||
self.data *= other;
|
||||
@ -1481,6 +1482,21 @@ impl Mul<u128> for BigInt {
|
||||
type Output = BigInt;
|
||||
|
||||
#[inline]
|
||||
=======
|
||||
#[inline]
|
||||
fn mul_assign(&mut self, other: u64) {
|
||||
self.data *= other;
|
||||
if self.data.is_zero() {
|
||||
self.sign = NoSign;
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(has_i128)]
|
||||
impl Mul<u128> for BigInt {
|
||||
type Output = BigInt;
|
||||
|
||||
#[inline]
|
||||
>>>>>>> feat: implement u128 and i128 operations for BigInt
|
||||
fn mul(self, other: u128) -> BigInt {
|
||||
BigInt::from_biguint(self.sign, self.data * other)
|
||||
}
|
||||
@ -1611,6 +1627,7 @@ impl Div<u32> for BigInt {
|
||||
BigInt::from_biguint(self.sign, self.data / other)
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
impl DivAssign<u32> for BigInt {
|
||||
#[inline]
|
||||
@ -1631,6 +1648,28 @@ impl Div<BigInt> for u32 {
|
||||
}
|
||||
}
|
||||
|
||||
=======
|
||||
|
||||
impl DivAssign<u32> for BigInt {
|
||||
#[inline]
|
||||
fn div_assign(&mut self, other: u32) {
|
||||
self.data /= other;
|
||||
if self.data.is_zero() {
|
||||
self.sign = NoSign;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<BigInt> for u32 {
|
||||
type Output = BigInt;
|
||||
|
||||
#[inline]
|
||||
fn div(self, other: BigInt) -> BigInt {
|
||||
BigInt::from_biguint(other.sign, self / other.data)
|
||||
}
|
||||
}
|
||||
|
||||
>>>>>>> feat: implement u128 and i128 operations for BigInt
|
||||
impl Div<u64> for BigInt {
|
||||
type Output = BigInt;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user