📄 crc32.c
字号:
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
DWORD *ZEXPORT get_crc_table()
{
return (DWORD*)crc_table;
}
/* ========================================================================= */
#define DOLIT4 c ^= *buf4++; c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
/* ========================================================================= */
DWORD ZEXPORT crc32(DWORD crc, const BYTE *buf, DWORD len)
{
DWORD c = ~crc;
const DWORD *buf4;
while (len && ((ptrdiff_t)buf &3))
{
c = crc_table[0][(c ^ *buf++) &0xff] ^ (c >> 8);
len--;
}
buf4 = (const DWORD*)buf;
while (len >= 32)
{
DOLIT32;
len -= 32;
}
while (len >= 4)
{
DOLIT4;
len -= 4;
}
buf = (const BYTE*)buf4;
for (; len; len--)
{
c = crc_table[0][(c ^ *buf++) &0xff] ^ (c >> 8);
}
return ~c;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -