Function ring_algorithm::power
source · [−]pub fn power<T>(a: T, p: u64) -> T where
T: Sized + One + for<'x> MulAssign<&'x T>,
for<'x> &'x T: Mul<Output = T>,
Expand description
calcurate $a^p
$ with exponentiation by squaring
use ring_algorithm::power;
assert_eq!(power::<i32>(2, 16), 65536);