• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

arch/25-Apr-2025-7,5444,864

cmake/25-Apr-2025-1,7111,471

doc/25-Apr-2025-2,5701,738

test/25-Apr-2025-16,52913,609

tools/25-Apr-2025-507320

win32/25-Apr-2025-1,102931

CMakeLists.txtD25-Apr-202557.4 KiB1,4971,382

FAQ.zlibD25-Apr-202516.3 KiB375263

INDEX.mdD25-Apr-20252.8 KiB3735

LICENSE.mdD25-Apr-2025867 2014

Makefile.inD25-Apr-202510.3 KiB398307

PORTING.mdD25-Apr-20253.3 KiB7963

README.mdD25-Apr-202512.5 KiB227173

adler32.cD25-Apr-20253.9 KiB11684

adler32_fold.cD25-Apr-2025414 147

adler32_fold.hD25-Apr-2025323 124

adler32_p.hD25-Apr-20252.2 KiB7152

chunkset.cD25-Apr-2025986 4026

chunkset_tpl.hD25-Apr-20256.3 KiB201142

compare256.cD25-Apr-20254.7 KiB177126

compress.cD25-Apr-20253.8 KiB9958

configureD25-Apr-202575.2 KiB2,2171,931

cpu_features.cD25-Apr-2025633 2517

cpu_features.hD25-Apr-202510.2 KiB247209

crc32_braid.cD25-Apr-20257.7 KiB268192

crc32_braid_comb.cD25-Apr-20252.3 KiB5841

crc32_braid_comb_p.hD25-Apr-2025908 4329

crc32_braid_p.hD25-Apr-2025980 5137

crc32_braid_tbl.hD25-Apr-2025578 KiB9,4479,383

crc32_fold.cD25-Apr-20251.1 KiB3218

crc32_fold.hD25-Apr-2025731 2212

deflate.cD25-Apr-202552.6 KiB1,403955

deflate.hD25-Apr-202515.8 KiB407194

deflate_fast.cD25-Apr-20254 KiB10356

deflate_huff.cD25-Apr-20251.4 KiB4630

deflate_medium.cD25-Apr-202510.4 KiB294197

deflate_p.hD25-Apr-20254.3 KiB11773

deflate_quick.cD25-Apr-20254.2 KiB12783

deflate_rle.cD25-Apr-20253 KiB8156

deflate_slow.cD25-Apr-20255.5 KiB14484

deflate_stored.cD25-Apr-20258.2 KiB187100

fallback_builtins.hD25-Apr-20254 KiB13098

functable.cD25-Apr-202513.6 KiB480409

functable.hD25-Apr-20251.9 KiB3828

gzguts.hD25-Apr-20254.8 KiB14698

gzlib.cD25-Apr-202514.5 KiB526390

gzread.c.inD25-Apr-202519.9 KiB603523

gzwrite.cD25-Apr-202515.7 KiB527357

infback.cD25-Apr-202518.1 KiB498383

inffast.cD25-Apr-202514.6 KiB337212

inffast.hD25-Apr-2025565 196

inffixed_tbl.hD25-Apr-20255.8 KiB9584

inflate.cD25-Apr-202547.7 KiB1,3611,057

inflate.hD25-Apr-20256.9 KiB14183

inflate_p.hD25-Apr-20256.6 KiB206141

inftrees.cD25-Apr-202512.6 KiB298167

inftrees.hD25-Apr-20252.9 KiB6718

insert_string.cD25-Apr-2025593 2210

insert_string_roll.cD25-Apr-2025733 2513

insert_string_tpl.hD25-Apr-20253.5 KiB10959

match_tpl.hD25-Apr-20259.6 KiB289204

slide_hash.cD25-Apr-20251.8 KiB5327

trees.cD25-Apr-202530.8 KiB819465

trees.hD25-Apr-20251.3 KiB4117

trees_emit.hD25-Apr-20256.9 KiB228161

trees_tbl.hD25-Apr-20257.8 KiB133123

uncompr.cD25-Apr-20252.9 KiB8150

zbuild.hD25-Apr-20258.8 KiB257216

zconf-ng.h.inD25-Apr-20254.8 KiB172140

