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

fons at kokkinizita.net fons at kokkinizita.net
Sun Jan 30 14:29:40 UTC 2011


On Sun, Jan 30, 2011 at 02:46:21PM +0100, Philipp Überbacher wrote:

> Thanks, I see this now after Peter did another test with quite different
> results. I looked at it out of context because I simply don't understand
> the context. I only know what a ft does but not how it works, nor have I
> implemented a fft, so the code with its two-letter variables is
> meaningless to me.

It's not clear if Peter's test included the '+ 1e-6'. I'd expect the
result to be correct then even with -O3. If not, increasing the added
constant should fix it.

> > There's nothing funky about them, they are part of C and C++.
> 
> They were funky to me mainly because I had to look them up but also
> because operating on the bit representation requires a different mode of
> thinking. I bet it also has its own set of pitfalls.

If your machine uses BCD integers you could have some surprises...
If you don't like m <<= 1, just write m *= 2. The compiler will
very probably use a bit shift to do this even at low optimisation
levels.

Ciao,

-- 
FA

There are three of them, and Alleline.



More information about the Linux-audio-user mailing list