aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2012-03-27 16:10:07 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2012-03-27 16:10:07 +0000
commit8a19a871893574f2eb5c34f8167d25e89228e81e (patch)
tree4e8287737177176bdcbf2c9ac1c0d772a104f49e
parent32d97a1eae81247c9cf5202728ec326eea458924 (diff)
avoid type-punning tricks
at least on x86_64 svn path=/trunk/externals/iem/iem_spec2/; revision=16098
-rw-r--r--src/spec2_sqrt~.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/spec2_sqrt~.c b/src/spec2_sqrt~.c
index c23de59..275b9b0 100644
--- a/src/spec2_sqrt~.c
+++ b/src/spec2_sqrt~.c
@@ -18,6 +18,7 @@ static t_float spec2_rsqrt_exptab[SPEC2DUMTAB1SIZE], spec2_rsqrt_mantissatab[SPE
static void init_spec2_rsqrt(void)
{
+#ifndef __x86_64__
int i;
for (i=0; i<SPEC2DUMTAB1SIZE; i++)
@@ -35,6 +36,7 @@ static void init_spec2_rsqrt(void)
spec2_rsqrt_mantissatab[i] = 1.0f / sqrt(f);
}
+#endif
}
typedef struct _spec2_sqrt_tilde
@@ -51,6 +53,14 @@ static t_int *spec2_sqrt_tilde_perform(t_int *w)
while(n--)
{
+#ifdef __x86_64__
+ t_sample f = *in++;
+ if (f<0.f) {
+ *out++=0.f;
+ } else {
+ *out++=sqrtf(f);
+ }
+#else
t_float f = *in;
long l = *(long *)(in++);
@@ -62,6 +72,7 @@ static t_int *spec2_sqrt_tilde_perform(t_int *w)
*out++ = f*g*(1.5f - 0.5f*g*g*f);
}
+#endif
}
return(w+4);
}