tinf_adler32(): Allow to work in incremental manner.
By letting passing in previously calculated partial checksum.
This commit is contained in:
parent
f99e297389
commit
e200028869
2 changed files with 4 additions and 4 deletions
|
|
@ -41,12 +41,12 @@
|
|||
#define A32_BASE 65521
|
||||
#define A32_NMAX 5552
|
||||
|
||||
unsigned int tinf_adler32(const void *data, unsigned int length)
|
||||
unsigned int tinf_adler32(const void *data, unsigned int length, unsigned int prev_sum /* 1 */)
|
||||
{
|
||||
const unsigned char *buf = (const unsigned char *)data;
|
||||
|
||||
unsigned int s1 = 1;
|
||||
unsigned int s2 = 0;
|
||||
unsigned int s1 = prev_sum & 0xffff;
|
||||
unsigned int s2 = prev_sum >> 16;
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ int tinf_gzip_parse_trailer(TINF_GZIP_INFO *gz, const unsigned char **source, un
|
|||
int TINFCC tinf_zlib_uncompress(void *dest, unsigned int *destLen,
|
||||
const void *source, unsigned int sourceLen);
|
||||
|
||||
unsigned int TINFCC tinf_adler32(const void *data, unsigned int length);
|
||||
unsigned int TINFCC tinf_adler32(const void *data, unsigned int length, unsigned int prev_sum /* 1 */);
|
||||
|
||||
unsigned int TINFCC tinf_crc32(const void *data, unsigned int length);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue