pub fn times<T, U>(a: T, p: U) -> T where
    T: Sized + Zero + for<'x> AddAssign<&'x T> + for<'x> From<<&'x T as Add>::Output>,
    for<'x> &'x T: Add,
    U: Sized + Zero + One + Eq + for<'x> ShrAssign<usize> + for<'x> From<<&'x U as BitAnd>::Output>,
    for<'x> &'x U: BitAnd
Expand description

calcurate $pa$ with mutliprecation by doubling

use ring_algorithm::times;
assert_eq!(times::<i32, u64>(2, 16), 32);