[PD] iem_sqrt4~ amd_64 crasher puzzle

Jonathan Wilkes jancsika at yahoo.com
Tue Oct 7 00:09:04 CEST 2014


Hi list,[iem_sqrt4~] crashes when trying to create on amd_64.  It creates fine on 32 bit linux.
This leads me to believe there is something in the setup routine that makes an assumption that only holds true for a 32bit OS.
The only thing that stands out to me is a function called in the setup routine, posted below.  This looks particularly suspicious to my untrained eye:      *(long *)(&f) = l;Even if that's not causing the crash, what does it do?

And does that or anything stand out to anyone else?
Thanks,Jonathan

static void iem_sqrt4_tilde_maketable(void)
{
  int i;
  t_float f;
  long l;
  
  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);
    }
  }
  if(!iem_sqrt4_tilde_mantissatab)
  {
    iem_sqrt4_tilde_mantissatab = (t_float *)getbytes(sizeof(t_float) * IEMSQRT4TAB2SIZE);
    for(i=0; i<IEMSQRT4TAB2SIZE; i++)
    {
      f = 1.0f + (1.0f/(t_float)IEMSQRT4TAB2SIZE) * (t_float)i;
      iem_sqrt4_tilde_mantissatab[i] = 1.0f/sqrt(f);
    }
  }
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20141006/bd8402b6/attachment.html>


More information about the Pd-list mailing list