summaryrefslogtreecommitdiffstats
path: root/src/synth_math.h
blob: de6fb26677fe5354b3d82600c39fa47dcae0b8b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef SYNTH_MATH_H
#define SYNTH_MATH_H

extern long long
gcd(long long int a, long long int b)
{
   long long rem;
   rem=a-(a/b*b);
   if(rem==0)
      return b;
   else
      gcd(b,rem);
}
 
// Function to return LCM of two numbers
extern long long
lcm(long long a, long long b)
{
    return (a / gcd(a, b)) * b;
}
  
#endif /* SYNTH_MATH_H */