aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/convert
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/convert')
-rw-r--r--host/lib/convert/convert_common.hpp26
-rw-r--r--host/lib/convert/convert_item32.cpp1
2 files changed, 27 insertions, 0 deletions
diff --git a/host/lib/convert/convert_common.hpp b/host/lib/convert/convert_common.hpp
index c1051ba46..933978a8f 100644
--- a/host/lib/convert/convert_common.hpp
+++ b/host/lib/convert/convert_common.hpp
@@ -173,6 +173,19 @@ template <> UHD_INLINE item32_t xx_to_item32_sc8_x1(
;
}
+template <> UHD_INLINE item32_t xx_to_item32_sc8_x1(
+ const sc8_t &in0, const sc8_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(real0) << 8) | (item32_t(imag0) << 0) |
+ (item32_t(real1) << 24) | (item32_t(imag1) << 16)
+ ;
+}
+
template <xtox_t to_wire, typename T>
UHD_INLINE void xx_to_item32_sc8(
const std::complex<T> *input,
@@ -221,6 +234,19 @@ template <> UHD_INLINE void item32_sc8_x1_to_xx(
);
}
+template <> UHD_INLINE void item32_sc8_x1_to_xx(
+ const item32_t item, sc8_t &out0, sc8_t &out1, const double
+){
+ out0 = sc8_t(
+ boost::int8_t(boost::int8_t(item >> 8)),
+ boost::int8_t(boost::int8_t(item >> 0))
+ );
+ out1 = sc8_t(
+ boost::int8_t(boost::int8_t(item >> 24)),
+ boost::int8_t(boost::int8_t(item >> 16))
+ );
+}
+
template <xtox_t to_host, typename T>
UHD_INLINE void item32_sc8_to_xx(
const item32_t *input,
diff --git a/host/lib/convert/convert_item32.cpp b/host/lib/convert/convert_item32.cpp
index bcac74714..57bd64860 100644
--- a/host/lib/convert/convert_item32.cpp
+++ b/host/lib/convert/convert_item32.cpp
@@ -41,3 +41,4 @@
DECLARE_ITEM32_CONVERTER(sc16)
DECLARE_ITEM32_CONVERTER(fc32)
DECLARE_ITEM32_CONVERTER(fc64)
+_DECLARE_ITEM32_CONVERTER(sc8, sc8)