zconf.h.inD25-Apr-20255.1 KiB192156

zendian.hD25-Apr-20251.7 KiB6153

zlib-ng.h.inD25-Apr-202592.8 KiB1,9041,609

zlib-ng.mapD25-Apr-20252.1 KiB107105

zlib.h.inD25-Apr-202592.8 KiB1,8561,560

zlib.mapD25-Apr-20251.4 KiB10086

zlib.pc.cmakeinD25-Apr-2025343 1512

zlib.pc.inD25-Apr-2025303 1512

zlib_name_mangling-ng.h.inD25-Apr-202510.3 KiB176167

zlib_name_mangling.h.emptyD25-Apr-2025230 96

zlib_name_mangling.h.inD25-Apr-20258.5 KiB160153

zutil.cD25-Apr-20254.7 KiB160120

zutil.hD25-Apr-20253.9 KiB14082

zutil_p.hD25-Apr-2025960 4130

README.md

1## zlib-ng
2*zlib data compression library for the next generation systems*
3
4Maintained by Hans Kristian Rosbach
5          aka Dead2 (zlib-ng àt circlestorm dót org)
6
7|CI|Status|
8|:-|-|
9|GitHub Actions|[![Master Branch Status](https://github.com/zlib-ng/zlib-ng/workflows/CI%20CMake/badge.svg)](https://github.com/zlib-ng/zlib-ng/actions) [![Master Branch Status](https://github.com/zlib-ng/zlib-ng/workflows/CI%20Configure/badge.svg)](https://github.com/zlib-ng/zlib-ng/actions) [![Master Branch Status](https://github.com/zlib-ng/zlib-ng/workflows/CI%20NMake/badge.svg)](https://github.com/zlib-ng/zlib-ng/actions)|
10|Buildkite|[![Build status](https://badge.buildkite.com/7bb1ef84356d3baee26202706cc053ee1de871c0c712b65d26.svg?branch=develop)](https://buildkite.com/circlestorm-productions/zlib-ng)|
11|CodeFactor|[![CodeFactor](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng/badge)](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng)|
12|OSS-Fuzz|[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/zlib-ng.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zlib-ng)
13|Codecov|[![codecov.io](https://codecov.io/github/zlib-ng/zlib-ng/coverage.svg?branch=develop)](https://codecov.io/github/zlib-ng/zlib-ng/)|
14
15
16Features
17--------
18
19* Zlib compatible API with support for dual-linking
20* Modernized native API based on zlib API for ease of porting
21* Modern C11 syntax and a clean code layout
22* Deflate medium and quick algorithms based on Intel’s zlib fork
23* Support for CPU intrinsics when available
24  * Adler32 implementation using SSSE3, AVX2, AVX512, AVX512-VNNI, Neon, VMX & VSX
25  * CRC32-B implementation using PCLMULQDQ, VPCLMULQDQ, ACLE, & IBM Z
26  * Hash table implementation using CRC32-C intrinsics on x86 and ARM
27  * Slide hash implementations using SSE2, AVX2, Neon, VMX & VSX
28  * Compare256 implementations using SSE2, AVX2, Neon, & POWER9
29  * Inflate chunk copying using SSE2, AVX, Neon & VSX
30  * Support for hardware-accelerated deflate using IBM Z DFLTCC
31* Unaligned memory read/writes and large bit buffer improvements
32* Includes improvements from Cloudflare and Intel forks
33* Configure, CMake, and NMake build system support
34* Comprehensive set of CMake unit tests
35* Code sanitizers, fuzzing, and coverage
36* GitHub Actions continuous integration on Windows, macOS, and Linux
37  * Emulated CI for ARM, AARCH64, PPC, PPC64, SPARC64, S390x using qemu
38
39
40History
41-------
42
43The motivation for this fork came after seeing several 3rd party
44contributions containing new optimizations not getting implemented
45into the official zlib repository.
46
47Mark Adler has been maintaining zlib for a very long time, and he has
48done a great job and hopefully he will continue for a long time yet.
49The idea of zlib-ng is not to replace zlib, but to co-exist as a
50drop-in replacement with a lower threshold for code change.
51
52zlib has a long history and is incredibly portable, even supporting
53lots of systems that predate the Internet. This is great, but it does
54complicate further development and maintainability.
55The zlib code has numerous workarounds for old compilers that do not
56understand ANSI-C or to accommodate systems with limitations such as
57operating in a 16-bit environment.
58
59Many of these workarounds are only maintenance burdens, some of them
60are pretty huge code-wise. For example, the [v]s[n]printf workaround
61code has a whopping 8 different implementations just to cater to
62various old compilers. With this many workarounds cluttered throughout
63the code, new programmers with an idea/interest for zlib will need
64to take some time to figure out why all of these seemingly strange
65things are used, and how to work within those confines.
66
67So I decided to make a fork, merge all the Intel optimizations, merge
68the Cloudflare optimizations that did not conflict, plus a couple
69of other smaller patches. Then I started cleaning out workarounds,
70various dead code, all contrib and example code as there is little
71point in having those in this fork for various reasons.
72
73A lot of improvements have gone into zlib-ng since its start, and
74numerous people and companies have contributed both small and big
75improvements, or valuable testing.
76
77Please read LICENSE.md, it is very simple and very liberal.
78
79
80Build
81-----
82
83There are two ways to build zlib-ng:
84
85### Cmake
86
87To build zlib-ng using the cross-platform makefile generator cmake.
88
89```
90cmake .
91cmake --build . --config Release
92ctest --verbose -C Release
93```
94
95Alternatively, you can use the cmake configuration GUI tool ccmake:
96
97```
98ccmake .
99```
100
101### Configure
102
103To build zlib-ng using the bash configure script:
104
105```
106./configure
107make
108make test
109```
110
111Build Options
112-------------
113
114| CMake                    | configure                | Description                                                                           | Default |
115|:-------------------------|:-------------------------|:--------------------------------------------------------------------------------------|---------|
116| ZLIB_COMPAT              | --zlib-compat            | Compile with zlib compatible API                                                      | OFF     |
117| ZLIB_ENABLE_TESTS        |                          | Build test binaries                                                                   | ON      |
118| WITH_GZFILEOP            | --without-gzfileops      | Compile with support for gzFile related functions                                     | ON      |
119| WITH_OPTIM               | --without-optimizations  | Build with optimisations                                                              | ON      |
120| WITH_NEW_STRATEGIES      | --without-new-strategies | Use new strategies                                                                    | ON      |
121| WITH_NATIVE_INSTRUCTIONS | --native                 | Compiles with full instruction set supported on this host (gcc/clang -march=native)   | OFF     |
122| WITH_SANITIZER           |                          | Build with sanitizer (memory, address, undefined)                                     | OFF     |
123| WITH_FUZZERS             |                          | Build test/fuzz                                                                       | OFF     |
124| WITH_BENCHMARKS          |                          | Build test/benchmarks                                                                 | OFF     |
125| WITH_MAINTAINER_WARNINGS |                          | Build with project maintainer warnings                                                | OFF     |
126| WITH_CODE_COVERAGE       |                          | Enable code coverage reporting                                                        | OFF     |
127
128
129Install
130-------
131
132WARNING: We do not recommend manually installing unless you really
133know what you are doing, because this can potentially override the system
134default zlib library, and any incompatibility or wrong configuration of
135zlib-ng can make the whole system unusable, requiring recovery or reinstall.
136If you still want a manual install, we recommend using the /opt/ path prefix.
137
138For Linux distros, an alternative way to use zlib-ng (if compiled in
139zlib-compat mode) instead of zlib, is through the use of the
140_LD_PRELOAD_ environment variable. If the program is dynamically linked
141with zlib, then zlib-ng will temporarily be used instead by the program,
142without risking system-wide instability.
143
144```
145LD_PRELOAD=/opt/zlib-ng/libz.so.1.2.11.zlib-ng /usr/bin/program
146```
147
148### Cmake
149
150To install zlib-ng system-wide using cmake:
151
152```
153cmake --build . --target install
154```
155
156### Configure
157
158To install zlib-ng system-wide using the configure script:
159
160```
161make install
162```
163
164Contributing
165------------
166
167Zlib-ng is a aiming to be open to contributions, and we would be delighted to
168receive pull requests on github.
169Just remember that any code you submit must be your own and it must be zlib licensed.
170Help with testing and reviewing of pull requests etc is also very much appreciated.
171
172If you are interested in contributing, please consider joining our
173IRC channel #zlib-ng on the Freenode IRC network.
174
175
176Acknowledgments
177----------------
178
179Thanks to Servebolt.com for sponsoring my maintainership of zlib-ng.
180
181Thanks go out to all the people and companies who have taken the time to contribute
182code reviews, testing and/or patches. Zlib-ng would not have been nearly as good without you.
183
184The deflate format used by zlib was defined by Phil Katz.
185The deflate and zlib specifications were written by L. Peter Deutsch.
186
187zlib was originally created by Jean-loup Gailly (compression)
188and Mark Adler (decompression).
189
190
191Advanced Build Options
192----------------------
193
194| CMake                           | configure             | Description                                                         | Default                |
195|:--------------------------------|:----------------------|:--------------------------------------------------------------------|------------------------|
196| ZLIB_DUAL_LINK                  |                       | Dual link tests with system zlib                                    | OFF                    |
197| FORCE_SSE2                      | --force-sse2          | Skip runtime check for SSE2 instructions (Always on for x86_64)     | OFF (x86)              |
198| FORCE_TZCNT                     | --force-tzcnt         | Skip runtime check for TZCNT instructions                           | OFF                    |
199| WITH_AVX2                       |                       | Build with AVX2 intrinsics                                          | ON                     |
200| WITH_AVX512                     |                       | Build with AVX512 intrinsics                                        | ON                     |
201| WITH_AVX512VNNI                 |                       | Build with AVX512VNNI intrinsics                                    | ON                     |
202| WITH_SSE2                       |                       | Build with SSE2 intrinsics                                          | ON                     |
203| WITH_SSE41                      |                       | Build with SSE41 intrinsics                                         | ON                     |
204| WITH_SSE42                      |                       | Build with SSE42 intrinsics                                         | ON                     |
205| WITH_PCLMULQDQ                  |                       | Build with PCLMULQDQ intrinsics                                     | ON                     |
206| WITH_VPCLMULQDQ                 | --without-vpclmulqdq  | Build with VPCLMULQDQ intrinsics                                    | ON                     |
207| WITH_ACLE                       | --without-acle        | Build with ACLE intrinsics                                          | ON                     |
208| WITH_NEON                       | --without-neon        | Build with NEON intrinsics                                          | ON                     |
209| WITH_ALTIVEC                    | --without-altivec     | Build with AltiVec (VMX) intrinsics                                 | ON                     |
210| WITH_POWER8                     | --without-power8      | Build with POWER8 optimisations                                     | ON                     |
211| WITH_CRC32_VX                   | --without-crc32-vx    | Build with vectorized CRC32 on IBM Z                                | ON                     |
212| WITH_DFLTCC_DEFLATE             | --with-dfltcc-deflate | Build with DFLTCC intrinsics for compression on IBM Z               | OFF                    |
213| WITH_DFLTCC_INFLATE             | --with-dfltcc-inflate | Build with DFLTCC intrinsics for decompression on IBM Z             | OFF                    |
214| WITH_UNALIGNED                  | --without-unaligned   | Allow optimizations that use unaligned reads if safe on current arch| ON                     |
215| WITH_INFLATE_STRICT             |                       | Build with strict inflate distance checking                         | OFF                    |
216| WITH_INFLATE_ALLOW_INVALID_DIST |                       | Build with zero fill for inflate invalid distances                  | OFF                    |
217| INSTALL_UTILS                   |                       | Copy minigzip and minideflate during install                        | OFF                    |
218
219
220Related Projects
221----------------
222
223* Fork of the popular minigzip                  https://github.com/zlib-ng/minizip-ng
224* Python tool to benchmark minigzip/minideflate https://github.com/zlib-ng/deflatebench
225* Python tool to benchmark pigz                 https://github.com/zlib-ng/pigzbench
226* 3rd party patches for zlib-ng compatibility   https://github.com/zlib-ng/patches
227