Go to the source code of this file.
|
#define | BASE 65521U /* largest prime smaller than 65536 */ |
|
#define | NMAX 5552 |
|
#define | DO1(buf, i) |
|
#define | DO2(buf, i) |
|
#define | DO4(buf, i) |
|
#define | DO8(buf, i) |
|
#define | DO16(buf) |
|
#define | MOD(a) |
|
#define | MOD28(a) |
|
#define | MOD63(a) |
|
|
local uLong adler32_combine_ | OF ((uLong adler1, uLong adler2, z_off64_t len2)) |
|
uLong ZEXPORT | adler32_z (uLong adler, const Bytef *buf, z_size_t len) |
|
uLong ZEXPORT | adler32 (uLong adler, const Bytef *buf, uInt len) |
|
local uLong | adler32_combine_ (uLong adler1, uLong adler2, z_off64_t len2) |
|
uLong ZEXPORT | adler32_combine (uLong adler1, uLong adler2, z_off_t len2) |
|
uLong ZEXPORT | adler32_combine64 (uLong adler1, uLong adler2, z_off64_t len2) |
|
◆ BASE
#define BASE 65521U /* largest prime smaller than 65536 */ |
◆ DO1
Value:{adler += (buf)[i]; sum2 += adler;}
Definition at line 16 of file adler32.c.
◆ DO16
◆ DO2
◆ DO4
◆ DO8
◆ MOD
◆ MOD28
◆ MOD63
◆ NMAX
◆ adler32()
uLong ZEXPORT adler32 |
( |
uLong | adler, |
|
|
const Bytef * | buf, |
|
|
uInt | len ) |
◆ adler32_combine()
uLong ZEXPORT adler32_combine |
( |
uLong | adler1, |
|
|
uLong | adler2, |
|
|
z_off_t | len2 ) |
Definition at line 172 of file adler32.c.
176{
178}
local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2)
◆ adler32_combine64()
uLong ZEXPORT adler32_combine64 |
( |
uLong | adler1, |
|
|
uLong | adler2, |
|
|
z_off64_t | len2 ) |
◆ adler32_combine_()
local uLong adler32_combine_ |
( |
uLong | adler1, |
|
|
uLong | adler2, |
|
|
z_off64_t | len2 ) |
Definition at line 143 of file adler32.c.
147{
148 unsigned long sum1;
149 unsigned long sum2;
150 unsigned rem;
151
152
153 if (len2 < 0)
154 return 0xffffffffUL;
155
156
158 rem = (unsigned)len2;
159 sum1 = adler1 & 0xffff;
160 sum2 = rem * sum1;
162 sum1 += (adler2 & 0xffff) +
BASE - 1;
163 sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) +
BASE - rem;
166 if (sum2 >= ((
unsigned long)
BASE << 1)) sum2 -= ((
unsigned long)
BASE << 1);
168 return sum1 | (sum2 << 16);
169}
Referenced by adler32_combine(), and adler32_combine64().
◆ adler32_z()
uLong ZEXPORT adler32_z |
( |
uLong | adler, |
|
|
const Bytef * | buf, |
|
|
z_size_t | len ) |
Definition at line 63 of file adler32.c.
67{
68 unsigned long sum2;
70
71
72 sum2 = (adler >> 16) & 0xffff;
73 adler &= 0xffff;
74
75
76 if (len == 1) {
77 adler += buf[0];
80 sum2 += adler;
83 return adler | (sum2 << 16);
84 }
85
86
88 return 1L;
89
90
91 if (len < 16) {
92 while (len--) {
93 adler += *buf++;
94 sum2 += adler;
95 }
99 return adler | (sum2 << 16);
100 }
101
102
103 while (len >=
NMAX) {
106 do {
108 buf += 16;
109 } while (--n);
112 }
113
114
115 if (len) {
116 while (len >= 16) {
117 len -= 16;
119 buf += 16;
120 }
121 while (len--) {
122 adler += *buf++;
123 sum2 += adler;
124 }
127 }
128
129
130 return adler | (sum2 << 16);
131}
Referenced by adler32().
◆ OF()