资源简介
飞鸽传书源码,源代码,2016年,vs2015编译通过.知识的搬运工.知识的搬运工.知识的搬运工.知识的搬运工.
代码片段和文件信息
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2011 Mark Adler
* For conditions of distribution and use see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include “zutil.h“
#define local static
local uLong adler32_combine_ OF((uLong adler1 uLong adler2 z_off64_t len2));
#define base 65521 /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(base-1) <= 2^32-1 */
#define DO1(bufi) {adler += (buf)[i]; sum2 += adler;}
#define DO2(bufi) DO1(bufi); DO1(bufi+1);
#define DO4(bufi) DO2(bufi); DO2(bufi+2);
#define DO8(bufi) DO4(bufi); DO4(bufi+4);
#define DO16(buf) DO8(buf0); DO8(buf8);
/* use NO_DIVIDE if your processor does not do division in hardware --
try it both ways to see which is faster */
#ifdef NO_DIVIDE
/* note that this assumes base is 65521 where 65536 % 65521 == 15
(thank you to John Reiser for pointing this out) */
# define CHOP(a) \
do { \
unsigned long tmp = a >> 16; \
a &= 0xffffUL; \
a += (tmp << 4) - tmp; \
} while (0)
# define MOD28(a) \
do { \
CHOP(a); \
if (a >= base) a -= base; \
} while (0)
# define MOD(a) \
do { \
CHOP(a); \
MOD28(a); \
} while (0)
# define MOD63(a) \
do { /* this assumes a is not negative */ \
z_off64_t tmp = a >> 32; \
a &= 0xffffffffL; \
a += (tmp << 8) - (tmp << 5) + tmp; \
tmp = a >> 16; \
a &= 0xffffL; \
a += (tmp << 4) - tmp; \
tmp = a >> 16; \
a &= 0xffffL; \
a += (tmp << 4) - tmp; \
if (a >= base) a -= base; \
} while (0)
#else
# define MOD(a) a %= base
# define MOD28(a) a %= base
# define MOD63(a) a %= base
#endif
/* ========================================================================= */
uLong ZEXPORT adler32(adler buf len)
uLong adler;
const Bytef *buf;
uInt len;
{
unsigned long sum2;
unsigned n;
/* split Adler-32 into component sums */
sum2 = (adler >> 16) & 0xffff;
adler &= 0xffff;
/* in case user likes doing a byte at a time keep it fast */
if (len == 1) {
adler += buf[0];
if (adler >= base)
adler -= base;
sum2 += adler;
if (sum2 >= base)
sum2 -= base;
return adler | (sum2 << 16);
}
/* initial Adler-32 value (deferred check for len == 1 speed) */
if (buf == Z_NULL)
return 1L;
/* in case short lengths are provided keep it somewhat fast */
if (len < 16) {
while (len--) {
adler += *buf++;
sum2 += adler;
}
if (adler >= base)
adler -= base;
MOD28(sum2); /* only added so many base‘s */
return adler | (sum2 << 16);
}
/* do length NMAX blocks -- requires just one modulo operation */
while (len >= NMAX) {
len -= NMAX;
n = NMAX / 16; /
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 30208 2016-03-30 19:05 ipmsg364src\.vs\IPMsg\v14\.suo
....... 4968 2015-10-13 18:29 ipmsg364src\external\zlib\adler32.c
....... 2529 2015-10-13 18:29 ipmsg364src\external\zlib\compress.c
....... 13174 2015-10-13 18:29 ipmsg364src\external\zlib\crc32.c
....... 30562 2015-10-13 18:29 ipmsg364src\external\zlib\crc32.h
....... 71476 2015-10-13 18:29 ipmsg364src\external\zlib\deflate.c
....... 12774 2015-10-13 18:29 ipmsg364src\external\zlib\deflate.h
....... 16573 2015-10-13 18:29 ipmsg364src\external\zlib\FAQ
....... 678 2015-10-13 18:29 ipmsg364src\external\zlib\gzclose.c
....... 6552 2015-10-13 18:29 ipmsg364src\external\zlib\gzguts.h
....... 16415 2015-10-13 18:29 ipmsg364src\external\zlib\gzlib.c
....... 18694 2015-10-13 18:29 ipmsg364src\external\zlib\gzread.c
....... 16199 2015-10-13 18:29 ipmsg364src\external\zlib\gzwrite.c
....... 22709 2015-10-13 18:29 ipmsg364src\external\zlib\infback.c
....... 13455 2015-10-13 18:29 ipmsg364src\external\zlib\inffast.c
....... 427 2015-10-13 18:29 ipmsg364src\external\zlib\inffast.h
....... 6332 2015-10-13 18:29 ipmsg364src\external\zlib\inffixed.h
....... 53512 2015-10-13 18:29 ipmsg364src\external\zlib\inflate.c
....... 6399 2015-10-13 18:29 ipmsg364src\external\zlib\inflate.h
....... 13028 2015-10-13 18:29 ipmsg364src\external\zlib\inftrees.c
....... 2928 2015-10-13 18:29 ipmsg364src\external\zlib\inftrees.h
....... 5185 2015-10-13 18:29 ipmsg364src\external\zlib\README
....... 44255 2015-10-13 18:29 ipmsg364src\external\zlib\trees.c
....... 8472 2015-10-13 18:29 ipmsg364src\external\zlib\trees.h
....... 2003 2015-10-13 18:29 ipmsg364src\external\zlib\uncompr.c
....... 15508 2015-10-13 18:29 ipmsg364src\external\zlib\zconf.h
....... 6568 2015-10-13 18:29 ipmsg364src\external\zlib\zlib.def
....... 87883 2015-10-13 18:29 ipmsg364src\external\zlib\zlib.h
....... 13171 2015-12-24 18:07 ipmsg364src\external\zlib\zlib.vcxproj
....... 1063 2015-10-13 18:29 ipmsg364src\external\zlib\zlib1.rc
............此处省略145个文件信息
- 上一篇:windlx n以内5倍数相乘
- 下一篇:Labview 下的串口调试助手
评论
共有 条评论