ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
crc8 Class Reference

#include <crc8.h>

Collaboration diagram for crc8:

Public Member Functions

 crc8 ()
 
 ~crc8 ()
 
int calc (int dato)
 
int current ()
 

Private Attributes

int m_crci
 
int m_pol
 
int m_ma
 

Detailed Description

Definition at line 8 of file crc8.h.

Constructor & Destructor Documentation

◆ crc8()

crc8::crc8 ( )

Definition at line 12 of file crc8.cxx.

12  {
13  // cout<<"Inizio della sessione crc8\n";
14  m_crci = 0x00; // crc iniziale,default="00000000"
15  m_pol = 0x838000; // polinomio divisore="1000000111"
16  m_ma = 0x800000; // maschera
17 }

◆ ~crc8()

crc8::~crc8 ( )

Definition at line 19 of file crc8.cxx.

19  {
20  // cout<<"Fine della sessione crc8\n";
21 }

Member Function Documentation

◆ calc()

int crc8::calc ( int  dato)

Definition at line 29 of file crc8.cxx.

29  {
30  int i;
31  int masc;
32  int poli;
33 
34  m_crci = m_crci << 16; // shifta il crc iniziale per metterlo davanti al dato
35  dato = dato ^ m_crci; // mette,tramite xor,il crc davanti al dato
36  masc = m_ma; // carico la maschera
37  poli = m_pol; // carico il polinomio divisore
38 
39  for (i = 0; i < 16; i++) {
40  if (dato & masc) // tramite AND,individua se il MSB e' 1 e divide
41  dato = dato ^ poli; // divisione tra dato e polinomio
42  masc = masc >> 1; // shift per bit successivo
43  poli = poli >> 1; // shift per bit successivo
44  }
45  m_crci = dato; // caricamento del crc ottenuto
46  return 0;
47 }

◆ current()

int crc8::current ( )

Definition at line 23 of file crc8.cxx.

23  {
24  return m_crci;
25  // return pol;
26  // return ma;
27 }

Member Data Documentation

◆ m_crci

int crc8::m_crci
private

Definition at line 16 of file crc8.h.

◆ m_ma

int crc8::m_ma
private

Definition at line 18 of file crc8.h.

◆ m_pol

int crc8::m_pol
private

Definition at line 17 of file crc8.h.


The documentation for this class was generated from the following files:
crc8::m_ma
int m_ma
Definition: crc8.h:18
lumiFormat.i
int i
Definition: lumiFormat.py:85
crc8::m_pol
int m_pol
Definition: crc8.h:17
crc8::m_crci
int m_crci
Definition: crc8.h:16