From b458566951d1a60b89adadd494eca6a64098a91f Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 8 Oct 2015 13:41:23 -0700 Subject: convert: Fixed s16 that would fail on some platforms/compilers --- host/lib/convert/gen_convert_general.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'host/lib/convert') 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(&input[n_words]); - s16_t *last_output_word = reinterpret_cast(&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(&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(&last_input_word); - s16_t *last_output_word = reinterpret_cast(&output[n_words]); - last_output_word[0] = last_input_word_ptr[0]; + item32_t tmp = {to_host}(input[n_words]); + *reinterpret_cast(&output[n_words]) = s16_t(tmp); }} }} """ -- cgit v1.2.3