summaryrefslogtreecommitdiffstats
path: root/src/synth_math.h
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2023-06-27 22:37:53 +0300
committergramanas <anastasis.gramm2@gmail.com>2023-06-27 22:37:53 +0300
commit60c82a72fedd719f69c1f1de896aca00784a2881 (patch)
tree3679e0886fc12aa8eeeab60260347ee7a0c5ae0e /src/synth_math.h
parente77d4d42cacd21bf80e4f47cba2fe85f5a5b0991 (diff)
downloadsynth-project-60c82a72fedd719f69c1f1de896aca00784a2881.tar.gz
synth-project-60c82a72fedd719f69c1f1de896aca00784a2881.tar.bz2
synth-project-60c82a72fedd719f69c1f1de896aca00784a2881.zip
Changes
Diffstat (limited to 'src/synth_math.h')
-rw-r--r--src/synth_math.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/synth_math.h b/src/synth_math.h
index 74dec4c..2dd9f83 100644
--- a/src/synth_math.h
+++ b/src/synth_math.h
@@ -18,14 +18,14 @@ gcd(long long a, long long b)
static long long
lcm(long long a, long long b)
{
- return (a / gcd(a, b)) * b;
+ return (a / gcd(a, b)) * b;
}
static float
-clamp(float f)
+clamp(float f, int min, int max)
{
- if (f <= -1) return -0.9999;
- if (f >= 1) return 0.9999;
+ if (f <= min) return min + 0.0001;
+ if (f >= max) return max - 0.0001;
return f;
}