diff options
author | Tom Rondeau <tom@trondeau.com> | 2014-05-17 10:31:27 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2014-05-17 17:45:17 -0400 |
commit | 3245fde378417687db10f7cdeb274c9fa126d4e8 (patch) | |
tree | 8b2fe865e74eff60de112e8128d34c3c81c229bc /gr-blocks/lib/unpack_k_bits.cc | |
parent | 15ef5ba664896481faba85c39dc3539f5a4ee5aa (diff) |
blocks: adding reverse packing/unpacking functions.
Diffstat (limited to 'gr-blocks/lib/unpack_k_bits.cc')
-rw-r--r-- | gr-blocks/lib/unpack_k_bits.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gr-blocks/lib/unpack_k_bits.cc b/gr-blocks/lib/unpack_k_bits.cc index f274cf5b60..a9ae4dae11 100644 --- a/gr-blocks/lib/unpack_k_bits.cc +++ b/gr-blocks/lib/unpack_k_bits.cc @@ -55,6 +55,17 @@ namespace gr { } } + void + unpack_k_bits::unpack_rev(unsigned char *bits, const unsigned char *bytes, int nbytes) const + { + int n = 0; + for(int i = 0; i < nbytes; i++) { + unsigned int t = bytes[i]; + for(int j = 0; j < d_k; j++) + bits[n++] = (t >> j) & 0x01; + } + } + int unpack_k_bits::k() const { |