[LAD] Floating point Denormals: C++ and Waf

David Robillard d at drobilla.net
Thu Aug 2 18:52:32 UTC 2012


On Thu, 2012-08-02 at 20:31 +0200, Martin Homuth-Rosemann wrote:
[...]
> // denormals are zero
> static inline float daz( float f )
> {
>    // define an aliasing type to perform a "reinterpret cast"
>    typedef __u32 __attribute__ (( __may_alias__ )) u32bit;
>    if ( *( (u32bit*)&f ) & 0x7F000000 ) // E > 1 : normal.
>      return f;
>    else // E <= 1 : zero or _almost_ denormal
>         // (may become denormal with next operation)
>      return 0.0;
> }
[...]
> float reverb( float xin )
> {
>    static float yout = 0.0;
>    static float xv0, xv1, yv0, yv1;
>    float x, y;
> 
>    // additional feedback
>    x  = daz( xin/8 + yout/64 );

Branch per sample, eeck...

-dr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20120802/2153eef4/attachment.pgp>


More information about the Linux-audio-dev mailing list