[LAU] OT(ish): Strange coding problem (audio related)

fons at kokkinizita.net fons at kokkinizita.net
Sat Jan 29 12:46:19 UTC 2011


On Sat, Jan 29, 2011 at 01:22:10PM +0100, Philipp Überbacher wrote:

> I thought that log2() might use a different routine if the argument is a
> power of 2. I guess that even if it does it's nothing to rely on because
> another libm implementation might not do the same thing.

There are very good reasons why math routines don't do such things.
 
> Why did you choose 1e-6 specifically?

It does the job. 1e-6f will also work for single precision.
 
> ...  Without optimisation the output is quite
> different, but beginning with -O2 the machine code appears all the same.

That could well be completely different on an another CPU and compiler,
and even more so if tested ***in context***. Such tests are really
pointless, in particular if you consider the actual use of this code.
It isn't executed 100 times for each audio sample.
 
> If the optimised code really is the same is it worth it to use funky bit
> shifting operations?

There's nothing funky about them, they are part of C and C++.

Ciao,

-- 
FA

There are three of them, and Alleline.



More information about the Linux-audio-user mailing list