summaryrefslogtreecommitdiff
path: root/muse_qt4_evolution/plugins/freeverb/denormals.h
blob: 37d3ed27476de538f75972e1b55bcbc69e200378 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Macro for killing denormalled numbers
//
// Written by Jezar at Dreampoint, June 2000
// http://www.dreampoint.co.uk
// Based on IS_DENORMAL macro by Jon Watte
// This code is public domain

#ifndef _denormals_
#define _denormals_

// this does not work with at least gcc3.3 and -O2:
// #define undenormalise(sample) if(((*(unsigned int*)&sample)&0x7f800000)==0) sample=0.0f
//
// from Laurent de Soras Paper: Denormal numbers in floating point
//    signal processing applications
// (ws)

#if 0
#define undenormalise(sample)       \
      {                             \
      float anti_denormal = 1e-18;  \
      sample += anti_denormal;      \
      sample -= anti_denormal;      \
      }
#endif

// from beast-0.7.2  (Tim Janik/Stefan Westerfeld):

#define undenormalise(sample)       \
      do {                             \
            volatile float __forced_float = 1e-29 + sample;  \
            sample = __forced_float - 1e-29;      \
      } while (0)

#endif//_denormals_

//ends