#include "zutil.h"
#include "crc32.h"
Go to the source code of this file.
Defines | |
#define | local static |
#define | TBLS 1 |
#define | DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) |
#define | DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 |
Functions | |
const unsigned long FAR *ZEXPORT | get_crc_table () |
unsigned long ZEXPORT | crc32 (unsigned long crc, const unsigned char FAR *buf, unsigned len) |
#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) |
unsigned long ZEXPORT crc32 | ( | unsigned long | crc, | |
const unsigned char FAR * | buf, | |||
unsigned | len | |||
) |
Definition at line 213 of file crc32.cc.
Referenced by deflate(), deflateReset(), and read_buf().
00214 { 00215 if (buf == Z_NULL) return 0UL; 00216 00217 #ifdef DYNAMIC_CRC_TABLE 00218 if (crc_table_empty) 00219 make_crc_table(); 00220 #endif /* DYNAMIC_CRC_TABLE */ 00221 00222 #ifdef BYFOUR 00223 if (sizeof(void *) == sizeof(ptrdiff_t)) { 00224 u4 endian; 00225 00226 endian = 1; 00227 if (*((unsigned char *)(&endian))) 00228 return crc32_little(crc, buf, len); 00229 else 00230 return crc32_big(crc, buf, len); 00231 } 00232 #endif /* BYFOUR */ 00233 crc = crc ^ 0xffffffffUL; 00234 while (len >= 8) { 00235 DO8; 00236 len -= 8; 00237 } 00238 if (len) do { 00239 DO1; 00240 } while (--len); 00241 return crc ^ 0xffffffffUL; 00242 }
const unsigned long FAR* ZEXPORT get_crc_table | ( | ) |