#include "zlib.h"Go to the source code of this file.
Defines | |
| #define | ZLIB_INTERNAL |
| #define | BASE 65521UL |
| #define | NMAX 5552 |
| #define | DO1(buf, i) {s1 += buf[i]; s2 += s1;} |
| #define | DO2(buf, i) DO1(buf,i); DO1(buf,i+1); |
| #define | DO4(buf, i) DO2(buf,i); DO2(buf,i+2); |
| #define | DO8(buf, i) DO4(buf,i); DO4(buf,i+4); |
| #define | DO16(buf) DO8(buf,0); DO8(buf,8); |
| #define | MOD(a) a %= BASE |
Functions | |
| uLong ZEXPORT | adler32 (uLong adler, const Bytef *buf, uInt len) |
| #define BASE 65521UL |
Definition at line 11 of file adler32.cc.
| #define DO1 | ( | buf, | |||
| i | ) | {s1 += buf[i]; s2 += s1;} |
| #define DO16 | ( | buf | ) | DO8(buf,0); DO8(buf,8); |
| #define DO2 | ( | buf, | |||
| i | ) | DO1(buf,i); DO1(buf,i+1); |
Definition at line 16 of file adler32.cc.
| #define DO4 | ( | buf, | |||
| i | ) | DO2(buf,i); DO2(buf,i+2); |
Definition at line 17 of file adler32.cc.
| #define DO8 | ( | buf, | |||
| i | ) | DO4(buf,i); DO4(buf,i+4); |
| #define MOD | ( | a | ) | a %= BASE |
| #define NMAX 5552 |
| #define ZLIB_INTERNAL |
Definition at line 8 of file adler32.cc.
| uLong ZEXPORT adler32 | ( | uLong | adler, | |
| const Bytef * | buf, | |||
| uInt | len | |||
| ) |
Definition at line 47 of file adler32.cc.
References DO16, MOD, and NMAX.
Referenced by deflate(), deflateReset(), deflateSetDictionary(), and read_buf().
00048 { 00049 unsigned long s1 = adler & 0xffff; 00050 unsigned long s2 = (adler >> 16) & 0xffff; 00051 int k; 00052 00053 if (buf == Z_NULL) return 1L; 00054 00055 while (len > 0) { 00056 k = len < NMAX ? (int)len : NMAX; 00057 len -= k; 00058 while (k >= 16) { 00059 DO16(buf); 00060 buf += 16; 00061 k -= 16; 00062 } 00063 if (k != 0) do { 00064 s1 += *buf++; 00065 s2 += s1; 00066 } while (--k); 00067 MOD(s1); 00068 MOD(s2); 00069 } 00070 return (s2 << 16) | s1; 00071 }
1.4.7