summaryrefslogtreecommitdiff
path: root/gr-blocks/lib/pack_k_bits.cc
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2014-05-17 10:31:27 -0400
committerTom Rondeau <tom@trondeau.com>2014-05-17 17:45:17 -0400
commit3245fde378417687db10f7cdeb274c9fa126d4e8 (patch)
tree8b2fe865e74eff60de112e8128d34c3c81c229bc /gr-blocks/lib/pack_k_bits.cc
parent15ef5ba664896481faba85c39dc3539f5a4ee5aa (diff)
blocks: adding reverse packing/unpacking functions.
Diffstat (limited to 'gr-blocks/lib/pack_k_bits.cc')
-rw-r--r--gr-blocks/lib/pack_k_bits.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/gr-blocks/lib/pack_k_bits.cc b/gr-blocks/lib/pack_k_bits.cc
index d0123f5a09..ad6e78ae18 100644
--- a/gr-blocks/lib/pack_k_bits.cc
+++ b/gr-blocks/lib/pack_k_bits.cc
@@ -54,6 +54,17 @@ namespace gr {
}
}
+ void
+ pack_k_bits::pack_rev(unsigned char *bytes, const unsigned char *bits, int nbytes) const
+ {
+ for(int i = 0; i < nbytes; i++) {
+ bytes[i] = 0x00;
+ for(unsigned int j = 0; j < d_k; j++) {
+ bytes[i] |= (0x01 & bits[i*d_k+j])<<j;
+ }
+ }
+ }
+
} /* namespace kernel */
} /* namespace blocks */
} /* namespace gr */