Skip to content

Commit a9bc5f5

Browse files
committed
unbreak on older Rust
1 parent 2200568 commit a9bc5f5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/power.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use traits::Zero;
1+
use traits::{Zero, checked_pow};
22

33
use Integer;
44

@@ -97,7 +97,7 @@ macro_rules! impl_Power {
9797
let mut a = None;
9898
while !n.is_zero() {
9999
a = Some(a.map_or(0, |a| a+1));
100-
n /= other;
100+
n /= *other;
101101
}
102102
a
103103
}
@@ -106,13 +106,14 @@ macro_rules! impl_Power {
106106
fn checked_next_power_of(&self, other: &Self) -> Option<Self> {
107107
self.checked_sub(1)
108108
.map_or(Some(1), |new|
109-
traits::checked_pow(*other,
110-
new.checked_log(other)
111-
.map_or(0, |a| a as Self + 1) as usize))
109+
checked_pow(*other, new.checked_log(other)
110+
.map_or(0, |a| a as Self + 1) as usize))
112111
}
113112
});
114113

115114
($($t:ty),*) => { $(impl_Power!($t);)* };
116115
}
117116

118-
impl_Power!(usize, u8, u16, u32, u64, u128);
117+
impl_Power!(usize, u8, u16, u32, u64);
118+
#[cfg(has_i128)]
119+
impl_Power!(u128);

0 commit comments

Comments
 (0)