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

From: <fons@email-addr-hidden>
Date: Sat Jan 29 2011 - 14:46:19 EET

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.
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Sat Jan 29 16:15:05 2011

This archive was generated by hypermail 2.1.8 : Sat Jan 29 2011 - 16:15:05 EET