10#ifndef INCLUDED_DVBS2RX_CRC_H
11#define INCLUDED_DVBS2RX_CRC_H
20#define BITS_AFTER_MSB(T) ((sizeof(T) - 1) * 8)
22 (static_cast<T>(1) << (sizeof(T) * 8 - 1))
38 std::array<T, 256> table;
39 for (
int dividend = 0; dividend < 256; dividend++) {
40 T shift_reg =
static_cast<T
>(dividend)
42 for (
unsigned char bit = 0; bit < 8; bit++) {
44 shift_reg = (shift_reg << 1) ^ gen_poly_no_msb;
49 table[dividend] = shift_reg;
64T
calc_crc(
const std::vector<uint8_t>& in_bytes,
const std::array<T, 256>& crc_lut)
67 for (
const uint8_t& in_byte : in_bytes) {
83 crc = (crc << 8) ^ crc_lut[dividend];
#define MSB_MASK(T)
Definition crc.h:21
#define BITS_AFTER_MSB(T)
Definition crc.h:20
std::array< T, 256 > build_crc_lut(const T &gen_poly_no_msb)
Build the CRC computation look-up table (LUT)
Definition crc.h:35
T calc_crc(const std::vector< uint8_t > &in_bytes, const std::array< T, 256 > &crc_lut)
Compute the CRC of a sequence of input bytes.
Definition crc.h:64
Fixed-length double-ended queue with contiguous volk-aligned elements.
Definition gr_bch.h:22