summaryrefslogtreecommitdiff
path: root/gr-fft
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2018-02-17 23:24:10 +0100
committerAndrej Rode <mail@andrejro.de>2018-02-17 23:24:10 +0100
commit886ce0f13b4135c1206c26786e06a524e92fc271 (patch)
treefdf89824d4a5925c44f9b30d1e8d44b713c46b19 /gr-fft
parent201031790ec8c855ec2eaf7883652ad37b164208 (diff)
math: replace M_PI and derivatives with GR_M_PI defines
Diffstat (limited to 'gr-fft')
-rw-r--r--gr-fft/lib/goertzel.cc7
-rw-r--r--gr-fft/lib/window.cc19
2 files changed, 14 insertions, 12 deletions
diff --git a/gr-fft/lib/goertzel.cc b/gr-fft/lib/goertzel.cc
index 14098180b5..324d2a76a2 100644
--- a/gr-fft/lib/goertzel.cc
+++ b/gr-fft/lib/goertzel.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2011,2012 Free Software Foundation, Inc.
+ * Copyright 2002,2011,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,8 +24,9 @@
#include <config.h>
#endif
-#include <cmath>
#include <gnuradio/fft/goertzel.h>
+#include <gnuradio/math.h>
+#include <cmath>
namespace gr {
namespace fft {
@@ -41,7 +42,7 @@ namespace gr {
d_d1 = 0.0;
d_d2 = 0.0;
- float w = 2.0*M_PI*freq/rate;
+ float w = 2.0*GR_M_PI*freq/rate;
d_wr = 2.0*std::cos(w);
d_wi = std::sin(w);
d_len = len;
diff --git a/gr-fft/lib/window.cc b/gr-fft/lib/window.cc
index cfbdb93dbd..0c1e27f66a 100644
--- a/gr-fft/lib/window.cc
+++ b/gr-fft/lib/window.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2007,2008,2012,2013 Free Software Foundation, Inc.
+ * Copyright 2002,2007,2008,2012,2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,6 +25,7 @@
#endif
#include <gnuradio/fft/window.h>
+#include <gnuradio/math.h>
#include <stdexcept>
namespace gr {
@@ -66,7 +67,7 @@ namespace gr {
double freq(int ntaps)
{
- return 2.0*M_PI/ntaps;
+ return 2.0*GR_M_PI/ntaps;
}
double rate(int ntaps)
@@ -98,7 +99,7 @@ namespace gr {
float M = static_cast<float>(ntaps - 1);
for(int n = 0; n < ntaps; n++)
- taps[n] = c0 - c1*cosf((2.0f*M_PI*n)/M) + c2*cosf((4.0f*M_PI*n)/M);
+ taps[n] = c0 - c1*cosf((2.0f*GR_M_PI*n)/M) + c2*cosf((4.0f*GR_M_PI*n)/M);
return taps;
}
@@ -109,8 +110,8 @@ namespace gr {
float M = static_cast<float>(ntaps - 1);
for(int n = 0; n < ntaps; n++)
- taps[n] = c0 - c1*cosf((2.0f*M_PI*n)/M) + c2*cosf((4.0f*M_PI*n)/M) \
- - c3*cosf((6.0f*M_PI*n)/M);
+ taps[n] = c0 - c1*cosf((2.0f*GR_M_PI*n)/M) + c2*cosf((4.0f*GR_M_PI*n)/M) \
+ - c3*cosf((6.0f*GR_M_PI*n)/M);
return taps;
}
@@ -121,8 +122,8 @@ namespace gr {
float M = static_cast<float>(ntaps - 1);
for(int n = 0; n < ntaps; n++)
- taps[n] = c0 - c1*cosf((2.0f*M_PI*n)/M) + c2*cosf((4.0f*M_PI*n)/M) \
- - c3*cosf((6.0f*M_PI*n)/M) + c4*cosf((8.0f*M_PI*n)/M);
+ taps[n] = c0 - c1*cosf((2.0f*GR_M_PI*n)/M) + c2*cosf((4.0f*GR_M_PI*n)/M) \
+ - c3*cosf((6.0f*GR_M_PI*n)/M) + c4*cosf((8.0f*GR_M_PI*n)/M);
return taps;
}
@@ -142,7 +143,7 @@ namespace gr {
float M = static_cast<float>(ntaps - 1);
for(int n = 0; n < ntaps; n++)
- taps[n] = 0.54 - 0.46 * cos((2 * M_PI * n) / M);
+ taps[n] = 0.54 - 0.46 * cos((2 * GR_M_PI * n) / M);
return taps;
}
@@ -153,7 +154,7 @@ namespace gr {
float M = static_cast<float>(ntaps - 1);
for(int n = 0; n < ntaps; n++)
- taps[n] = 0.5 - 0.5 * cos((2 * M_PI * n) / M);
+ taps[n] = 0.5 - 0.5 * cos((2 * GR_M_PI * n) / M);
return taps;
}