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/b100/codec_ctrl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'host/lib/usrp/b100/codec_ctrl.cpp') diff --git a/host/lib/usrp/b100/codec_ctrl.cpp b/host/lib/usrp/b100/codec_ctrl.cpp index fad25cf8c..4b9f0e62b 100644 --- a/host/lib/usrp/b100/codec_ctrl.cpp +++ b/host/lib/usrp/b100/codec_ctrl.cpp @@ -13,9 +13,10 @@ #include #include #include -#include +#include +#include #include -#include +#include #include using namespace uhd; @@ -241,7 +242,8 @@ void b100_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); @@ -250,7 +252,8 @@ void b100_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; -- cgit v1.2.3