diff options
author | Thomas Habets <thomas@habets.se> | 2019-12-21 19:21:30 +0000 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2020-01-06 15:38:02 -0800 |
commit | 2c2c65656197596b8455ae0813c3c80cea023406 (patch) | |
tree | dc7ecaf696acce1ff82a1acb4f2a730365551e51 /gr-blocks/lib/unpacked_to_packed_impl.cc | |
parent | b1afefa6b2f95cd1da9cf7736df8416f3654f79e (diff) |
gr-blocks/packed&unpacked: Add const
Diffstat (limited to 'gr-blocks/lib/unpacked_to_packed_impl.cc')
-rw-r--r-- | gr-blocks/lib/unpacked_to_packed_impl.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gr-blocks/lib/unpacked_to_packed_impl.cc b/gr-blocks/lib/unpacked_to_packed_impl.cc index cdca25dd7e..d65f6327b9 100644 --- a/gr-blocks/lib/unpacked_to_packed_impl.cc +++ b/gr-blocks/lib/unpacked_to_packed_impl.cc @@ -66,9 +66,9 @@ template <class T> void unpacked_to_packed_impl<T>::forecast(int noutput_items, gr_vector_int& ninput_items_required) { - int input_required = + const int input_required = (int)ceil((d_index + noutput_items * 1.0 * d_bits_per_type) / d_bits_per_chunk); - unsigned ninputs = ninput_items_required.size(); + const unsigned ninputs = ninput_items_required.size(); for (unsigned int i = 0; i < ninputs; i++) { ninput_items_required[i] = input_required; } @@ -79,9 +79,9 @@ unsigned int unpacked_to_packed_impl<T>::get_bit_be1(const T* in_vector, unsigned int bit_addr, unsigned int bits_per_chunk) { - unsigned int byte_addr = (int)bit_addr / bits_per_chunk; - T x = in_vector[byte_addr]; - unsigned int residue = bit_addr - byte_addr * bits_per_chunk; + const unsigned int byte_addr = (int)bit_addr / bits_per_chunk; + const T x = in_vector[byte_addr]; + const unsigned int residue = bit_addr - byte_addr * bits_per_chunk; // printf("Bit addr %d byte addr %d residue %d val // %d\n",bit_addr,byte_addr,residue,(x>>(bits_per_chunk-1-residue))&1); return (x >> (bits_per_chunk - 1 - residue)) & 1; @@ -96,7 +96,7 @@ int unpacked_to_packed_impl<T>::general_work(int noutput_items, unsigned int index_tmp = d_index; assert(input_items.size() == output_items.size()); - int nstreams = input_items.size(); + const int nstreams = input_items.size(); for (int m = 0; m < nstreams; m++) { const T* in = (T*)input_items[m]; |