pub fn gcd<T>(x: T, y: T) -> T where
    T: Sized + Zero,
    for<'x> &'x T: Rem<Output = T>, 
Expand description

calcurate greatest common divisor

use ring_algorithm::gcd;
assert_eq!(gcd::<i32>(15, 21), 3);
assert_eq!(gcd::<i32>(14, 15), 1);
assert_eq!(gcd::<i32>(0, 42), 42);
assert_eq!(gcd::<i32>(0, 0), 0);