aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-06-19 00:06:52 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-06-24 12:00:49 -0500
commit188fbb17cfd18c87f60ec56f62476f97ef2779bb (patch)
treee88b9fb8436aa42f3ecbdc0403751a3e68bbbac8 /host/lib/usrp/usrp2
parent78ec29b6becd53f79a0ae282ae22c38bedb887d1 (diff)
downloaduhd-188fbb17cfd18c87f60ec56f62476f97ef2779bb.tar.gz
uhd-188fbb17cfd18c87f60ec56f62476f97ef2779bb.tar.bz2
uhd-188fbb17cfd18c87f60ec56f62476f97ef2779bb.zip
uhd: Remove all occurences of boost::math::*round()
Its behaviour is almost identical to std::lround, which we use instead. The only downside of std::lround is that it always returns a long, which we don't always need. We thus add some casts for those cases to make the compiler happy.
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/clock_ctrl.cpp7
-rw-r--r--host/lib/usrp/usrp2/dboard_iface.cpp4
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp3
3 files changed, 6 insertions, 8 deletions
diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp
index 324826dc0..8c5801bda 100644
--- a/host/lib/usrp/usrp2/clock_ctrl.cpp
+++ b/host/lib/usrp/usrp2/clock_ctrl.cpp
@@ -13,9 +13,8 @@
#include <uhd/utils/assert_has.hpp>
#include <uhd/utils/safe_call.hpp>
#include <uhdlib/utils/narrow.hpp>
-#include <stdint.h>
-#include <boost/math/special_functions/round.hpp>
-#include <iostream>
+#include <cmath>
+#include <cstdint>
using namespace uhd;
@@ -317,7 +316,7 @@ public:
// offset_ns = 0.34 + (1600 - i_ramp_ua)*1e-4 + ((caps-1)/ramp)*6
// delay_ns = offset_ns + range_ns * delay / 31
- int delay_val = boost::math::iround(delay / 9.744e-9 * 31);
+ int delay_val = static_cast<int>(std::lround(delay / 9.744e-9 * 31));
if (delay_val == 0) {
switch (clk_regs.exp) {
diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp
index 649019a91..169139ba1 100644
--- a/host/lib/usrp/usrp2/dboard_iface.cpp
+++ b/host/lib/usrp/usrp2/dboard_iface.cpp
@@ -18,7 +18,7 @@
#include <uhdlib/usrp/cores/gpio_core_200.hpp>
#include <boost/asio.hpp> //htonl and ntohl
#include <boost/assign/list_of.hpp>
-#include <boost/math/special_functions/round.hpp>
+#include <cmath>
using namespace uhd;
using namespace uhd::usrp;
@@ -300,7 +300,7 @@ void usrp2_dboard_iface::write_aux_dac(unit_t unit, aux_dac_t which, double valu
if (unit == UNIT_BOTH)
throw uhd::runtime_error("UNIT_BOTH not supported.");
- _dac_regs[unit].data = boost::math::iround(4095 * value / 3.3);
+ _dac_regs[unit].data = static_cast<int>(std::lround(4095 * value / 3.3));
_dac_regs[unit].cmd = ad5623_regs_t::CMD_WR_UP_DAC_CHAN_N;
typedef uhd::dict<aux_dac_t, ad5623_regs_t::addr_t> aux_dac_to_addr;
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index e82a9fa71..7bdce177b 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -18,9 +18,8 @@
#include <boost/asio.hpp>
#include <boost/asio/ip/address_v4.hpp>
#include <boost/format.hpp>
-#include <boost/math/special_functions.hpp>
-#include <functional>
#include <cmath>
+#include <functional>
using namespace uhd;
using namespace uhd::usrp;