aboutsummaryrefslogtreecommitdiff
path: root/freqshift~.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-11-20 18:49:27 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-11-20 18:49:27 +0000
commitcb6781e80a8daebc0285ff3d1c8d8ab464182fca (patch)
tree6db2913dd9c510ef4a15d3890b10ad2b77a2d079 /freqshift~.c
parent97c581bb050d83b7f1af814cb813ddb46d2fd137 (diff)
fix type-punning issues
svn path=/trunk/externals/sigpack/; revision=16564
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