summaryrefslogtreecommitdiff
path: root/gr-blocks/lib/pack_k_bits_bb_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gr-blocks/lib/pack_k_bits_bb_impl.cc')
-rw-r--r--gr-blocks/lib/pack_k_bits_bb_impl.cc16
1 files changed, 5 insertions, 11 deletions
diff --git a/gr-blocks/lib/pack_k_bits_bb_impl.cc b/gr-blocks/lib/pack_k_bits_bb_impl.cc
index 95a3e7ff08..889e0d29f4 100644
--- a/gr-blocks/lib/pack_k_bits_bb_impl.cc
+++ b/gr-blocks/lib/pack_k_bits_bb_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012-2013 Free Software Foundation, Inc.
+ * Copyright 2012-2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -43,15 +43,14 @@ namespace gr {
: sync_decimator("pack_k_bits_bb",
io_signature::make(1, 1, sizeof(unsigned char)),
io_signature::make(1, 1, sizeof(unsigned char)),
- k),
- d_k(k)
+ k)
{
- if(d_k == 0)
- throw std::out_of_range("interpolation must be > 0");
+ d_pack = new kernel::pack_k_bits(k);
}
pack_k_bits_bb_impl::~pack_k_bits_bb_impl()
{
+ delete d_pack;
}
int
@@ -62,12 +61,7 @@ namespace gr {
const unsigned char *in = (const unsigned char *)input_items[0];
unsigned char *out = (unsigned char *)output_items[0];
- for(int i = 0; i < noutput_items; i++) {
- out[i] = 0x00;
- for(unsigned int j = 0; j < d_k; j++) {
- out[i] |= (0x01 & in[i*d_k+j])<<(d_k-j-1);
- }
- }
+ d_pack->pack(out, in, noutput_items);
return noutput_items;
}