From e4a4defaba431149f0b595720402bf6190921416 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 21 Sep 2008 09:59:43 +0000 Subject: [PATCH] fixed strict aliasing violation git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1659 0778d3d1-df1d-0410-868b-ea421aaaa00d --- .../ladspa_effect/cmt/src/freeverb/Components/allpass.h | 2 +- plugins/ladspa_effect/cmt/src/freeverb/Components/comb.h | 4 ++-- .../ladspa_effect/cmt/src/freeverb/Components/denormals.h | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/ladspa_effect/cmt/src/freeverb/Components/allpass.h b/plugins/ladspa_effect/cmt/src/freeverb/Components/allpass.h index 853c7d41e..d743aee73 100644 --- a/plugins/ladspa_effect/cmt/src/freeverb/Components/allpass.h +++ b/plugins/ladspa_effect/cmt/src/freeverb/Components/allpass.h @@ -33,7 +33,7 @@ inline float allpass::process(float input) float bufout; bufout = buffer[bufidx]; - undenormalise(bufout); + undenormalise(&bufout); output = -input + bufout; buffer[bufidx] = input + (bufout*feedback); diff --git a/plugins/ladspa_effect/cmt/src/freeverb/Components/comb.h b/plugins/ladspa_effect/cmt/src/freeverb/Components/comb.h index 4a73b615f..6258a03c1 100644 --- a/plugins/ladspa_effect/cmt/src/freeverb/Components/comb.h +++ b/plugins/ladspa_effect/cmt/src/freeverb/Components/comb.h @@ -38,10 +38,10 @@ inline float comb::process(float input) float output; output = buffer[bufidx]; - undenormalise(output); + undenormalise(&output); filterstore = (output*damp2) + (filterstore*damp1); - undenormalise(filterstore); + undenormalise(&filterstore); buffer[bufidx] = input + (filterstore*feedback); diff --git a/plugins/ladspa_effect/cmt/src/freeverb/Components/denormals.h b/plugins/ladspa_effect/cmt/src/freeverb/Components/denormals.h index e10be2ff6..01990916a 100755 --- a/plugins/ladspa_effect/cmt/src/freeverb/Components/denormals.h +++ b/plugins/ladspa_effect/cmt/src/freeverb/Components/denormals.h @@ -8,7 +8,12 @@ #ifndef _denormals_ #define _denormals_ -#define undenormalise(sample) if(((*(unsigned int*)&sample)&0x7f800000)==0) sample=0.0f +/*#define undenormalise(sample) if(((*(unsigned int*)&sample)&0x7f800000)==0) sample=0.0f*/ +static void inline undenormalise(float *sample) +{ + if (((*(unsigned int*)sample) & 0x7f800000) == 0) + *sample = 0.0f; +} #endif//_denormals_