From 6c213ecd0927d10a98ba6ec64fbc9338516edee2 Mon Sep 17 00:00:00 2001 From: Steven Koo Date: Thu, 6 Aug 2020 21:18:17 -0500 Subject: 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. --- host/lib/rfnoc/siggen_block_control.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'host/lib/rfnoc/siggen_block_control.cpp') 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 #include #include @@ -12,8 +11,8 @@ #include #include #include +#include #include -#include #include #include @@ -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((phase_inc / M_PI) * 8192.0); + clamp((phase_inc / uhd::math::PI) * 8192.0); _siggen_reg_iface.poke32( REG_PHASE_INC_OFFSET, phase_inc_scaled_rads_fp & 0xffff, port); }); -- cgit v1.2.3