[chuck-dev] coding suggestions
Niklas Werner
bergtroll at gmx.li
Mon Jul 26 19:29:54 EDT 2004
Hi all,
I'd like to suggest the following:
use GNU getopt() for the command line options (--optionArgument is just
greatly confusing: --option Argument is so much nicer, and you get rid of
all the else if() in chuck_main.
(plus I can offer my help in converting chuck_main to getopt(), if you
want me to go ahead)
Your next_power_2() function seems to waste loads of cycles, although this
doesn't really matter, as it is only used at startup, but wouldn't that
be a nice feature for the language anyway?
Try:
/* Thanks to music-dsp mailing-list */
inline unsigned nextPowerOfTwo (unsigned n)
{
unsigned prevN;
for (prevN = n; n &= n-1; prevN = n)
;
return (prevN * 2);
}
much faster...
Cheers,
Niklas
--
Computer Music PhD-student
University of Waikato
Hamilton
New Zealand
More information about the chuck-dev
mailing list