diff options
author | Mika Lindqvist <postmaster@raasu.org> | 2020-07-17 03:52:29 +0300 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2020-08-14 22:21:37 +0200 |
commit | e3fcf313af59cfaf1d2aed8402e2b9798f6057cd (patch) | |
tree | d7e130d0db21699ba0698d74ae623285a8e321f2 /crc32.c | |
parent | a0f9ea265f8c08256986a37e57baacf124db61dc (diff) |
Fix signature of crc32_combine(), crc32_combine64() and crc32_z() in compat mode.
Diffstat (limited to 'crc32.c')
-rw-r--r-- | crc32.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -29,11 +29,19 @@ const uint32_t * ZEXPORT PREFIX(get_crc_table)(void) { return (const uint32_t *)crc_table; } +#ifdef ZLIB_COMPAT +unsigned long ZEXPORT PREFIX(crc32_z)(unsigned long crc, const unsigned char *buf, size_t len) { + if (buf == NULL) return 0; + + return (unsigned long) functable.crc32((uint32_t) crc, buf, len); +} +#else uint32_t ZEXPORT PREFIX(crc32_z)(uint32_t crc, const unsigned char *buf, size_t len) { if (buf == NULL) return 0; return functable.crc32(crc, buf, len); } +#endif /* ========================================================================= */ #define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 @@ -182,14 +190,18 @@ static uint32_t crc32_combine_(uint32_t crc1, uint32_t crc2, z_off64_t len2) { /* ========================================================================= */ #ifdef ZLIB_COMPAT -uint32_t ZEXPORT PREFIX(crc32_combine)(uint32_t crc1, uint32_t crc2, z_off_t len2) { - return crc32_combine_(crc1, crc2, len2); +unsigned long ZEXPORT PREFIX(crc32_combine)(unsigned long crc1, unsigned long crc2, z_off_t len2) { + return (unsigned long) crc32_combine_((uint32_t) crc1, (uint32_t) crc2, len2); } -#endif +unsigned long ZEXPORT PREFIX4(crc32_combine)(unsigned long crc1, unsigned long crc2, z_off64_t len2) { + return (unsigned long) crc32_combine_((uint32_t) crc1, (uint32_t) crc2, len2); +} +#else uint32_t ZEXPORT PREFIX4(crc32_combine)(uint32_t crc1, uint32_t crc2, z_off64_t len2) { return crc32_combine_(crc1, crc2, len2); } +#endif #ifdef X86_PCLMULQDQ_CRC #include "arch/x86/x86.h" |