summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-05-10 00:15:07 -0700
committerJosh Blum <josh@joshknows.com>2012-05-10 00:15:07 -0700
commitc0a9d1c71cb0d82085221ffca4974a573de98552 (patch)
tree2ee1b5970c581deb9175bfefd2233da80f6e3b22
parent4fa889c4f972120d56fdc1308ba5928fb692a305 (diff)
downloaduhd-c0a9d1c71cb0d82085221ffca4974a573de98552.tar.gz
uhd-c0a9d1c71cb0d82085221ffca4974a573de98552.tar.bz2
uhd-c0a9d1c71cb0d82085221ffca4974a573de98552.zip
convert: applied sc8 signed convert fix
-rw-r--r--host/lib/convert/convert_common.hpp20
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)
;
}