SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
leansdr::crc8_engine Struct Reference

#include <crc.h>

Public Member Functions

 crc8_engine ()
 
uint8_t compute (const uint8_t *buf, int len)
 

Private Attributes

uint8_t table [256]
 

Static Private Attributes

static const uint8_t POLY_DVBS2_CRC8 = 0xd5
 

Detailed Description

Definition at line 29 of file crc.h.

Constructor & Destructor Documentation

◆ crc8_engine()

leansdr::crc8_engine::crc8_engine ( )
inline

Definition at line 31 of file crc.h.

References POLY_DVBS2_CRC8, leansdr::shiftdivmod(), table, and leansdr::bitvect< T, N >::v.

32  {
33  // Precompute
34  // EN 302 307-1 5.1.4 Figure 2
35  bitvect<uint8_t, 8> g = POLY_DVBS2_CRC8;
36  for (int u = 0; u < 256; ++u)
37  {
38  uint8_t u8 = u;
39  bitvect<uint8_t, 8> c = shiftdivmod(&u8, 1, g);
40  table[u] = c.v[0];
41  }
42  }
unsigned char u8
Definition: framework.h:453
unsigned char uint8_t
Definition: rtptypes_win.h:42
uint8_t table[256]
Definition: crc.h:53
static const uint8_t POLY_DVBS2_CRC8
Definition: crc.h:52
bitvect< T, N > shiftdivmod(const Tm *m, size_t nm, const bitvect< T, N > &p, T init=0)
Definition: discrmath.h:138
+ Here is the call graph for this function:

Member Function Documentation

◆ compute()

uint8_t leansdr::crc8_engine::compute ( const uint8_t buf,
int  len 
)
inline

Definition at line 43 of file crc.h.

References table.

44  {
45  uint8_t c = 0;
46  for (; len--; ++buf)
47  c = table[c ^ *buf];
48  return c;
49  }
unsigned char uint8_t
Definition: rtptypes_win.h:42
uint8_t table[256]
Definition: crc.h:53

Member Data Documentation

◆ POLY_DVBS2_CRC8

const uint8_t leansdr::crc8_engine::POLY_DVBS2_CRC8 = 0xd5
staticprivate

Definition at line 52 of file crc.h.

Referenced by crc8_engine().

◆ table

uint8_t leansdr::crc8_engine::table[256]
private

Definition at line 53 of file crc.h.

Referenced by compute(), and crc8_engine().


The documentation for this struct was generated from the following file: