Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Zlib
提交
7d45cf5a
T
Third Party Zlib
项目概览
OpenHarmony
/
Third Party Zlib
1 年多 前同步成功
通知
16
Star
112
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Zlib
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7d45cf5a
编写于
2月 11, 2012
作者:
M
Mark Adler
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use optimized byte swap operations for Microsoft and GNU [Snyder].
上级
1a4ba8cd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
13 deletion
+19
-13
crc32.c
crc32.c
+4
-6
inflate.c
inflate.c
+2
-7
zutil.h
zutil.h
+13
-0
未找到文件。
crc32.c
浏览文件 @
7d45cf5a
...
@@ -59,8 +59,6 @@
...
@@ -59,8 +59,6 @@
/* Definitions for doing the crc four data bytes at a time. */
/* Definitions for doing the crc four data bytes at a time. */
#ifdef BYFOUR
#ifdef BYFOUR
typedef
u4
crc_table_t
;
typedef
u4
crc_table_t
;
# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \
(((w)&0xff00)<<8)+(((w)&0xff)<<24))
local
unsigned
long
crc32_little
OF
((
unsigned
long
,
local
unsigned
long
crc32_little
OF
((
unsigned
long
,
const
unsigned
char
FAR
*
,
unsigned
));
const
unsigned
char
FAR
*
,
unsigned
));
local
unsigned
long
crc32_big
OF
((
unsigned
long
,
local
unsigned
long
crc32_big
OF
((
unsigned
long
,
...
@@ -145,11 +143,11 @@ local void make_crc_table()
...
@@ -145,11 +143,11 @@ local void make_crc_table()
and then the byte reversal of those as well as the first table */
and then the byte reversal of those as well as the first table */
for
(
n
=
0
;
n
<
256
;
n
++
)
{
for
(
n
=
0
;
n
<
256
;
n
++
)
{
c
=
crc_table
[
0
][
n
];
c
=
crc_table
[
0
][
n
];
crc_table
[
4
][
n
]
=
REV
(
c
);
crc_table
[
4
][
n
]
=
ZSWAP32
(
c
);
for
(
k
=
1
;
k
<
4
;
k
++
)
{
for
(
k
=
1
;
k
<
4
;
k
++
)
{
c
=
crc_table
[
0
][
c
&
0xff
]
^
(
c
>>
8
);
c
=
crc_table
[
0
][
c
&
0xff
]
^
(
c
>>
8
);
crc_table
[
k
][
n
]
=
c
;
crc_table
[
k
][
n
]
=
c
;
crc_table
[
k
+
4
][
n
]
=
REV
(
c
);
crc_table
[
k
+
4
][
n
]
=
ZSWAP32
(
c
);
}
}
}
}
#endif
/* BYFOUR */
#endif
/* BYFOUR */
...
@@ -317,7 +315,7 @@ local unsigned long crc32_big(crc, buf, len)
...
@@ -317,7 +315,7 @@ local unsigned long crc32_big(crc, buf, len)
register
u4
c
;
register
u4
c
;
register
const
u4
FAR
*
buf4
;
register
const
u4
FAR
*
buf4
;
c
=
REV
((
u4
)
crc
);
c
=
ZSWAP32
((
u4
)
crc
);
c
=
~
c
;
c
=
~
c
;
while
(
len
&&
((
ptrdiff_t
)
buf
&
3
))
{
while
(
len
&&
((
ptrdiff_t
)
buf
&
3
))
{
c
=
crc_table
[
4
][(
c
>>
24
)
^
*
buf
++
]
^
(
c
<<
8
);
c
=
crc_table
[
4
][(
c
>>
24
)
^
*
buf
++
]
^
(
c
<<
8
);
...
@@ -341,7 +339,7 @@ local unsigned long crc32_big(crc, buf, len)
...
@@ -341,7 +339,7 @@ local unsigned long crc32_big(crc, buf, len)
c
=
crc_table
[
4
][(
c
>>
24
)
^
*
buf
++
]
^
(
c
<<
8
);
c
=
crc_table
[
4
][(
c
>>
24
)
^
*
buf
++
]
^
(
c
<<
8
);
}
while
(
--
len
);
}
while
(
--
len
);
c
=
~
c
;
c
=
~
c
;
return
(
unsigned
long
)(
REV
(
c
));
return
(
unsigned
long
)(
ZSWAP32
(
c
));
}
}
#endif
/* BYFOUR */
#endif
/* BYFOUR */
...
...
inflate.c
浏览文件 @
7d45cf5a
...
@@ -519,11 +519,6 @@ unsigned out;
...
@@ -519,11 +519,6 @@ unsigned out;
bits -= bits & 7; \
bits -= bits & 7; \
} while (0)
} while (0)
/* Reverse the bytes in a 32-bit value */
#define REVERSE(q) \
((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
/*
/*
inflate() uses a state machine to process as much input data and generate as
inflate() uses a state machine to process as much input data and generate as
much output data as possible before returning. The state machine is
much output data as possible before returning. The state machine is
...
@@ -817,7 +812,7 @@ int flush;
...
@@ -817,7 +812,7 @@ int flush;
#endif
#endif
case
DICTID
:
case
DICTID
:
NEEDBITS
(
32
);
NEEDBITS
(
32
);
strm
->
adler
=
state
->
check
=
REVERSE
(
hold
);
strm
->
adler
=
state
->
check
=
ZSWAP32
(
hold
);
INITBITS
();
INITBITS
();
state
->
mode
=
DICT
;
state
->
mode
=
DICT
;
case
DICT
:
case
DICT
:
...
@@ -1189,7 +1184,7 @@ int flush;
...
@@ -1189,7 +1184,7 @@ int flush;
#ifdef GUNZIP
#ifdef GUNZIP
state
->
flags
?
hold
:
state
->
flags
?
hold
:
#endif
#endif
REVERSE
(
hold
))
!=
state
->
check
)
{
ZSWAP32
(
hold
))
!=
state
->
check
)
{
strm
->
msg
=
(
char
*
)
"incorrect data check"
;
strm
->
msg
=
(
char
*
)
"incorrect data check"
;
state
->
mode
=
BAD
;
state
->
mode
=
BAD
;
break
;
break
;
...
...
zutil.h
浏览文件 @
7d45cf5a
...
@@ -245,4 +245,17 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
...
@@ -245,4 +245,17 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
/* Reverse the bytes in a 64-bit or 32-bit or 16-bit value */
#if defined(_WIN32) && (_MSC_VER >= 1300) && (defined(_M_IX86) || defined(_M_X64))
# include <stdlib.h>
# pragma intrinsic(_byteswap_ulong)
# define ZSWAP32(q) _byteswap_ulong(q)
#elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# include <byteswap.h>
# define ZSWAP32(q) __builtin_bswap32(q)
#else
# define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
#endif
#endif
/* ZUTIL_H */
#endif
/* ZUTIL_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录