This commit is contained in:
coco
2026-07-03 16:05:30 +08:00
commit df489d5640
1101 changed files with 779140 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
// Crc32.cpp: implementation of the Crc32 class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Crc32.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
// Crc32::Crc32()
// {
//
// }
//
// Crc32::~Crc32()
// {
//
// }
unsigned long Crc32::table[ 256 ];
int Crc32::initialized = 0;
Crc32::Crc32( unsigned long init_value )
{
if ( !initialized ) {
int i;
int j;
unsigned long coeff;
for ( i = 0; i < 256 ; i++ ) {
coeff = i;
for ( j = 0; j < 8; j++ ) {
if ( coeff & 1 )
coeff = ( coeff >> 1 ) ^ 0xEDB88320L;
else
coeff >>= 1;
}
table[ i ] = coeff;
}
initialized = 1;
}
crc = init_value;
}