diff options
author | Thomas Habets <thomas@habets.se> | 2021-02-28 22:45:41 +0000 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-03-01 07:52:44 -0500 |
commit | 1eea52a4308f660412e17b13573a5792737c9a02 (patch) | |
tree | 2be132fb70b95280ca6daa9056cf8a227cc46c60 /gr-digital/lib | |
parent | 9649eeb70f2b8bd0f863a007be64c6570915b053 (diff) |
digital/hdlc_deframer: Move static function out of class
Signed-off-by: Thomas Habets <thomas@habets.se>
Diffstat (limited to 'gr-digital/lib')
-rw-r--r-- | gr-digital/lib/hdlc_deframer_bp_impl.cc | 34 | ||||
-rw-r--r-- | gr-digital/lib/hdlc_deframer_bp_impl.h | 2 |
2 files changed, 18 insertions, 18 deletions
diff --git a/gr-digital/lib/hdlc_deframer_bp_impl.cc b/gr-digital/lib/hdlc_deframer_bp_impl.cc index d394f19ed7..4a768ec06b 100644 --- a/gr-digital/lib/hdlc_deframer_bp_impl.cc +++ b/gr-digital/lib/hdlc_deframer_bp_impl.cc @@ -19,6 +19,24 @@ namespace gr { namespace digital { +namespace { +unsigned int crc_ccitt(unsigned char* data, size_t len) +{ + unsigned int POLY = 0x8408; // reflected 0x1021 + unsigned short crc = 0xFFFF; + for (size_t i = 0; i < len; i++) { + crc ^= data[i]; + for (size_t j = 0; j < 8; j++) { + if (crc & 0x01) + crc = (crc >> 1) ^ POLY; + else + crc = (crc >> 1); + } + } + return crc ^ 0xFFFF; +} +} // namespace + hdlc_deframer_bp::sptr hdlc_deframer_bp::make(int length_min = 32, int length_max = 500) { return gnuradio::make_block_sptr<hdlc_deframer_bp_impl>(length_min, length_max); @@ -45,22 +63,6 @@ hdlc_deframer_bp_impl::hdlc_deframer_bp_impl(int length_min, int length_max) */ hdlc_deframer_bp_impl::~hdlc_deframer_bp_impl() {} -unsigned int hdlc_deframer_bp_impl::crc_ccitt(unsigned char* data, size_t len) -{ - unsigned int POLY = 0x8408; // reflected 0x1021 - unsigned short crc = 0xFFFF; - for (size_t i = 0; i < len; i++) { - crc ^= data[i]; - for (size_t j = 0; j < 8; j++) { - if (crc & 0x01) - crc = (crc >> 1) ^ POLY; - else - crc = (crc >> 1); - } - } - return crc ^ 0xFFFF; -} - int hdlc_deframer_bp_impl::work(int noutput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items) diff --git a/gr-digital/lib/hdlc_deframer_bp_impl.h b/gr-digital/lib/hdlc_deframer_bp_impl.h index 9dc7e6f244..28b1fa896b 100644 --- a/gr-digital/lib/hdlc_deframer_bp_impl.h +++ b/gr-digital/lib/hdlc_deframer_bp_impl.h @@ -28,8 +28,6 @@ private: const pmt::pmt_t d_port; - unsigned int crc_ccitt(unsigned char* data, size_t len); - public: hdlc_deframer_bp_impl(int length_min, int length_max); ~hdlc_deframer_bp_impl() override; |