From 6b87a0ef202c614e370d74291c1f754492524aaf Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 4 Feb 2014 20:43:07 -0500 Subject: Introduce a generic clamp function to clean up some similarly duplicated code. --- Source/Core/AudioCommon/DPL2Decoder.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'Source/Core/AudioCommon/DPL2Decoder.cpp') diff --git a/Source/Core/AudioCommon/DPL2Decoder.cpp b/Source/Core/AudioCommon/DPL2Decoder.cpp index 97bdb5413d..0c9fd65400 100644 --- a/Source/Core/AudioCommon/DPL2Decoder.cpp +++ b/Source/Core/AudioCommon/DPL2Decoder.cpp @@ -13,6 +13,7 @@ #include #include #include "DPL2Decoder.h" +#include "MathUtil.h" #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -72,17 +73,6 @@ template static T firfilter(const T *buf, int pos, int len, int count, return T(r1+r2); } -template inline const T& limit(const T& val, const T& min, const T& max) -{ - if (val < min) { - return min; - } else if (val > max) { - return max; - } else { - return val; - } -} - /* // Hamming // 2*pi*k @@ -133,7 +123,7 @@ float* design_fir(unsigned int *n, float* fc, float opt) // Sanity check if(*n==0) return NULL; - fc[0]=limit(fc[0],float(0.001),float(1)); + MathUtil::Clamp(fc[0],float(0.001),float(1)); float *w=(float*)calloc(sizeof(float),*n); -- cgit v1.2.3