Shared Rust kernels
ported/gcd_lcm_common
All modules · quoted at commit 9e1884369a67 of DnaCalc/DnaCalc. Comments are the source's own.
gcd_int · 8 lines · calc-func/src/ported/gcd_lcm_common.rs on GitHubpub fn gcd_int(mut a: i64, mut b: i64) -> i64 {
while b != 0 {
let r = a % b;
a = b;
b = r;
}
a.abs()
}
Used by 2 functions.