On Sun, 11 Sep 2005, IOhannes m zmoelnig wrote:
Tim Blechmann wrote:
hi miller, hi devs ... the current implementation of rsqrt~ is most likely broken. i was sshing to carmen's amd64 machine ... looked like that filling the lookup table isn't really working ...
hmm, it seems that my 32bit and my 64bit machines are producing the same results when using [rsqrt~] so why do you think that it is broken ? do you have a test patch exhibiting wrong behaviour ?
You have to compile pd as 64-bit for the bug to happen.
Because ix86 is little-endian, the result of writing a long in the float variable does the right thing and so it might very well work, depending on how the compiler did the job. however, it's a case of buffer overflow, because 64 bits are written to stack instead of 32 bits, so any other variable on the same stack frame might get clobbered.
In this case, there are three variables in that frame. The two 32 bit variables will most likely be put next to each other for alignment reasons. If the loop counter (i) is just after the float (f) then the loop will run forever because the buffer overflow will cause i to get assigned 0 over and over.
____________________________________________________________________ Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju Freelance Digital Arts Engineer, Montréal QC Canada