MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / adler32

Function adler32

test/checksummer.c:14–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12const int MOD_ADLER = 65521;
13
14uint64_t adler32(unsigned char *data, int32_t len) /* where data is the location of the data in physical memory and
15 len is the length of the data in bytes */
16{
17 uint64_t a = 1, b = 0;
18 int32_t index;
19
20 /* Process each byte of the data in order */
21 for (index = 0; index < len; ++index)
22 {
23 a = (a + data[index]) % MOD_ADLER;
24 b = (b + a) % MOD_ADLER;
25 }
26
27 return (b << 16) | a;
28}
29
30int main(int argc, char* argv[]) {
31 long bufsize;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected