aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-10-08 13:41:23 -0700
committerMartin Braun <martin.braun@ettus.com>2015-10-08 13:41:23 -0700
commitb458566951d1a60b89adadd494eca6a64098a91f (patch)
tree6c6e916fd81b1440042aa4fb04d45e70f463f625
parent90b88a27d27c52c337941a99773dfeb70e9c5917 (diff)
downloaduhd-b458566951d1a60b89adadd494eca6a64098a91f.tar.gz
uhd-b458566951d1a60b89adadd494eca6a64098a91f.tar.bz2
uhd-b458566951d1a60b89adadd494eca6a64098a91f.zip
convert: Fixed s16 that would fail on some platforms/compilers
-rw-r--r--host/lib/convert/gen_convert_general.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/host/lib/convert/gen_convert_general.py b/host/lib/convert/gen_convert_general.py
index ac8d7c7bd..5c62d51df 100644
--- a/host/lib/convert/gen_convert_general.py
+++ b/host/lib/convert/gen_convert_general.py
@@ -122,10 +122,8 @@ DECLARE_CONVERTER(s16, 1, s16_item32_{end}, 1, PRIORITY_GENERAL) {{
}}
// 2) If nsamps was not a multiple of 2, copy the last one by hand
if (nsamps % 2) {{
- const s16_t *last_input_word = reinterpret_cast<const s16_t *>(&input[n_words]);
- s16_t *last_output_word = reinterpret_cast<s16_t *>(&output[n_words]);
- last_output_word[0] = last_input_word[0];
- output[n_words] = {to_wire}(output[n_words]);
+ item32_t tmp = item32_t(*reinterpret_cast<const s16_t *>(&input[n_words]));
+ output[n_words] = {to_wire}(tmp);
}}
}}
@@ -140,10 +138,8 @@ DECLARE_CONVERTER(s16_item32_{end}, 1, s16, 1, PRIORITY_GENERAL) {{
}}
// 2) If nsamps was not a multiple of 2, copy the last one by hand
if (nsamps % 2) {{
- item32_t last_input_word = {to_host}(input[n_words]);
- const s16_t *last_input_word_ptr = reinterpret_cast<const s16_t *>(&last_input_word);
- s16_t *last_output_word = reinterpret_cast<s16_t *>(&output[n_words]);
- last_output_word[0] = last_input_word_ptr[0];
+ item32_t tmp = {to_host}(input[n_words]);
+ *reinterpret_cast<s16_t *>(&output[n_words]) = s16_t(tmp);
}}
}}
"""