a
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// Crc32.h: interface for the Crc32 class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_CRC32_H__B1BA997F_CAA4_4FC6_B899_EF9C3CCC286B__INCLUDED_)
|
||||
#define AFX_CRC32_H__B1BA997F_CAA4_4FC6_B899_EF9C3CCC286B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
class Crc32
|
||||
{
|
||||
private :
|
||||
static unsigned long table[ 256 ];
|
||||
static int initialized;
|
||||
unsigned long crc;
|
||||
public :
|
||||
Crc32( unsigned long init_value );
|
||||
void update( int c );
|
||||
unsigned long value( void )
|
||||
{
|
||||
return crc;
|
||||
}
|
||||
// public:
|
||||
// Crc32();
|
||||
// virtual ~Crc32();
|
||||
};
|
||||
|
||||
inline void Crc32::update( int c )
|
||||
{
|
||||
crc = table[ ( (int) crc ^ ( c & 0xff ) ) & 0xff ] ^
|
||||
( ( crc >> 8 ) & 0x00FFFFFFL );
|
||||
}
|
||||
|
||||
#endif // !defined(AFX_CRC32_H__B1BA997F_CAA4_4FC6_B899_EF9C3CCC286B__INCLUDED_)
|
||||
Reference in New Issue
Block a user