auto merge of #19031 : nodakai/rust/libcore-pow-and-sq, r=bjz
[breaking-change] Deprecates `core::num::pow` in favor of `Int::pow`.
This commit is contained in:
commit
d7a29d87ba
4 changed files with 33 additions and 28 deletions
|
|
@ -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));});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue