Open r-lyeh-archived opened 9 years ago
or...
static inline uint32_t ComputeAdler32(unsigned char* data, size_t size) {
uint32_t a = 1;
uint32_t b = 0;
for (size_t i = 0; i < size; i++) {
a = (a + data[i]) % 65521;
b = (b + a) % 65521;
}
return (b << 16) | a;
}