From 272d6edb79af3bd2fe3e95a862a6e42f50ffc2c7 Mon Sep 17 00:00:00 2001 From: gifnksm Date: Thu, 6 Nov 2014 22:09:03 +0900 Subject: [PATCH] Update to latest rustc --- src/bigint.rs | 26 +++++++++++++------------- src/integer.rs | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/bigint.rs b/src/bigint.rs index 5c887ed..9226d9e 100644 --- a/src/bigint.rs +++ b/src/bigint.rs @@ -446,7 +446,7 @@ impl Integer for BigUint { shift += 1; } assert!(shift < BigDigit::bits); - let (d, m) = div_mod_floor_inner(self << shift, other << shift); + let (d, m) = div_mod_floor_inner(*self << shift, *other << shift); return (d, m >> shift); @@ -990,9 +990,9 @@ impl Add for BigInt { (NoSign, _) => other.clone(), (_, NoSign) => self.clone(), (Plus, Plus) => BigInt::from_biguint(Plus, self.data + other.data), - (Plus, Minus) => self - (-*other), - (Minus, Plus) => other - (-*self), - (Minus, Minus) => -((-self) + (-*other)) + (Plus, Minus) => *self - (-*other), + (Minus, Plus) => *other - (-*self), + (Minus, Minus) => -((-*self) + (-*other)) } } } @@ -1001,16 +1001,16 @@ impl Sub for BigInt { #[inline] fn sub(&self, other: &BigInt) -> BigInt { match (self.sign, other.sign) { - (NoSign, _) => -other, + (NoSign, _) => -*other, (_, NoSign) => self.clone(), (Plus, Plus) => match self.data.cmp(&other.data) { Less => BigInt::from_biguint(Minus, other.data - self.data), Greater => BigInt::from_biguint(Plus, self.data - other.data), Equal => Zero::zero() }, - (Plus, Minus) => self + (-*other), - (Minus, Plus) => -((-self) + *other), - (Minus, Minus) => (-other) - (-*self) + (Plus, Minus) => *self + (-*other), + (Minus, Plus) => -((-*self) + *other), + (Minus, Minus) => (-*other) - (-*self) } } } @@ -1129,7 +1129,7 @@ impl Integer for BigInt { (Minus, Plus) => if m.is_zero() { (-d, Zero::zero()) } else { - (-d - One::one(), other - m) + (-d - One::one(), *other - m) }, (Minus, Minus) => (d, -m) } @@ -2562,7 +2562,7 @@ mod bigint_tests { assert_eq!(m.sign, b.sign); } assert!(m.abs() <= b.abs()); - assert!(*a == b * d + m); + assert!(*a == (*b) * d + m); assert!(d == *ans_d); assert!(m == *ans_m); } @@ -2575,8 +2575,8 @@ mod bigint_tests { check_sub(&a.neg(), &b.neg(), d, m); } else { check_sub(a, b, d, m); - check_sub(a, &b.neg(), &(d.neg() - One::one()), &(m - *b)); - check_sub(&a.neg(), b, &(d.neg() - One::one()), &(b - *m)); + check_sub(a, &b.neg(), &(d.neg() - One::one()), &(*m - *b)); + check_sub(&a.neg(), b, &(d.neg() - One::one()), &(*b - *m)); check_sub(&a.neg(), &b.neg(), d, &m.neg()); } } @@ -2613,7 +2613,7 @@ mod bigint_tests { assert_eq!(r.sign, a.sign); } assert!(r.abs() <= b.abs()); - assert!(*a == b * q + r); + assert!(*a == (*b) * q + r); assert!(q == *ans_q); assert!(r == *ans_r); } diff --git a/src/integer.rs b/src/integer.rs index b06e2b4..9621d4a 100644 --- a/src/integer.rs +++ b/src/integer.rs @@ -246,7 +246,7 @@ macro_rules! impl_integer_for_int { /// Returns `true` if the number is divisible by `2` #[inline] - fn is_even(&self) -> bool { self & 1 == 0 } + fn is_even(&self) -> bool { (*self) & 1 == 0 } /// Returns `true` if the number is not divisible by `2` #[inline] @@ -418,11 +418,11 @@ macro_rules! impl_integer_for_uint { /// Returns `true` if the number is divisible by `2`. #[inline] - fn is_even(&self) -> bool { self & 1 == 0 } + fn is_even(&self) -> bool { (*self) & 1 == 0 } /// Returns `true` if the number is not divisible by `2`. #[inline] - fn is_odd(&self) -> bool { !self.is_even() } + fn is_odd(&self) -> bool { !(*self).is_even() } } #[cfg(test)]