From e6ad5b9ed2574dbcfeea825a96f4f8247e9a08bd Mon Sep 17 00:00:00 2001
From: "Dipl.-Ing. Jonas Stienen" <jst@akustik.rwth-aachen.de>
Date: Thu, 5 Apr 2018 10:56:32 +0200
Subject: [PATCH] Fixing some include-related bugs and namespace problems with
 math.h

---
 include/ITANumericUtils.h |  1 +
 src/ITAHDFTSpectrum.cpp   | 11 ++++++-----
 src/ITAInterpolation.cpp  |  4 +++-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/ITANumericUtils.h b/include/ITANumericUtils.h
index 1f7ae2e..f527f4a 100644
--- a/include/ITANumericUtils.h
+++ b/include/ITANumericUtils.h
@@ -45,6 +45,7 @@ ITA_BASE_API bool isPow2( unsigned int x );
 ITA_BASE_API unsigned int nextPow2( unsigned int x );
 
 // Rundung auf Compilern definieren die dies nicht standardmäßig mitliefern
+// not so nice!! consider namespacing this very typical function names
 
 #ifndef HAVE_ROUND
 ITA_BASE_API inline double round( double x )
diff --git a/src/ITAHDFTSpectrum.cpp b/src/ITAHDFTSpectrum.cpp
index b7fdfd8..08c765e 100644
--- a/src/ITAHDFTSpectrum.cpp
+++ b/src/ITAHDFTSpectrum.cpp
@@ -1,14 +1,15 @@
 #include <ITAHDFTSpectrum.h>
 
 #include <ITAFastMath.h>
-#include <stdio.h>
 #include <ITAException.h>
 #include <ITAStringUtils.h>
-#include <cmath>
-#include <complex>
-#include <math.h>
 #include <ITANumericUtils.h>
-#include "ITASampleBuffer.h"
+#include <ITASampleBuffer.h>
+
+#include <cmath>
+#include <cmath>
+#include <stdio.h>
+
 
 ITAHDFTSpectrum::ITAHDFTSpectrum()
 	: m_iSize( 0 )
diff --git a/src/ITAInterpolation.cpp b/src/ITAInterpolation.cpp
index 155b7d1..15f9a93 100644
--- a/src/ITAInterpolation.cpp
+++ b/src/ITAInterpolation.cpp
@@ -2,8 +2,10 @@
 
 #include <ITAConstants.h>
 #include <ITASampleBuffer.h>
+#include <ITANumericUtils.h>
 
 #include <cassert>
+
 // Calculate cubic spline set (second derivatives, ypp) for equidistant data
 void spline_cubic_set_equidistant( const int n, const float* y, float* ypp );
 
@@ -98,7 +100,7 @@ bool CITASampleLinearInterpolation::Interpolate( const ITASampleBuffer* pInput,
 
 			if( i == iOutputLength - 1 )
 			{
-				assert( x_input == ( float ) iInputLength - iInputStartOffset );
+				assert( std::lroundf( x_input ) == iInputLength - iInputStartOffset );
 			}
 
 			// Linkes/rechtes Nachbarsample in der Eingabe
-- 
GitLab