diff options
| author | NODA, Kai <nodakai@gmail.com> | 2014-11-17 22:12:54 +0800 |
|---|---|---|
| committer | NODA, Kai <nodakai@gmail.com> | 2014-11-18 10:42:27 +0800 |
| commit | 3fcf2840a484159c9e27601dc9480f9636d2f2e5 (patch) | |
| tree | d5533bf566c33b4c7eac0517c69bba186f05433a /src/libstd/num | |
| parent | 803aacd5aef78f90fdd06ae7653fc20eec224992 (diff) | |
| download | rust-3fcf2840a484159c9e27601dc9480f9636d2f2e5.tar.gz rust-3fcf2840a484159c9e27601dc9480f9636d2f2e5.zip | |
libcore: add num::Int::pow() and deprecate num::pow().
Signed-off-by: NODA, Kai <nodakai@gmail.com>
Diffstat (limited to 'src/libstd/num')
| -rw-r--r-- | src/libstd/num/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 2ce6c0e6e71..f49b2b0deed 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -757,7 +757,7 @@ mod tests { } macro_rules! assert_pow( (($num:expr, $exp:expr) => $expected:expr) => {{ - let result = pow($num, $exp); + let result = $num.pow($exp); assert_eq!(result, $expected); assert_eq!(result, naive_pow($num, $exp)); }} @@ -775,12 +775,12 @@ mod tests { mod bench { extern crate test; use self::test::Bencher; - use num; + use num::Int; use prelude::*; #[bench] fn bench_pow_function(b: &mut Bencher) { let v = Vec::from_fn(1024u, |n| n); - b.iter(|| {v.iter().fold(0u, |old, new| num::pow(old, *new));}); + b.iter(|| {v.iter().fold(0u, |old, new| old.pow(*new));}); } } |
