math: converted gcd and lcm to support i64

pull/964/head
archanpatkar 2019-07-03 22:21:03 +05:30 committed by Alexander Medvednikov
parent 290e1df893
commit ffb4da791d
1 changed files with 2 additions and 2 deletions

View File

@ -106,7 +106,7 @@ pub fn fmod(a, b f64) f64 {
}
// gcd calculates greatest common (positive) divisor (or zero if a and b are both zero).
pub fn gcd(a, b int) int {
pub fn gcd(a, b i64) i64 {
if a < 0 {
a = -a
}
@ -124,7 +124,7 @@ pub fn gcd(a, b int) int {
}
// lcm calculates least common (non-negative) multiple.
pub fn lcm(a, b int) int {
pub fn lcm(a, b i64) i64 {
if a == 0 {
return a
}