aboutsummaryrefslogtreecommitdiff
path: root/freqshift~.c
diff options
context:
space:
mode:
Diffstat (limited to 'freqshift~.c')
-rw-r--r--freqshift~.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/freqshift~.c b/freqshift~.c
index 026e4cb..fe99884 100644
--- a/freqshift~.c
+++ b/freqshift~.c
@@ -99,11 +99,22 @@ static float f_clamp(float x, float a, float b)
return x;
}
+static int f_round(t_float f) {
+#if PD_FLOAT_PRECISION == 64
+ return (int)lround(f);
+#else
+ return (int)lroundf(f);
+#endif
+}
+
+// this relies on type-punning, which is not allowed in C99 or 64-bit
+#if 0
// Round float to int using IEEE int* hack
static int f_round(float f) {
f += (3<<22);
return *((int*)&f) - 0x4b400000;
}
+#endif
// Cubic interpolation function
static float cube_interp(const float fr, const float inm1, const float