From 1c4fb909ffad8328983d893f2fefdb17215f2b21 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 27 Feb 2015 21:04:15 +0100 Subject: Make Int::pow() take exp as u32 instead usize --- src/libcore/num/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libcore/num') diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index b1039f79f23..318799f59a8 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -372,9 +372,10 @@ pub trait Int #[unstable(feature = "core", reason = "pending integer conventions")] #[inline] - fn pow(self, mut exp: uint) -> Self { + fn pow(self, mut exp: u32) -> Self { let mut base = self; let mut acc: Self = Int::one(); + while exp > 0 { if (exp & 1) == 1 { acc = acc * base; -- cgit 1.4.1-3-g733a5