diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-06-19 00:06:52 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-06-24 12:00:49 -0500 |
commit | 188fbb17cfd18c87f60ec56f62476f97ef2779bb (patch) | |
tree | e88b9fb8436aa42f3ecbdc0403751a3e68bbbac8 /host/lib/usrp/x300 | |
parent | 78ec29b6becd53f79a0ae282ae22c38bedb887d1 (diff) | |
download | uhd-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/x300')
-rw-r--r-- | host/lib/usrp/x300/x300_clock_ctrl.cpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_dboard_iface.cpp | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/host/lib/usrp/x300/x300_clock_ctrl.cpp b/host/lib/usrp/x300/x300_clock_ctrl.cpp index 7459e9069..b7b8f272c 100644 --- a/host/lib/usrp/x300/x300_clock_ctrl.cpp +++ b/host/lib/usrp/x300/x300_clock_ctrl.cpp @@ -12,7 +12,6 @@ #include <uhd/utils/safe_call.hpp> #include <stdint.h> #include <boost/format.hpp> -#include <boost/math/special_functions/round.hpp> #include <cmath> #include <cstdlib> #include <stdexcept> @@ -315,14 +314,14 @@ public: // difference using analog delay. Do the best we can. adly_en = true; adly_value = static_cast<uint8_t>( - boost::math::round((ADLY_MAX_NS - ADLY_MIN_NS) / ADLY_RES_NS)); + std::lround((ADLY_MAX_NS - ADLY_MIN_NS) / ADLY_RES_NS)); coerced_delay += ADLY_MAX_NS; } else if (leftover_delay >= ADLY_MIN_NS && leftover_delay <= ADLY_MAX_NS) { // The leftover delay can be compensated by the analog delay up to the analog // delay resolution adly_en = true; adly_value = static_cast<uint8_t>( - boost::math::round((leftover_delay - ADLY_MIN_NS) / ADLY_RES_NS)); + std::lround((leftover_delay - ADLY_MIN_NS) / ADLY_RES_NS)); coerced_delay += ADLY_MIN_NS + (ADLY_RES_NS * adly_value); } else if (leftover_delay >= (ADLY_MIN_NS - half_vco_period_ns) && leftover_delay < ADLY_MIN_NS) { @@ -330,7 +329,7 @@ public: // we move the digital delay back by half a VCO cycle then it will be in the // range of the analog delay. So do that! adly_en = true; - adly_value = static_cast<uint8_t>(boost::math::round( + adly_value = static_cast<uint8_t>(std::lround( (leftover_delay + half_vco_period_ns - ADLY_MIN_NS) / ADLY_RES_NS)); half_shift_en = 1; coerced_delay += @@ -513,7 +512,7 @@ private: // better spur performance by balancing the predivider and the // divider. const int n = static_cast<int>( - boost::math::round((r * try_vco_freq) / (VCXO_PLL2_N * ref))); + std::lround((r * try_vco_freq) / (VCXO_PLL2_N * ref))); const double actual_mcr = (ref * VCXO_PLL2_N * n) / (vcodiv * r); const double error = std::abs(actual_mcr - output_freq); diff --git a/host/lib/usrp/x300/x300_dboard_iface.cpp b/host/lib/usrp/x300/x300_dboard_iface.cpp index 36e430985..4c7a1d55b 100644 --- a/host/lib/usrp/x300/x300_dboard_iface.cpp +++ b/host/lib/usrp/x300/x300_dboard_iface.cpp @@ -9,7 +9,7 @@ #include "x300_regs.hpp" #include <uhd/utils/safe_call.hpp> #include <boost/assign/list_of.hpp> -#include <boost/math/special_functions/round.hpp> +#include <cmath> using namespace uhd; using namespace uhd::usrp; @@ -218,7 +218,7 @@ void x300_dboard_iface::write_aux_dac(unit_t unit, aux_dac_t which, double value 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; |