diff options
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/cores/rx_dsp_core_200.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/cores/rx_dsp_core_3000.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/cores/tx_dsp_core_200.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/cores/tx_dsp_core_3000.cpp | 12 |
4 files changed, 20 insertions, 28 deletions
diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp index 160124b3e..6a36e8fa1 100644 --- a/host/lib/usrp/cores/rx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp @@ -18,9 +18,9 @@ #include "rx_dsp_core_200.hpp" #include <uhd/types/dict.hpp> #include <uhd/exception.hpp> +#include <uhd/utils/math.hpp> #include <uhd/utils/msg.hpp> #include <uhd/utils/safe_call.hpp> -#include <uhd/utils/algorithm.hpp> #include <boost/assign/list_of.hpp> #include <boost/thread/thread.hpp> //thread sleep #include <boost/math/special_functions/round.hpp> @@ -242,15 +242,13 @@ public: boost::int32_t freq_word = 0; static const double scale_factor = std::pow(2.0, 32); - static const boost::int32_t int_max = boost::numeric::bounds<boost::int32_t>::highest(); - static const boost::int32_t int_min = boost::numeric::bounds<boost::int32_t>::lowest(); - if((freq / _tick_rate) >= (int_max / scale_factor)) { + if((freq / _tick_rate) >= (uhd::math::BOOST_INT32_MAX / scale_factor)) { /* Operation would have caused a positive overflow of int32. */ - freq_word = boost::numeric::bounds<boost::int32_t>::highest(); + freq_word = uhd::math::BOOST_INT32_MAX; - } else if((freq / _tick_rate) <= (int_min / scale_factor)) { + } else if((freq / _tick_rate) <= (uhd::math::BOOST_INT32_MIN / scale_factor)) { /* Operation would have caused a negative overflow of int32. */ - freq_word = boost::numeric::bounds<boost::int32_t>::lowest(); + freq_word = uhd::math::BOOST_INT32_MIN; } else { /* The operation is safe. Perform normally. */ diff --git a/host/lib/usrp/cores/rx_dsp_core_3000.cpp b/host/lib/usrp/cores/rx_dsp_core_3000.cpp index 6ce3c1d32..32866880f 100644 --- a/host/lib/usrp/cores/rx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_3000.cpp @@ -18,9 +18,9 @@ #include "rx_dsp_core_3000.hpp" #include <uhd/types/dict.hpp> #include <uhd/exception.hpp> +#include <uhd/utils/math.hpp> #include <uhd/utils/msg.hpp> #include <uhd/utils/safe_call.hpp> -#include <uhd/utils/algorithm.hpp> #include <boost/assign/list_of.hpp> #include <boost/thread/thread.hpp> //thread sleep #include <boost/math/special_functions/round.hpp> @@ -210,15 +210,13 @@ public: boost::int32_t freq_word = 0; static const double scale_factor = std::pow(2.0, 32); - static const boost::int32_t int_max = boost::numeric::bounds<boost::int32_t>::highest(); - static const boost::int32_t int_min = boost::numeric::bounds<boost::int32_t>::lowest(); - if((freq / _tick_rate) >= (int_max / scale_factor)) { + if((freq / _tick_rate) >= (uhd::math::BOOST_INT32_MAX / scale_factor)) { /* Operation would have caused a positive overflow of int32. */ - freq_word = boost::numeric::bounds<boost::int32_t>::highest(); + freq_word = uhd::math::BOOST_INT32_MAX; - } else if((freq / _tick_rate) <= (int_min / scale_factor)) { + } else if((freq / _tick_rate) <= (uhd::math::BOOST_INT32_MIN / scale_factor)) { /* Operation would have caused a negative overflow of int32. */ - freq_word = boost::numeric::bounds<boost::int32_t>::lowest(); + freq_word = uhd::math::BOOST_INT32_MIN; } else { /* The operation is safe. Perform normally. */ diff --git a/host/lib/usrp/cores/tx_dsp_core_200.cpp b/host/lib/usrp/cores/tx_dsp_core_200.cpp index 3f397dd6a..2ef9f4406 100644 --- a/host/lib/usrp/cores/tx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_200.cpp @@ -18,8 +18,8 @@ #include "tx_dsp_core_200.hpp" #include <uhd/types/dict.hpp> #include <uhd/exception.hpp> +#include <uhd/utils/math.hpp> #include <uhd/utils/msg.hpp> -#include <uhd/utils/algorithm.hpp> #include <boost/assign/list_of.hpp> #include <boost/math/special_functions/round.hpp> #include <boost/math/special_functions/sign.hpp> @@ -182,15 +182,13 @@ public: boost::int32_t freq_word = 0; static const double scale_factor = std::pow(2.0, 32); - static const boost::int32_t int_max = boost::numeric::bounds<boost::int32_t>::highest(); - static const boost::int32_t int_min = boost::numeric::bounds<boost::int32_t>::lowest(); - if((freq / _tick_rate) >= (int_max / scale_factor)) { + if((freq / _tick_rate) >= (uhd::math::BOOST_INT32_MAX / scale_factor)) { /* Operation would have caused a positive overflow of int32. */ - freq_word = boost::numeric::bounds<boost::int32_t>::highest(); + freq_word = uhd::math::BOOST_INT32_MAX; - } else if((freq / _tick_rate) <= (int_min / scale_factor)) { + } else if((freq / _tick_rate) <= (uhd::math::BOOST_INT32_MIN / scale_factor)) { /* Operation would have caused a negative overflow of int32. */ - freq_word = boost::numeric::bounds<boost::int32_t>::lowest(); + freq_word = uhd::math::BOOST_INT32_MIN; } else { /* The operation is safe. Perform normally. */ diff --git a/host/lib/usrp/cores/tx_dsp_core_3000.cpp b/host/lib/usrp/cores/tx_dsp_core_3000.cpp index 0dc19f2c8..736205402 100644 --- a/host/lib/usrp/cores/tx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_3000.cpp @@ -18,8 +18,8 @@ #include "tx_dsp_core_3000.hpp" #include <uhd/types/dict.hpp> #include <uhd/exception.hpp> +#include <uhd/utils/math.hpp> #include <uhd/utils/msg.hpp> -#include <uhd/utils/algorithm.hpp> #include <boost/assign/list_of.hpp> #include <boost/math/special_functions/round.hpp> #include <boost/math/special_functions/sign.hpp> @@ -147,15 +147,13 @@ public: boost::int32_t freq_word = 0; static const double scale_factor = std::pow(2.0, 32); - static const boost::int32_t int_max = boost::numeric::bounds<boost::int32_t>::highest(); - static const boost::int32_t int_min = boost::numeric::bounds<boost::int32_t>::lowest(); - if((freq / _tick_rate) >= (int_max / scale_factor)) { + if((freq / _tick_rate) >= (uhd::math::BOOST_INT32_MAX / scale_factor)) { /* Operation would have caused a positive overflow of int32. */ - freq_word = boost::numeric::bounds<boost::int32_t>::highest(); + freq_word = uhd::math::BOOST_INT32_MAX; - } else if((freq / _tick_rate) <= (int_min / scale_factor)) { + } else if((freq / _tick_rate) <= (uhd::math::BOOST_INT32_MIN / scale_factor)) { /* Operation would have caused a negative overflow of int32. */ - freq_word = boost::numeric::bounds<boost::int32_t>::lowest(); + freq_word = uhd::math::BOOST_INT32_MIN; } else { /* The operation is safe. Perform normally. */ |