merged 2.2 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
36
utils/Install/sfxace/uac_crc.c
Normal file
36
utils/Install/sfxace/uac_crc.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* */
|
||||
/* CRC-calculation routines. */
|
||||
/* */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#include "uac_crc.h"
|
||||
|
||||
|
||||
ULONG crctable[256];
|
||||
ULONG rd_crc=0;
|
||||
|
||||
|
||||
void make_crctable(void) // initializes CRC table
|
||||
{
|
||||
ULONG r,
|
||||
i,
|
||||
j;
|
||||
|
||||
for (i = 0; i <= 255; i++)
|
||||
{
|
||||
for (r = i, j = 8; j; j--)
|
||||
r = (r & 1) ? (r >> 1) ^ CRCPOLY : (r >> 1);
|
||||
crctable[i] = r;
|
||||
}
|
||||
}
|
||||
|
||||
// Updates crc from addr till addr+len-1
|
||||
//
|
||||
ULONG getcrc(ULONG crc, UCHAR * addr, INT len)
|
||||
{
|
||||
while (len--)
|
||||
crc = crctable[(unsigned char) crc ^ (*addr++)] ^ (crc >> 8);
|
||||
return (crc);
|
||||
}
|
||||
|
Reference in New Issue
Block a user