| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#include "zbuild.h" |
| 11 |
#include "zutil.h" |
| 12 |
#include "crc32_braid_p.h" |
| 13 |
#include "crc32_braid_tbl.h" |
| 14 |
#include "crc32_braid_comb_p.h" |
| 15 |
|
| 16 |
|
| 17 |
static uint32_t crc32_combine_(uint32_t crc1, uint32_t crc2, z_off64_t len2) { |
| 18 |
return multmodp(x2nmodp(len2, 3), crc1) ^ crc2; |
| 19 |
} |
| 20 |
static uint32_t crc32_combine_gen_(z_off64_t len2) { |
| 21 |
return x2nmodp(len2, 3); |
| 22 |
} |
| 23 |
static uint32_t crc32_combine_op_(uint32_t crc1, uint32_t crc2, const uint32_t op) { |
| 24 |
return multmodp(op, crc1) ^ crc2; |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#ifdef ZLIB_COMPAT |
| 30 |
unsigned long Z_EXPORT PREFIX(crc32_combine)(unsigned long crc1, unsigned long crc2, z_off_t len2) { |
| 31 |
return (unsigned long)crc32_combine_((uint32_t)crc1, (uint32_t)crc2, len2); |
| 32 |
} |
| 33 |
unsigned long Z_EXPORT PREFIX4(crc32_combine)(unsigned long crc1, unsigned long crc2, z_off64_t len2) { |
| 34 |
return (unsigned long)crc32_combine_((uint32_t)crc1, (uint32_t)crc2, len2); |
| 35 |
} |
| 36 |
unsigned long Z_EXPORT PREFIX(crc32_combine_gen)(z_off_t len2) { |
| 37 |
return crc32_combine_gen_(len2); |
| 38 |
} |
| 39 |
unsigned long Z_EXPORT PREFIX4(crc32_combine_gen)(z_off64_t len2) { |
| 40 |
return crc32_combine_gen_(len2); |
| 41 |
} |
| 42 |
unsigned long Z_EXPORT PREFIX(crc32_combine_op)(unsigned long crc1, unsigned long crc2, const unsigned long op) { |
| 43 |
return (unsigned long)crc32_combine_op_((uint32_t)crc1, (uint32_t)crc2, (uint32_t)op); |
| 44 |
} |
| 45 |
#else |
| 46 |
uint32_t Z_EXPORT PREFIX4(crc32_combine)(uint32_t crc1, uint32_t crc2, z_off64_t len2) { |
| 47 |
return crc32_combine_(crc1, crc2, len2); |
| 48 |
} |
| 49 |
uint32_t Z_EXPORT PREFIX(crc32_combine_gen)(z_off64_t len2) { |
| 50 |
return crc32_combine_gen_(len2); |
| 51 |
} |
| 52 |
uint32_t Z_EXPORT PREFIX(crc32_combine_op)(uint32_t crc1, uint32_t crc2, const uint32_t op) { |
| 53 |
return crc32_combine_op_(crc1, crc2, op); |
| 54 |
} |
| 55 |
#endif |
| 56 |
|
| 57 |
|