diff options
| author | Marvin Löbel <loebel.marvin@gmail.com> | 2013-05-17 18:07:16 +0200 |
|---|---|---|
| committer | Marvin Löbel <loebel.marvin@gmail.com> | 2013-05-18 00:25:03 +0200 |
| commit | 916942d006ce3a551505b7b0328a82b382249b7c (patch) | |
| tree | 02e148eebdd078539de17eddb483df617d8ea50f | |
| parent | c34c5051a5f42726d34dd09b7bf0ae120800a2d4 (diff) | |
| download | rust-916942d006ce3a551505b7b0328a82b382249b7c.tar.gz rust-916942d006ce3a551505b7b0328a82b382249b7c.zip | |
Some cosmetic changes to num.rs
| -rw-r--r-- | src/libcore/num/num.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs index c661e7ea1f8..96b302d3174 100644 --- a/src/libcore/num/num.rs +++ b/src/libcore/num/num.rs @@ -396,8 +396,7 @@ pub trait FromStrRadix { /// - If code written to use this function doesn't care about it, it's /// probably assuming that `x^0` always equals `1`. /// -pub fn pow_with_uint<T:NumCast+One+Zero+Copy+Div<T,T>+Mul<T,T>>( - radix: uint, pow: uint) -> T { +pub fn pow_with_uint<T:NumCast+One+Zero+Copy+Div<T,T>+Mul<T,T>>(radix: uint, pow: uint) -> T { let _0: T = Zero::zero(); let _1: T = One::one(); @@ -405,7 +404,7 @@ pub fn pow_with_uint<T:NumCast+One+Zero+Copy+Div<T,T>+Mul<T,T>>( if radix == 0u { return _0; } let mut my_pow = pow; let mut total = _1; - let mut multiplier = cast(radix as int); + let mut multiplier = cast(radix); while (my_pow > 0u) { if my_pow % 2u == 1u { total *= multiplier; @@ -422,13 +421,13 @@ pub fn test_num<T:Num + NumCast>(ten: T, two: T) { assert_eq!(ten.add(&two), cast(12)); assert_eq!(ten.sub(&two), cast(8)); assert_eq!(ten.mul(&two), cast(20)); - assert_eq!(ten.div(&two), cast(5)); + assert_eq!(ten.div(&two), cast(5)); assert_eq!(ten.rem(&two), cast(0)); assert_eq!(ten.add(&two), ten + two); assert_eq!(ten.sub(&two), ten - two); assert_eq!(ten.mul(&two), ten * two); - assert_eq!(ten.div(&two), ten / two); + assert_eq!(ten.div(&two), ten / two); assert_eq!(ten.rem(&two), ten % two); } |
