Erik de Castro Lopo wrote:
static inline
float
undenormalise(volatile float s)
{
s += 9.8607615E-32f;
return s - 9.8607615E-32f;
}
That looks OK to me, and the optimiser should not discard it because s
is volatile. Have you looked at the assembler output?
I used this new function and set all undenormalize calls in the freeverb
source code to the form:
x = undenormalize(x)
The problem is MUCH better, now the DSP% only hits 60% instead of
zooming past 80-90%, and ardour doesn't zombify. Almost useful... But
I do get xruns. There must be some other place where undenormalize
needs to be called, or perhaps the new inline function is still not
working quite right.
The static inline function you have above should be
OK. Look at the
assembler output (use gcc -S to generate assembler) to make sure that
the addition and subtraction isn't being optimised out.
What exactly am I looking for? After using g++ -S, the allpass.o file,
for example, starts out with:
.file "allpass.cpp"
.text
.align 2
.p2align 2,,3
.globl _ZN7allpassC2Ev
.type _ZN7allpassC2Ev, @function
_ZN7allpassC2Ev:
.LFB11:
pushl %ebp
.LCFI0:
movl %esp, %ebp
[snip]
Thanks for your help!
Neil