From 188fbb17cfd18c87f60ec56f62476f97ef2779bb Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Sat, 19 Jun 2021 00:06:52 +0200 Subject: 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. --- host/lib/usrp/usrp1/codec_ctrl.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'host/lib/usrp/usrp1/codec_ctrl.cpp') diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp index ca5503132..413caaf67 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.cpp +++ b/host/lib/usrp/usrp1/codec_ctrl.cpp @@ -13,11 +13,12 @@ #include #include #include -#include +#include +#include #include #include -#include #include +#include #include #include @@ -257,7 +258,8 @@ void usrp1_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts) { // special case for aux dac d (aka sigma delta word) if (which == AUX_DAC_D) { - uint16_t dac_word = uhd::clip(boost::math::iround(volts * 0xfff / 3.3), 0, 0xfff); + uint16_t dac_word = uhd::clip( + uhd::narrow_cast(std::lround(volts * 0xfff / 3.3)), 0, 0xfff); _ad9862_regs.sig_delt_11_4 = uint8_t(dac_word >> 4); _ad9862_regs.sig_delt_3_0 = uint8_t(dac_word & 0xf); this->send_reg(42); @@ -266,7 +268,8 @@ void usrp1_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts) } // calculate the dac word for aux dac a, b, c - uint8_t dac_word = uhd::clip(boost::math::iround(volts * 0xff / 3.3), 0, 0xff); + uint8_t dac_word = + uhd::clip(uhd::narrow_cast(std::lround(volts * 0xff / 3.3)), 0, 0xff); // setup a lookup table for the aux dac params (reg ref, reg addr) typedef std::tuple dac_params_t; @@ -356,7 +359,7 @@ double usrp1_codec_ctrl_impl::fine_tune(double codec_rate, double target_freq) static const double scale_factor = std::pow(2.0, 24); uint32_t freq_word = - uint32_t(boost::math::round(std::abs((target_freq / codec_rate) * scale_factor))); + uint32_t(std::lround(std::abs((target_freq / codec_rate) * scale_factor))); double actual_freq = freq_word * codec_rate / scale_factor; -- cgit v1.2.3