aboutsummaryrefslogtreecommitdiff
path: root/iemlib1/src
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2012-02-19 20:39:17 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2012-02-19 20:39:17 +0000
commita771aab0fe0e7d65d9152657f8ec342d07820ed2 (patch)
tree5d7ca202af358f14164ffab376d2135550f88377 /iemlib1/src
parentba304b8986fc2979b8145d96b1475f7078545d71 (diff)
use tabfudge rather than pointer-casts
fixes crash on amd64 svn path=/trunk/externals/iemlib/; revision=16001
Diffstat (limited to 'iemlib1/src')
-rw-r--r--iemlib1/src/iem_sqrt4~.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/iemlib1/src/iem_sqrt4~.c b/iemlib1/src/iem_sqrt4~.c
index 50d837a..f721b20 100644
--- a/iemlib1/src/iem_sqrt4~.c
+++ b/iemlib1/src/iem_sqrt4~.c
@@ -12,8 +12,8 @@ iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
/* ------------------------ iem_sqrt4~ ----------------------------- */
-t_float *iem_sqrt4_tilde_exptab=(t_float *)0L;
-t_float *iem_sqrt4_tilde_mantissatab=(t_float *)0L;
+static t_float *iem_sqrt4_tilde_exptab=(t_float *)0L;
+static t_float *iem_sqrt4_tilde_mantissatab=(t_float *)0L;
static t_class *iem_sqrt4_tilde_class;
@@ -66,16 +66,15 @@ static void iem_sqrt4_tilde_maketable(void)
{
int i;
t_float f;
- long l;
+ union tabfudge_f tf;
if(!iem_sqrt4_tilde_exptab)
{
iem_sqrt4_tilde_exptab = (t_float *)getbytes(sizeof(t_float) * IEMSQRT4TAB1SIZE);
for(i=0; i<IEMSQRT4TAB1SIZE; i++)
{
- l = (i ? (i == IEMSQRT4TAB1SIZE-1 ? IEMSQRT4TAB1SIZE-2 : i) : 1)<< 23;
- *(long *)(&f) = l;
- iem_sqrt4_tilde_exptab[i] = 1.0f/sqrt(f);
+ tf.tf_l = (i ? (i == IEMSQRT4TAB1SIZE-1 ? IEMSQRT4TAB1SIZE-2 : i) : 1)<< 23;
+ iem_sqrt4_tilde_exptab[i] = 1.0f/sqrt(tf.tf_f);
}
}
if(!iem_sqrt4_tilde_mantissatab)