加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
crc32.c 698 Bytes
一键复制 编辑 原始数据 按行查看 历史
luanhailiang 提交于 2012-08-09 20:44 . My mudos
#include "std.h"
#include "crc32.h"
#define NEED_CRC_TABLE
#include "crctab.h" /* see this file for more CRC credits and
* comments */
/* compute_crc32: compute a cyclic redundancy code for a buffer 'buf' of a
given length 'len'. This trivial little routine was written by
John Garnett. All of the code in crctab.h (the hard stuff) was written
by others. See the comments in the file (crctab.h) for the credits.
*/
UINT32
compute_crc32 P2(unsigned char *, buf, int, len)
{
register UINT32 crc = 0xFFFFFFFFL;
register int j;
j = len;
while (j--) {
/* the UPDC32 macro uses 1st arg only once */
crc = UPDC32((unsigned int) *buf++, crc);
}
return crc;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化