noise generation, 'C' code
Phil Burk
philburk at softsynth.com
Mon Sep 6 11:56:27 EDT 1999
James McCartney wrote:
>
> At 6:22 PM -0600 9/5/99, Phil Burk wrote:
> >Sadly, since I am not writing pure Macintosh code I can't rely on the
> >snazzy PPC instruction to count leading zeros. So I am using an
> >inefficient high level loop to count trailing zeros. This loop fails
> >when the counter is zero so I have to check for zero anyway.
>
> I knew there had to be such an instruction, so I downloaded the
> x86 manual..
I'll bet you were awed by its beauty and simplicity. ;-)
I'm trying to keep my code portable. That's why I used pure 'C' for the
program I posted. That'll make it easier for folks who want to port to
Java or other targets. But I might hack some assembly inside JSyn if the
speedup is significant, which it probably is.
> On pages 80 and 81 of the Intel Architecture Software Developer's manual
> volume 2, Instruction Set Reference, can be found the BSF instruction,
> Bit Scan Forward, which counts trailing zeroes. This instruction is
> also undefined if the counter is zero, however if you OR the counter
> as described above, then that will never be a problem.
Thanks for the tip.
--
Phil Burk
SoftSynth.com
mailto:philburk at softsynth.com
http://www.softsynth.com
dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/
More information about the music-dsp
mailing list