diff options
author | Jacob Gilbert <jacob.gilbert@protonmail.com> | 2021-03-15 04:30:26 -0700 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-03-18 16:35:41 -0400 |
commit | 192c9b2f21191ca2f4bbc09220617333bbaa62c8 (patch) | |
tree | 71f62e35da68be27a3a75e0db6f8d01abb3026a0 /gnuradio-runtime/lib | |
parent | 4be63acd5eff604fa58c8ca10f4bbd6b3cd19587 (diff) |
runtime: add int_t and short_t PDU types
These are not used yet but are valid PDUs and should be included here
so as not to imply PDUs can have only byte/float/complex type uvec's
Signed-off-by: Jacob Gilbert <jacob.gilbert@protonmail.com>
Diffstat (limited to 'gnuradio-runtime/lib')
-rw-r--r-- | gnuradio-runtime/lib/pdu.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gnuradio-runtime/lib/pdu.cc b/gnuradio-runtime/lib/pdu.cc index e01092de20..0c0468419a 100644 --- a/gnuradio-runtime/lib/pdu.cc +++ b/gnuradio-runtime/lib/pdu.cc @@ -58,7 +58,7 @@ const pmt::pmt_t vec() return val; } -} /* namespace ports */ +} /* namespace msgport_names */ namespace pdu { @@ -67,6 +67,10 @@ size_t itemsize(types::vector_type type) switch (type) { case types::byte_t: return sizeof(char); + case types::short_t: + return sizeof(short); + case types::int_t: + return sizeof(int); case types::float_t: return sizeof(float); case types::complex_t: @@ -81,6 +85,10 @@ bool type_matches(types::vector_type type, pmt::pmt_t v) switch (type) { case types::byte_t: return pmt::is_u8vector(v); + case types::short_t: + return pmt::is_s16vector(v); + case types::int_t: + return pmt::is_s32vector(v); case types::float_t: return pmt::is_f32vector(v); case types::complex_t: @@ -95,6 +103,10 @@ pmt::pmt_t make_pdu_vector(types::vector_type type, const uint8_t* buf, size_t i switch (type) { case types::byte_t: return pmt::init_u8vector(items, buf); + case types::short_t: + return pmt::init_s16vector(items, (const short*)buf); + case types::int_t: + return pmt::init_s32vector(items, (const int*)buf); case types::float_t: return pmt::init_f32vector(items, (const float*)buf); case types::complex_t: @@ -108,6 +120,10 @@ types::vector_type type_from_pmt(pmt::pmt_t vector) { if (pmt::is_u8vector(vector)) return types::byte_t; + if (pmt::is_s16vector(vector)) + return types::short_t; + if (pmt::is_s32vector(vector)) + return types::int_t; if (pmt::is_f32vector(vector)) return types::float_t; if (pmt::is_c32vector(vector)) |