diff options
| author | Steven Koo <steven.koo@ni.com> | 2020-08-06 21:18:17 -0500 | 
|---|---|---|
| committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-08-07 07:24:16 -0500 | 
| commit | 6c213ecd0927d10a98ba6ec64fbc9338516edee2 (patch) | |
| tree | e7a399c18df941c2b2234cdb763f61f2f047ce02 /host/lib | |
| parent | 0df2f9932cc270b8f1a705ea2543df8792005878 (diff) | |
| download | uhd-6c213ecd0927d10a98ba6ec64fbc9338516edee2.tar.gz uhd-6c213ecd0927d10a98ba6ec64fbc9338516edee2.tar.bz2 uhd-6c213ecd0927d10a98ba6ec64fbc9338516edee2.zip  | |
rfnoc: Remove M_PI usage to fix Windows builds
M_PI may not exist if _USE_MATH_DEFINES isn't defined before the
first include of math.h or cmath on Windows. This changes avoids the
issue all together by defining our own PI.
Diffstat (limited to 'host/lib')
| -rw-r--r-- | host/lib/rfnoc/siggen_block_control.cpp | 7 | 
1 files changed, 3 insertions, 4 deletions
diff --git a/host/lib/rfnoc/siggen_block_control.cpp b/host/lib/rfnoc/siggen_block_control.cpp index fe963a1c3..fa527f3f6 100644 --- a/host/lib/rfnoc/siggen_block_control.cpp +++ b/host/lib/rfnoc/siggen_block_control.cpp @@ -4,7 +4,6 @@  // SPDX-License-Identifier: GPL-3.0-or-later  // -#define _USE_MATH_DEFINES  #include <uhd/convert.hpp>  #include <uhd/exception.hpp>  #include <uhd/rfnoc/defaults.hpp> @@ -12,8 +11,8 @@  #include <uhd/rfnoc/property.hpp>  #include <uhd/rfnoc/registry.hpp>  #include <uhd/rfnoc/siggen_block_control.hpp> +#include <uhd/utils/math.hpp>  #include <uhdlib/utils/narrow.hpp> -#include <cmath>  #include <limits>  #include <string> @@ -182,12 +181,12 @@ private:              });              register_property(&_prop_phase_inc.back(), [this, port]() {                  const double phase_inc = _prop_phase_inc.at(port).get(); -                if (phase_inc < (-M_PI) || phase_inc > (M_PI)) { +                if (phase_inc < (-uhd::math::PI) || phase_inc > (uhd::math::PI)) {                      throw uhd::value_error(                          "Phase increment value must be in [-pi, pi]");                  }                  const int16_t phase_inc_scaled_rads_fp = -                    clamp<int16_t>((phase_inc / M_PI) * 8192.0); +                    clamp<int16_t>((phase_inc / uhd::math::PI) * 8192.0);                  _siggen_reg_iface.poke32(                      REG_PHASE_INC_OFFSET, phase_inc_scaled_rads_fp & 0xffff, port);              });  | 
