资源简介
zlib-1.2.5 可以编译通过使用,本人亲测,用在了directfb的移植中,成功了
代码片段和文件信息
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2007 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_(uLong adler1 uLong adler2 z_off64_t len2);
#define base 65521UL /* 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 */
#ifdef NO_DIVIDE
# define MOD(a) \
do { \
if (a >= (base << 16)) a -= (base << 16); \
if (a >= (base << 15)) a -= (base << 15); \
if (a >= (base << 14)) a -= (base << 14); \
if (a >= (base << 13)) a -= (base << 13); \
if (a >= (base << 12)) a -= (base << 12); \
if (a >= (base << 11)) a -= (base << 11); \
if (a >= (base << 10)) a -= (base << 10); \
if (a >= (base << 9)) a -= (base << 9); \
if (a >= (base << 8)) a -= (base << 8); \
if (a >= (base << 7)) a -= (base << 7); \
if (a >= (base << 6)) a -= (base << 6); \
if (a >= (base << 5)) a -= (base << 5); \
if (a >= (base << 4)) a -= (base << 4); \
if (a >= (base << 3)) a -= (base << 3); \
if (a >= (base << 2)) a -= (base << 2); \
if (a >= (base << 1)) a -= (base << 1); \
if (a >= base) a -= base; \
} while (0)
# define MOD4(a) \
do { \
if (a >= (base << 4)) a -= (base << 4); \
if (a >= (base << 3)) a -= (base << 3); \
if (a >= (base << 2)) a -= (base << 2); \
if (a >= (base << 1)) a -= (base << 1); \
if (a >= base) a -= base; \
} while (0)
#else
# define MOD(a) a %= base
# define MOD4(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;
- 上一篇:单面透镜光路和像差计算
- 下一篇:nurbs的程序
相关资源
- Zlib.ec易语言模块
- Zlib模块.ec+Zlib模块.dll+
- Zlib模块.ec+Zlib模块.dll
- zlib的使用小例
- Zlib 软件包(zlib-1.2.3)
- Zlib压缩解压工具
- LibcurlOpenSSLZlib.7z
- zlib-1.2.7-win32-x86.zip
- zlib-linux
- zlib 64位库
- 使用pnglib库将png转成bmp代码
- Zip utils src
- libcurld.lib-libeay32.lib-ssleay32.lib-zlib.li
- zlib-1.2.8.tar.gz
- zlib1.2.7 自官方网站
- zlib-1.2.8-win32-x86
- zlib1g-dev_1.2.3.4.dfsg
- zlib128-dll.zip及对应的库文件
- zlib-1.2.11.tar.gz
- zlib128-dll.rar
- zlib128-dll.zip
- zlib-1.2.9
- quazip编译的各个版本和源码
- CentOS7升级OpenSSH到openssh-7.4p1
- zlib128.zip
评论
共有 条评论