diff options
author | Ben Hilburn <ben.hilburn@ettus.com> | 2013-11-27 12:11:23 -0800 |
---|---|---|
committer | Ben Hilburn <ben.hilburn@ettus.com> | 2013-11-27 12:11:23 -0800 |
commit | 9e47ad607b597954e786db6614f5b42123184ccd (patch) | |
tree | f8f021498105c1144968c989b73e37d51d2e94f9 /host/lib/convert/convert_fc32_item32.cpp | |
parent | 0e3912767266473e08386c910954450d16d33664 (diff) | |
download | uhd-9e47ad607b597954e786db6614f5b42123184ccd.tar.gz uhd-9e47ad607b597954e786db6614f5b42123184ccd.tar.bz2 uhd-9e47ad607b597954e786db6614f5b42123184ccd.zip |
Squashed merge of Coverity fixes.
Diffstat (limited to 'host/lib/convert/convert_fc32_item32.cpp')
-rw-r--r-- | host/lib/convert/convert_fc32_item32.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/host/lib/convert/convert_fc32_item32.cpp b/host/lib/convert/convert_fc32_item32.cpp index 29bfefd46..641fc2608 100644 --- a/host/lib/convert/convert_fc32_item32.cpp +++ b/host/lib/convert/convert_fc32_item32.cpp @@ -28,7 +28,7 @@ typedef boost::uint32_t (*to32_type)(boost::uint32_t); template <typename type, to32_type tohost> struct convert_fc32_item32_1_to_star_1 : public converter { - convert_fc32_item32_1_to_star_1(void) + convert_fc32_item32_1_to_star_1(void):_scalar(0.0) { //NOP } @@ -48,9 +48,9 @@ struct convert_fc32_item32_1_to_star_1 : public converter { const item32_t i32 = tohost(input[i++]); const item32_t q32 = tohost(input[i++]); - const float i_f32 = reinterpret_cast<const float &>(i32); - const float q_f32 = reinterpret_cast<const float &>(q32); - output[o] = std::complex<type>(type(i_f32*_scalar), type(q_f32*_scalar)); + const float *i_f32p = reinterpret_cast<const float *>(&i32); + const float *q_f32p = reinterpret_cast<const float *>(&q32); + output[o] = std::complex<type>(type((*i_f32p)*_scalar), type((*q_f32p)*_scalar)); } } @@ -60,7 +60,7 @@ struct convert_fc32_item32_1_to_star_1 : public converter template <typename type, to32_type towire> struct convert_star_1_to_fc32_item32_1 : public converter { - convert_star_1_to_fc32_item32_1(void) + convert_star_1_to_fc32_item32_1(void):_scalar(0.0) { //NOP } @@ -80,9 +80,10 @@ struct convert_star_1_to_fc32_item32_1 : public converter { const float i_f32 = type(input[i].real()*_scalar); const float q_f32 = type(input[i].imag()*_scalar); - const item32_t i32 = towire(reinterpret_cast<const item32_t &>(i_f32)); - const item32_t q32 = towire(reinterpret_cast<const item32_t &>(q_f32)); - output[o++] = i32; output[o++] = q32; + const item32_t *i32p = reinterpret_cast<const item32_t *>(&i_f32); + const item32_t *q32p = reinterpret_cast<const item32_t *>(&q_f32); + output[o++] = towire(*i32p); + output[o++] = towire(*q32p); } } |