diff options
| -rw-r--r-- | host/lib/convert/convert_common.hpp | 20 | 
1 files changed, 12 insertions, 8 deletions
| diff --git a/host/lib/convert/convert_common.hpp b/host/lib/convert/convert_common.hpp index 602e60230..c1051ba46 100644 --- a/host/lib/convert/convert_common.hpp +++ b/host/lib/convert/convert_common.hpp @@ -150,22 +150,26 @@ UHD_INLINE void item32_sc16_to_xx(  template <typename T> UHD_INLINE item32_t xx_to_item32_sc8_x1(      const std::complex<T> &in0, const std::complex<T> &in1, const double scale_factor  ){ +    boost::uint8_t real0 = boost::int8_t(in0.real()*float(scale_factor)); +    boost::uint8_t imag0 = boost::int8_t(in0.imag()*float(scale_factor)); +    boost::uint8_t real1 = boost::int8_t(in1.real()*float(scale_factor)); +    boost::uint8_t imag1 = boost::int8_t(in1.imag()*float(scale_factor));      return -        (item32_t(boost::uint8_t(in0.real()*float(scale_factor))) << 8) | -        (item32_t(boost::uint8_t(in0.imag()*float(scale_factor))) << 0) | -        (item32_t(boost::uint8_t(in1.real()*float(scale_factor))) << 24) | -        (item32_t(boost::uint8_t(in1.imag()*float(scale_factor))) << 16) +        (item32_t(real0) << 8) | (item32_t(imag0) << 0) | +        (item32_t(real1) << 24) | (item32_t(imag1) << 16)      ;  }  template <> UHD_INLINE item32_t xx_to_item32_sc8_x1(      const sc16_t &in0, const sc16_t &in1, const double  ){ +    boost::uint8_t real0 = boost::int8_t(in0.real()); +    boost::uint8_t imag0 = boost::int8_t(in0.imag()); +    boost::uint8_t real1 = boost::int8_t(in1.real()); +    boost::uint8_t imag1 = boost::int8_t(in1.imag());      return -        (item32_t(boost::uint8_t(in0.real())) << 8) | -        (item32_t(boost::uint8_t(in0.imag())) << 0) | -        (item32_t(boost::uint8_t(in1.real())) << 24) | -        (item32_t(boost::uint8_t(in1.imag())) << 16) +        (item32_t(real0) << 8) | (item32_t(imag0) << 0) | +        (item32_t(real1) << 24) | (item32_t(imag1) << 16)      ;  } | 
