diff options
Diffstat (limited to 'gr-blocks/lib/unpack_k_bits.cc')
-rw-r--r-- | gr-blocks/lib/unpack_k_bits.cc | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/gr-blocks/lib/unpack_k_bits.cc b/gr-blocks/lib/unpack_k_bits.cc index 967d7e17d9..0865121d02 100644 --- a/gr-blocks/lib/unpack_k_bits.cc +++ b/gr-blocks/lib/unpack_k_bits.cc @@ -30,48 +30,43 @@ #include <iostream> namespace gr { - namespace blocks { - namespace kernel { +namespace blocks { +namespace kernel { - unpack_k_bits::unpack_k_bits(unsigned k) - : d_k(k) - { - if(d_k == 0) - throw std::out_of_range("unpack_k_bits: k must be > 0"); - } +unpack_k_bits::unpack_k_bits(unsigned k) : d_k(k) +{ + if (d_k == 0) + throw std::out_of_range("unpack_k_bits: k must be > 0"); +} - unpack_k_bits::~unpack_k_bits() - { - } +unpack_k_bits::~unpack_k_bits() {} - void - unpack_k_bits::unpack(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 = d_k - 1; j >= 0; j--) +void unpack_k_bits::unpack(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 = d_k - 1; j >= 0; j--) bits[n++] = (t >> j) & 0x01; - } - } + } +} - 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(unsigned int j = 0; j < d_k; j++) +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 (unsigned int j = 0; j < d_k; j++) bits[n++] = (t >> j) & 0x01; - } - } + } +} - int - unpack_k_bits::k() const - { - return d_k; - } +int unpack_k_bits::k() const { return d_k; } - } /* namespace kernel */ - } /* namespace blocks */ +} /* namespace kernel */ +} /* namespace blocks */ } /* namespace gr */ |