#include "zutil.h"
#include "crc32.h"
Go to the source code of this file.
|
unsigned long gf2_matrix_times | OF ((unsigned long *mat, unsigned long vec)) |
|
void gf2_matrix_square | OF ((unsigned long *square, unsigned long *mat)) |
|
uLong crc32_combine_ | OF ((uLong crc1, uLong crc2, z_off64_t len2)) |
|
const z_crc_t FAR *ZEXPORT | get_crc_table () |
|
unsigned long ZEXPORT | crc32_z (unsigned long crc, const unsigned char FAR *buf, z_size_t len) |
|
unsigned long ZEXPORT | crc32 (unsigned long crc, const unsigned char FAR *buf, uInt len) |
|
unsigned long | gf2_matrix_times (unsigned long *mat, unsigned long vec) |
|
void | gf2_matrix_square (unsigned long *square, unsigned long *mat) |
|
uLong | crc32_combine_ (uLong crc1, uLong crc2, z_off64_t len2) |
|
uLong ZEXPORT | crc32_combine (uLong crc1, uLong crc2, z_off_t len2) |
|
uLong ZEXPORT | crc32_combine64 (uLong crc1, uLong crc2, z_off64_t len2) |
|
◆ DO1
#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) |
◆ DO8
◆ GF2_DIM
#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ |
◆ TBLS
◆ crc32()
unsigned long ZEXPORT crc32 |
( |
unsigned long |
crc, |
|
|
const unsigned char FAR * |
buf, |
|
|
uInt |
len |
|
) |
| |
◆ crc32_combine()
uLong ZEXPORT crc32_combine |
( |
uLong |
crc1, |
|
|
uLong |
crc2, |
|
|
z_off_t |
len2 |
|
) |
| |
Definition at line 427 of file crc32.c.
431{
433}
uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2)
◆ crc32_combine64()
uLong ZEXPORT crc32_combine64 |
( |
uLong |
crc1, |
|
|
uLong |
crc2, |
|
|
z_off64_t |
len2 |
|
) |
| |
◆ crc32_combine_()
uLong crc32_combine_ |
( |
uLong |
crc1, |
|
|
uLong |
crc2, |
|
|
z_off64_t |
len2 |
|
) |
| |
Definition at line 371 of file crc32.c.
375{
377 unsigned long row;
380
381
382 if (len2 <= 0)
383 return crc1;
384
385
386 odd[0] = 0xedb88320UL;
387 row = 1;
390 row <<= 1;
391 }
392
393
395
396
398
399
400
401 do {
402
404 if (len2 & 1)
406 len2 >>= 1;
407
408
409 if (len2 == 0)
410 break;
411
412
414 if (len2 & 1)
416 len2 >>= 1;
417
418
419 } while (len2 != 0);
420
421
422 crc1 ^= crc2;
423 return crc1;
424}
unsigned long gf2_matrix_times(unsigned long *mat, unsigned long vec)
void gf2_matrix_square(unsigned long *square, unsigned long *mat)
Referenced by crc32_combine(), and crc32_combine64().
◆ crc32_z()
unsigned long ZEXPORT crc32_z |
( |
unsigned long |
crc, |
|
|
const unsigned char FAR * |
buf, |
|
|
z_size_t |
len |
|
) |
| |
Definition at line 201 of file crc32.c.
205{
206 if (buf ==
Z_NULL)
return 0UL;
207
208#ifdef DYNAMIC_CRC_TABLE
209 if (crc_table_empty)
210 make_crc_table();
211#endif
212
213#ifdef BYFOUR
214 if (sizeof(void *) == sizeof(ptrdiff_t)) {
215 z_crc_t endian;
216
217 endian = 1;
218 if (*((unsigned char *)(&endian)))
219 return crc32_little(crc, buf, len);
220 else
221 return crc32_big(crc, buf, len);
222 }
223#endif
224 crc = crc ^ 0xffffffffUL;
225 while (len >= 8) {
227 len -= 8;
228 }
229 if (len) do {
231 } while (--len);
232 return crc ^ 0xffffffffUL;
233}
Referenced by crc32().
◆ get_crc_table()
const z_crc_t FAR *ZEXPORT get_crc_table |
( |
| ) |
|
Definition at line 187 of file crc32.c.
188{
189#ifdef DYNAMIC_CRC_TABLE
190 if (crc_table_empty)
191 make_crc_table();
192#endif
194}
const z_crc_t FAR crc_table[TBLS][256]
◆ gf2_matrix_square()
void gf2_matrix_square |
( |
unsigned long * |
square, |
|
|
unsigned long * |
mat |
|
) |
| |
◆ gf2_matrix_times()
unsigned long gf2_matrix_times |
( |
unsigned long * |
mat, |
|
|
unsigned long |
vec |
|
) |
| |
Definition at line 343 of file crc32.c.
346{
347 unsigned long sum;
348
349 sum = 0;
350 while (vec) {
351 if (vec & 1)
352 sum ^= *mat;
353 vec >>= 1;
354 mat++;
355 }
356 return sum;
357}
Referenced by crc32_combine_(), and gf2_matrix_square().
◆ OF() [1/3]
◆ OF() [2/3]
◆ OF() [3/3]