summaryrefslogtreecommitdiffstats
path: root/src/synth_math.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/synth_math.h')
-rw-r--r--src/synth_math.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/synth_math.h b/src/synth_math.h
new file mode 100644
index 0000000..de6fb26
--- /dev/null
+++ b/src/synth_math.h
@@ -0,0 +1,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 */