1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-23 18:52:28 -04:00

Define _USE_MATH_DEFINES and clean M_PI redefinitions

This commit is contained in:
Kacper Michajłow 2020-11-03 13:52:12 +01:00 committed by f4exb
parent a9d09e30a8
commit 1e5ae8ea0f
31 changed files with 37 additions and 87 deletions

View File

@ -58,6 +58,11 @@ add_definitions("-DCOPYRIGHT=\"${COPYRIGHT}\"")
set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}") set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}")
add_definitions("-DIDENTIFIER=\"${IDENTIFIER}\"") add_definitions("-DIDENTIFIER=\"${IDENTIFIER}\"")
add_compile_definitions(_USE_MATH_DEFINES)
if(WIN32)
add_compile_definitions(NOMINMAX)
endif()
find_package(Git) find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/") if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/")
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags

View File

@ -16,7 +16,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#define _USE_MATH_DEFINES
#include <cmath> #include <cmath>
#include "device/deviceuiset.h" #include "device/deviceuiset.h"

View File

@ -19,15 +19,10 @@
#include "../../channelrx/demodbfm/rdsdemod.h" #include "../../channelrx/demodbfm/rdsdemod.h"
#include <QDebug> #include <QDebug>
#include <math.h> #include <cmath>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#undef M_PI
#define M_PI 3.14159265358979323846
#undef M_PI_2
#define M_PI_2 1.57079632679489661923
const Real RDSDemod::m_pllBeta = 50; const Real RDSDemod::m_pllBeta = 50;
const Real RDSDemod::m_fsc = 1187.5; const Real RDSDemod::m_fsc = 1187.5;

View File

