1 Star 0 Fork 0

caipengxiang/zlib-ng

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
inflate_p.h 2.61 KB
一键复制 编辑 原始数据 按行查看 历史
/* inflate_p.h -- Private inline functions and macros shared with more than one deflate method
*
*/
#ifndef INFLATE_P_H
#define INFLATE_P_H
/*
* Macros shared by inflate() and inflateBack()
*/
/* check function to use adler32() for zlib or crc32() for gzip */
#ifdef GUNZIP
# define UPDATE(check, buf, len) \
(state->flags ? PREFIX(crc32)(check, buf, len) : functable.adler32(check, buf, len))
#else
# define UPDATE(check, buf, len) functable.adler32(check, buf, len)
#endif
/* check macros for header crc */
#ifdef GUNZIP
# define CRC2(check, word) \
do { \
hbuf[0] = (unsigned char)(word); \
hbuf[1] = (unsigned char)((word) >> 8); \
check = PREFIX(crc32)(check, hbuf, 2); \
} while (0)
# define CRC4(check, word) \
do { \
hbuf[0] = (unsigned char)(word); \
hbuf[1] = (unsigned char)((word) >> 8); \
hbuf[2] = (unsigned char)((word) >> 16); \
hbuf[3] = (unsigned char)((word) >> 24); \
check = PREFIX(crc32)(check, hbuf, 4); \
} while (0)
#endif
/* Load registers with state in inflate() for speed */
#define LOAD() \
do { \
put = strm->next_out; \
left = strm->avail_out; \
next = strm->next_in; \
have = strm->avail_in; \
hold = state->hold; \
bits = state->bits; \
} while (0)
/* Restore state from registers in inflate() */
#define RESTORE() \
do { \
strm->next_out = put; \
strm->avail_out = left; \
strm->next_in = (z_const unsigned char *)next; \
strm->avail_in = have; \
state->hold = hold; \
state->bits = bits; \
} while (0)
/* Clear the input bit accumulator */
#define INITBITS() \
do { \
hold = 0; \
bits = 0; \
} while (0)
/* Ensure that there is at least n bits in the bit accumulator. If there is
not enough available input to do that, then return from inflate()/inflateBack(). */
#define NEEDBITS(n) \
do { \
while (bits < (unsigned)(n)) \
PULLBYTE(); \
} while (0)
/* Return the low n bits of the bit accumulator (n < 16) */
#define BITS(n) \
(hold & ((1U << (unsigned)(n)) - 1))
/* Remove n bits from the bit accumulator */
#define DROPBITS(n) \
do { \
hold >>= (n); \
bits -= (unsigned)(n); \
} while (0)
/* Remove zero to seven bits as needed to go to a byte boundary */
#define BYTEBITS() \
do { \
hold >>= bits & 7; \
bits -= bits & 7; \
} while (0)
#endif
/* Set mode=BAD and prepare error message */
#define SET_BAD(errmsg) \
do { \
state->mode = BAD; \
strm->msg = (char *)errmsg; \
} while (0)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/awfeequdng/zlib-ng.git
git@gitee.com:awfeequdng/zlib-ng.git
awfeequdng
zlib-ng
zlib-ng
clickhouse-new

搜索帮助