aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-06-12 09:48:20 -0700
committerJosh Blum <josh@joshknows.com>2012-06-12 09:48:20 -0700
commit3122bff9c288e4dd72643ddb2f9988d6f295aed4 (patch)
tree23079bd473085e922acf213597a10fc6ccee7f5a /host/lib
parent0d2ae35873bc4d0f36d2c830649e512bb76abd6f (diff)
downloaduhd-3122bff9c288e4dd72643ddb2f9988d6f295aed4.tar.gz
uhd-3122bff9c288e4dd72643ddb2f9988d6f295aed4.tar.bz2
uhd-3122bff9c288e4dd72643ddb2f9988d6f295aed4.zip
convert: add sc8 host to/from sc8 wire format
Diffstat (limited to 'host/lib')
-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)