From cb6781e80a8daebc0285ff3d1c8d8ab464182fca Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 20 Nov 2012 18:49:27 +0000 Subject: fix type-punning issues svn path=/trunk/externals/sigpack/; revision=16564 --- freqshift~.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'freqshift~.c') 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 -- cgit v1.2.1