summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/utils/algorithm.hpp11
-rw-r--r--host/lib/usrp/dsp_utils.hpp4
-rw-r--r--host/lib/usrp/tune_helper.cpp4
3 files changed, 4 insertions, 15 deletions
diff --git a/host/include/uhd/utils/algorithm.hpp b/host/include/uhd/utils/algorithm.hpp
index b52edc6b5..54bc78494 100644
--- a/host/include/uhd/utils/algorithm.hpp
+++ b/host/include/uhd/utils/algorithm.hpp
@@ -112,17 +112,6 @@ namespace std{
}
/*!
- * A templated signum implementation.
- * \param n the comparable to process
- * \return -1 when n negative, +1 when n positive, otherwise 0
- */
- template<typename T> inline int signum(T n){
- if (n < 0) return -1;
- if (n > 0) return +1;
- return 0;
- }
-
- /*!
* A templated clip implementation.
* \param val the value to clip between an upper and lower limit
* \param bound1 the upper or lower bound
diff --git a/host/lib/usrp/dsp_utils.hpp b/host/lib/usrp/dsp_utils.hpp
index 2f246c788..ebed12c41 100644
--- a/host/lib/usrp/dsp_utils.hpp
+++ b/host/lib/usrp/dsp_utils.hpp
@@ -82,11 +82,11 @@ namespace dsp_type1{
double &freq,
double codec_rate
){
- UHD_ASSERT_THROW(freq >= -codec_rate/2.0 and freq < codec_rate/2.0);
+ UHD_ASSERT_THROW(std::abs(freq) <= codec_rate/2.0);
static const double scale_factor = std::pow(2.0, 32);
//calculate the freq register word (signed)
- boost::int32_t freq_word = boost::math::iround((freq / codec_rate) * scale_factor);
+ boost::int32_t freq_word = boost::int32_t(boost::math::round((freq / codec_rate) * scale_factor));
//update the actual frequency
freq = (double(freq_word) / scale_factor) * codec_rate;
diff --git a/host/lib/usrp/tune_helper.cpp b/host/lib/usrp/tune_helper.cpp
index c5cce3ecf..e516477d3 100644
--- a/host/lib/usrp/tune_helper.cpp
+++ b/host/lib/usrp/tune_helper.cpp
@@ -16,10 +16,10 @@
//
#include <uhd/usrp/tune_helper.hpp>
-#include <uhd/utils/algorithm.hpp>
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/usrp/dsp_props.hpp>
#include <uhd/usrp/dboard_iface.hpp> //unit_t
+#include <boost/math/special_functions/sign.hpp>
#include <cmath>
using namespace uhd;
@@ -46,7 +46,7 @@ static tune_result_t tune_xx_subdev_and_dxc(
double delta_freq = std::fmod(target_freq - actual_inter_freq, dxc_sample_rate);
bool outside_of_nyquist = std::abs(delta_freq) > dxc_sample_rate/2.0;
double target_dxc_freq = (outside_of_nyquist)?
- std::signum(delta_freq)*dxc_sample_rate - delta_freq : -delta_freq;
+ boost::math::sign(delta_freq)*dxc_sample_rate - delta_freq : -delta_freq;
//invert the sign on the dxc freq given the following conditions
if (unit == dboard_iface::UNIT_TX) target_dxc_freq *= -1.0;