-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStdCRC.h
35 lines (26 loc) · 994 Bytes
/
StdCRC.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef STDCRC_H
#define STDCRC_H
/** @file */
/**
* Class for calculating CRC values.
* This class is used for calculating 32 bit CRC values from arbitrarily sized blocks of data.
* The CRC values calculated are compatible with those calculated by the zlib crc32() function,
* although this class is a clean room implementation of that function.
*
* To use it, the user must first call the RCRC::Init() function once in order to generate a lookup
* table that is used to speed up the CRC generation process, and then RCRC::CRC32() may be called
* as many times as desired in order to calculate the CRC value of one or more blocks of data.
*/
class RCRC
{
TBool m_bInitialised; /**< ETrue if RCRC::Init() has been called */
TUint m_auiTable[256]; /**< Array of precalculated binary division remainders */
public:
RCRC()
{
m_bInitialised = EFalse;
}
void Init();
TUint CRC32(TUint a_uiStartCRC, unsigned char *a_pucBuffer, TUint a_uiSize);
};
#endif /* ! STDCRC_H */