@ -17,17 +17,14 @@
#ifndef LEANSDR_DVB_H #ifndef LEANSDR_DVB_H
#define LEANSDR_DVB_H #define LEANSDR_DVB_H
#include <stdint.h> #include <cmath>
#include <cstdint>
#include "leansdr/convolutional.h" #include "leansdr/convolutional.h"
#include "leansdr/rs.h" #include "leansdr/rs.h"
#include "leansdr/sdr.h" #include "leansdr/sdr.h"
#include "leansdr/viterbi.h" #include "leansdr/viterbi.h"
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
namespace leansdr namespace leansdr
{ {

View File

@ -17,13 +17,9 @@
#ifndef LEANSDR_MATH_H #ifndef LEANSDR_MATH_H
#define LEANSDR_MATH_H #define LEANSDR_MATH_H
#include <math.h> #include <cmath>
#include <stdint.h> #include <stdint.h>
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
namespace leansdr namespace leansdr
{ {

View File

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <stdio.h> #include <cstdio>
#include <complex.h> #include <complex.h>
#include <QTime> #include <QTime>

View File

@ -15,7 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#define _USE_MATH_DEFINES
#include <cmath> #include <cmath>
#include "packetmodbpfdialog.h" #include "packetmodbpfdialog.h"
#include "ui_packetmodbpfdialog.h" #include "ui_packetmodbpfdialog.h"

View File

@ -15,9 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h> #include <cstdio>
#include <stdio.h>
#include <errno.h> #include <errno.h>
#include "testsourceworker.h" #include "testsourceworker.h"

View File

@ -25,8 +25,7 @@
#ifndef SDRBASE_AUDIO_AUDIOCOMPRESSORSND_H_ #ifndef SDRBASE_AUDIO_AUDIOCOMPRESSORSND_H_
#define SDRBASE_AUDIO_AUDIOCOMPRESSORSND_H_ #define SDRBASE_AUDIO_AUDIOCOMPRESSORSND_H_
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
// maximum number of samples in the delay buffer // maximum number of samples in the delay buffer
#define AUDIOCOMPRESSORSND_SF_COMPRESSOR_MAXDELAY 1024 #define AUDIOCOMPRESSORSND_SF_COMPRESSOR_MAXDELAY 1024
@ -161,7 +160,7 @@ private:
static inline float fixf(float v, float def){ static inline float fixf(float v, float def){
// fix NaN and infinity values that sneak in... not sure why this is needed, but it is // fix NaN and infinity values that sneak in... not sure why this is needed, but it is
if (isnan(v) || isinf(v)) if (std::isnan(v) || std::isinf(v))
return def; return def;
return v; return v;
} }

View File

@ -15,8 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
#include <algorithm> #include <algorithm>
#include <QDebug> #include <QDebug>

View File

@ -15,11 +15,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <math.h> #include <cmath>
#include "dsp/afsquelch.h" #include "dsp/afsquelch.h"
#undef M_PI
#define M_PI 3.14159265358979323846
AFSquelch::AFSquelch() : AFSquelch::AFSquelch() :
m_nbAvg(128), m_nbAvg(128),

View File

@ -17,7 +17,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define _USE_MATH_DEFINES
#include <cmath> #include <cmath>
#include "dsp/ctcssdetector.h" #include "dsp/ctcssdetector.h"

View File

@ -6,12 +6,11 @@
#define _FFTFILT_H #define _FFTFILT_H
#include <complex> #include <complex>
#include <cmath>
#include "gfft.h" #include "gfft.h"
#include "export.h" #include "export.h"
#undef M_PI
#define M_PI 3.14159265358979323846
//---------------------------------------------------------------------- //----------------------------------------------------------------------
class SDRBASE_API fftfilt { class SDRBASE_API fftfilt {

View File

@ -20,14 +20,10 @@
#define INCLUDE_FFTWINDOW_H #define INCLUDE_FFTWINDOW_H
#include <vector> #include <vector>
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "export.h" #include "export.h"
#undef M_PI
#define M_PI 3.14159265358979323846
class SDRBASE_API FFTWindow { class SDRBASE_API FFTWindow {
public: public:
enum Function { enum Function {

View File

@ -18,8 +18,7 @@
#pragma once #pragma once
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "export.h" #include "export.h"

View File

@ -16,7 +16,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#define _USE_MATH_DEFINES
#include <cmath> #include <cmath>
#include <QDebug> #include <QDebug>
#include "dsp/fmpreemphasis.h" #include "dsp/fmpreemphasis.h"

View File

@ -22,8 +22,7 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include "freqlockcomplex.h" #include "freqlockcomplex.h"
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
FreqLockComplex::FreqLockComplex() : FreqLockComplex::FreqLockComplex() :
m_a0(0.998), m_a0(0.998),

View File

@ -1,5 +1,4 @@
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
#include <vector> #include <vector>
#include "dsp/interpolator.h" #include "dsp/interpolator.h"

View File

@ -24,10 +24,7 @@
#ifndef _MISC_H #ifndef _MISC_H
#define _MISC_H #define _MISC_H
#include <math.h> #include <cmath>
#undef M_PI
#define M_PI 3.14159265358979323846
inline float sinc(float x) inline float sinc(float x)
{ {

View File

@ -17,13 +17,10 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <QtGlobal> #include <QtGlobal>
#include <stdio.h> #include <cstdio>
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
#include "dsp/nco.h" #include "dsp/nco.h"
#undef M_PI
#define M_PI 3.14159265358979323846
Real NCO::m_table[NCO::TableSize]; Real NCO::m_table[NCO::TableSize];
bool NCO::m_tableInitialized = false; bool NCO::m_tableInitialized = false;

View File

@ -17,13 +17,9 @@
#include <QtGlobal> #include <QtGlobal>
#include <stdio.h> #include <stdio.h>
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
#include "dsp/ncof.h" #include "dsp/ncof.h"
#undef M_PI
#define M_PI 3.14159265358979323846
Real NCOF::m_table[NCOF::TableSize+1]; Real NCOF::m_table[NCOF::TableSize+1];
bool NCOF::m_tableInitialized = false; bool NCOF::m_tableInitialized = false;
float NCOF::m_tableSizeLimit = (float) NCOF::TableSize; float NCOF::m_tableSizeLimit = (float) NCOF::TableSize;

View File

@ -19,11 +19,9 @@
#ifndef INCLUDE_DSP_PHASEDISCRI_H_ #ifndef INCLUDE_DSP_PHASEDISCRI_H_
#define INCLUDE_DSP_PHASEDISCRI_H_ #define INCLUDE_DSP_PHASEDISCRI_H_
#include <cmath>
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#undef M_PI
#define M_PI 3.14159265358979323846
class PhaseDiscriminators class PhaseDiscriminators
{ {
public: public:
@ -167,8 +165,8 @@ private:
} }
#define PI_FLOAT 3.14159265f #define PI_FLOAT float(M_PI)
#define PIBY2_FLOAT 1.5707963f #define PIBY2_FLOAT float(M_PI_2)
// |error| < 0.005 // |error| < 0.005
float atan2_approximation2( float y, float x ) float atan2_approximation2( float y, float x )
{ {

View File

@ -16,11 +16,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <math.h> #include <cmath>
#include "dsp/phaselock.h" #include "dsp/phaselock.h"
#undef M_PI
#define M_PI 3.14159265358979323846
// Construct phase-locked loop. // Construct phase-locked loop.
PhaseLock::PhaseLock(Real freq, Real bandwidth, Real minsignal) PhaseLock::PhaseLock(Real freq, Real bandwidth, Real minsignal)

View File

@ -22,8 +22,7 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <complex.h> #include <complex.h>
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
#include "phaselockcomplex.h" #include "phaselockcomplex.h"
PhaseLockComplex::PhaseLockComplex() : PhaseLockComplex::PhaseLockComplex() :

View File

@ -16,8 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
#include "projector.h" #include "projector.h"
Projector::Projector(ProjectionType projectionType) : Projector::Projector(ProjectionType projectionType) :

View File

@ -19,8 +19,7 @@
#ifndef INCLUDE_RAISEDCOSINE_H #ifndef INCLUDE_RAISEDCOSINE_H
#define INCLUDE_RAISEDCOSINE_H #define INCLUDE_RAISEDCOSINE_H
#define _USE_MATH_DEFINES #include <cmath>
#include <math.h>
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
// Raised-cosine low-pass filter for pulse shaping, without intersymbol interference (ISI) // Raised-cosine low-pass filter for pulse shaping, without intersymbol interference (ISI)

View File

@ -15,12 +15,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <math.h> #include <cmath>
#include "recursivefilters.h" #include "recursivefilters.h"
#undef M_PI
#define M_PI 3.14159265358979323846
SecondOrderRecursiveFilter::SecondOrderRecursiveFilter(float samplingFrequency, float centerFrequency, float r) : SecondOrderRecursiveFilter::SecondOrderRecursiveFilter(float samplingFrequency, float centerFrequency, float r) :
m_r(r), m_r(r),
m_frequencyRatio(centerFrequency/samplingFrequency), m_frequencyRatio(centerFrequency/samplingFrequency),

View File

@ -4,15 +4,13 @@
http://www.iowahills.com http://www.iowahills.com
*/ */
#include <math.h> #include <cmath>
#include <new> #include <new>
#include <iostream> #include <iostream>
#include "wfir.h" #include "wfir.h"
#undef M_PI #define M_2PI (2*M_PI)
#define M_PI 3.14159265358979323846
#define M_2PI 6.28318530717958647692
// This first calculates the impulse response for a rectangular window. // This first calculates the impulse response for a rectangular window.
// It then applies the windowing function of choice to the impulse response. // It then applies the windowing function of choice to the impulse response.

View File

@ -17,7 +17,6 @@
#include "azel.h" #include "azel.h"
#define _USE_MATH_DEFINES
#include <cmath> #include <cmath>
// Calculate cartesian distance between two points // Calculate cartesian distance between two points

View File

@ -25,7 +25,7 @@
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
#include <math.h> #include <cmath>
#include <stdint.h> #include <stdint.h>
#include <vector> #include <vector>
@ -37,8 +37,6 @@
#include "util/message.h" #include "util/message.h"
#include "util/doublebuffer.h" #include "util/doublebuffer.h"
#undef M_PI
#define M_PI 3.14159265358979323846
class GLScope; class GLScope;

View File

@ -15,7 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#define _USE_MATH_DEFINES
#include <cmath> #include <cmath>
#include "fmpreemphasisdialog.h" #include "fmpreemphasisdialog.h"
#include "ui_fmpreemphasisdialog.h" #include "ui_fmpreemphasisdialog.h"