summaryrefslogtreecommitdiff
path: root/gr-analog/lib
diff options
context:
space:
mode:
authorMarcus Müller <mueller@kit.edu>2020-02-13 21:04:28 +0100
committerMichael Dickens <michael.dickens@ettus.com>2020-02-14 10:05:12 -0500
commita56c3a7f4908133dc6ceb93ffd3b2f9e1dda8e0e (patch)
tree795af0a51812e4142d65504fdb7e3b5f85ebc8f4 /gr-analog/lib
parentd39d40c826a1b8e66c4789622c1287d439a26645 (diff)
runtime/math: unclutter GR_M_ math constant defines
* no speed advantage of GR_M_TWOPI: every compiler pre-computes constants, so that (2 * GR_M_PI) is just as fast * rest of constants not even used
Diffstat (limited to 'gr-analog/lib')
-rw-r--r--gr-analog/lib/cpfsk_bc_impl.cc8
-rw-r--r--gr-analog/lib/cpm.cc4
-rw-r--r--gr-analog/lib/pll_carriertracking_cc_impl.cc4
-rw-r--r--gr-analog/lib/pll_freqdet_cf_impl.cc4
-rw-r--r--gr-analog/lib/pll_refout_cc_impl.cc4
5 files changed, 12 insertions, 12 deletions
diff --git a/gr-analog/lib/cpfsk_bc_impl.cc b/gr-analog/lib/cpfsk_bc_impl.cc
index 82ce291ae5..5827d3f1cf 100644
--- a/gr-analog/lib/cpfsk_bc_impl.cc
+++ b/gr-analog/lib/cpfsk_bc_impl.cc
@@ -51,10 +51,10 @@ int cpfsk_bc_impl::work(int noutput_items,
else
d_phase -= d_freq;
- while (d_phase > GR_M_TWOPI)
- d_phase -= GR_M_TWOPI;
- while (d_phase < -GR_M_TWOPI)
- d_phase += GR_M_TWOPI;
+ while (d_phase > (2.0 * GR_M_PI))
+ d_phase -= (2.0 * GR_M_PI);
+ while (d_phase < -(2.0 * GR_M_PI))
+ d_phase += (2.0 * GR_M_PI);
*out++ = gr_expj(d_phase) * d_ampl;
}
diff --git a/gr-analog/lib/cpm.cc b/gr-analog/lib/cpm.cc
index fdadbebfed..aa3092aba6 100644
--- a/gr-analog/lib/cpm.cc
+++ b/gr-analog/lib/cpm.cc
@@ -36,7 +36,7 @@ std::vector<float> generate_cpm_lrc_taps(unsigned samples_per_sym, unsigned L)
{
std::vector<float> taps(samples_per_sym * L, 1.0 / L / samples_per_sym);
for (unsigned i = 0; i < samples_per_sym * L; i++) {
- taps[i] *= 1 - std::cos(GR_M_TWOPI * i / L / samples_per_sym);
+ taps[i] *= 1 - std::cos((2.0 * GR_M_PI) * i / L / samples_per_sym);
}
return taps;
@@ -79,7 +79,7 @@ generate_cpm_lsrc_taps(unsigned samples_per_sym, unsigned L, double beta)
taps_d[i] *= M_PI_4;
} else {
double tmp = 4.0 * beta * k / Ls;
- taps_d[i] *= std::cos(beta * GR_M_TWOPI * k / Ls) / (1 - tmp * tmp);
+ taps_d[i] *= std::cos(beta * (2.0 * GR_M_PI) * k / Ls) / (1 - tmp * tmp);
}
sum += taps_d[i];
}
diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.cc b/gr-analog/lib/pll_carriertracking_cc_impl.cc
index d8216b0ca7..81c04aa01b 100644
--- a/gr-analog/lib/pll_carriertracking_cc_impl.cc
+++ b/gr-analog/lib/pll_carriertracking_cc_impl.cc
@@ -47,9 +47,9 @@ pll_carriertracking_cc_impl::~pll_carriertracking_cc_impl() {}
float pll_carriertracking_cc_impl::mod_2pi(float in)
{
if (in > GR_M_PI)
- return in - GR_M_TWOPI;
+ return in - (2.0 * GR_M_PI);
else if (in < -GR_M_PI)
- return in + GR_M_TWOPI;
+ return in + (2.0 * GR_M_PI);
else
return in;
}
diff --git a/gr-analog/lib/pll_freqdet_cf_impl.cc b/gr-analog/lib/pll_freqdet_cf_impl.cc
index 9df122bc04..f460441e92 100644
--- a/gr-analog/lib/pll_freqdet_cf_impl.cc
+++ b/gr-analog/lib/pll_freqdet_cf_impl.cc
@@ -40,9 +40,9 @@ pll_freqdet_cf_impl::~pll_freqdet_cf_impl() {}
float pll_freqdet_cf_impl::mod_2pi(float in)
{
if (in > GR_M_PI)
- return in - GR_M_TWOPI;
+ return in - (2.0 * GR_M_PI);
else if (in < -GR_M_PI)
- return in + GR_M_TWOPI;
+ return in + (2.0 * GR_M_PI);
else
return in;
}
diff --git a/gr-analog/lib/pll_refout_cc_impl.cc b/gr-analog/lib/pll_refout_cc_impl.cc
index d83f430d2e..067e650de5 100644
--- a/gr-analog/lib/pll_refout_cc_impl.cc
+++ b/gr-analog/lib/pll_refout_cc_impl.cc
@@ -40,9 +40,9 @@ pll_refout_cc_impl::~pll_refout_cc_impl() {}
float pll_refout_cc_impl::mod_2pi(float in)
{
if (in > GR_M_PI)
- return in - GR_M_TWOPI;
+ return in - (2.0 * GR_M_PI);
else if (in < -GR_M_PI)
- return in + GR_M_TWOPI;
+ return in + (2.0 * GR_M_PI);
else
return in;
}