diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2018-11-04 10:31:46 -0800 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2018-12-08 12:36:30 +0100 |
commit | cc36e352bafd42a2cddffdff926acdbe448da89f (patch) | |
tree | 8594d0af7b3385ac8bc1bc6318e4abd80fb864a4 /zlib-ng.h | |
parent | 9a143bb48f514065438bd59c234fd4a868fa73c7 (diff) |
Add crc32_combine_gen() and crc32_combine_op() for fast combines.
When the same len2 is used repeatedly, it is faster to use
crc32_combine_gen() to generate an operator, that is then used to
combine CRCs with crc32_combine_op().
Diffstat (limited to 'zlib-ng.h')
-rw-r--r-- | zlib-ng.h | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -1701,6 +1701,21 @@ ZEXTERN uint32_t ZEXPORT zng_crc32_combine(uint32_t crc1, uint32_t crc2, z_off64 len2. */ +/* +ZEXTERN void ZEXPORT zng_crc32_combine_gen(uint32_t op[32], z_off_t len2); + + Generate the operator op corresponding to length len2, to be used with + crc32_combine_op(). op must have room for 32 uint32_t values. (32 is the + number of bits in the CRC.) +*/ + +ZEXTERN uint32_t ZEXPORT zng_crc32_combine_op(uint32_t crc1, uint32_t crc2, + const uint32_t *op); +/* + Give the same result as crc32_combine(), using op in place of len2. op is + is generated from len2 by crc32_combine_gen(). This will be faster than + crc32_combine() if the generated op is used many times. +*/ /* various hacks, don't look :) */ @@ -1782,18 +1797,22 @@ ZEXTERN int ZEXPORT zng_gzgetc_(gzFile file); /* backward compatibility */ #ifdef Z_LARGE64 ZEXTERN uint32_t ZEXPORT zng_adler32_combine64(uint32_t, uint32_t, z_off64_t); ZEXTERN uint32_t ZEXPORT zng_crc32_combine64(uint32_t, uint32_t, z_off64_t); + ZEXTERN void ZEXPORT zng_crc32_combine_gen64(uint32_t *op, z_off64_t); #endif #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) # define zng_adler32_combine zng_adler32_combine64 # define zng_crc32_combine zng_crc32_combine64 +# define zng_crc32_combine_gen zng_crc32_combine_gen64 # ifndef Z_LARGE64 ZEXTERN uint32_t ZEXPORT zng_adler32_combine64(uint32_t, uint32_t, z_off_t); ZEXTERN uint32_t ZEXPORT zng_crc32_combine64(uint32_t, uint32_t, z_off_t); + ZEXTERN void ZEXPORT zng_crc32_combine_gen64(uint32_t *op, z_off64_t); # endif #else ZEXTERN uint32_t ZEXPORT zng_adler32_combine(uint32_t, uint32_t, z_off_t); ZEXTERN uint32_t ZEXPORT zng_crc32_combine(uint32_t, uint32_t, z_off_t); + ZEXTERN void ZEXPORT zng_crc32_combine_gen(uint32_t *op, z_off_t); #endif |