]> git.ipfire.org Git - thirdparty/zlib-ng.git/log
thirdparty/zlib-ng.git
2 years ago2.1.0 Beta1 release 2.1.0-beta1
Hans Kristian Rosbach [Tue, 25 Apr 2023 10:37:32 +0000 (12:37 +0200)] 
2.1.0 Beta1 release

This release contains two years of development and improvements to zlib-ng,
as well as fixes and changes inherited from zlib.

The 2.1.x version series has new targeted minumum buildsystem versions, as detailed on the Wiki https://github.com/zlib-ng/zlib-ng/wiki

Buildsystem:
- Many improvements to the CMake scripts.
- Improved support for detecting memory alignment functions.
- Improved support for unaligned access by letting the compiler promote code to unaligned if supported by the CPU.
- Remove x86 cpu feature detection for TZCNT, safely fallback to BSF.
- Enable using AVX512 intrinsics with GCC <9.

Optimizations and Enhancements:
- Decompression is a lot faster (56% faster measured on AVX2-capable x86-64)
- Compresson is improved for Level 9, at the cost of a little performance.
- Compression is improved for Level 3, by switching from deflate_fast to deflate_medium.
- Levels 3 and 4 have been reconfigured to provide a better gradual tradeoff for speed/compression between levels 2 and 5.
- Deflate_quick (Level 1) has been improved to default to a bigger windowsize and support changing the window size like the other levels.

New instruction set optimizations:
- Adler32 implementation using AVX512, AVX512-VNNI, VMX.
- CRC32-B implementation using VPCLMULQDQ & IBM-Z.
- Slide hash implementation using VMX.
- Compare256 implementations using SSE2, Neon, & POWER9.
- Inflate chunk copying using SSSE3 & VSX.

Compatibility and Porting:
- CRC-32 computation changes from madler/zlib. zlib-ng/zlib-ng#a6155234
- Compatible and up-to-date with zlib 1.2.13.
- Removed the usage of macros in zlib-ng.h, making life easier for languages that want to call the C functions without having the C preprocessor (Python, etc).

Improved support more environments:
- Apple M1
- vcpkg
- Emscripten

Testing:
- Tests have been converted to use GTest. Many new tests have also been added.
- Gbench support has been added to easily benchmark changes to performance-critical functions.

Misc:
- Several pieces of core code has been restructured or rewritten.
- Too many changes to list here, see the git commit log for the full list of changes.

Deprecations:
- Configure no longer has the full range of tests.
- NMake is no longer actively supported and tested, it is now community supported.
- See the wiki for minimum build system versions and deprecations https://github.com/zlib-ng/zlib-ng/wiki

2 years agoFix potential overflow before widening in makecrtc.
Mika Lindqvist [Wed, 26 Apr 2023 16:28:43 +0000 (19:28 +0300)] 
Fix potential overflow before widening in makecrtc.

2 years agoFix use after free in test_deflate_bound.
Mika Lindqvist [Tue, 25 Apr 2023 23:18:24 +0000 (02:18 +0300)] 
Fix use after free in test_deflate_bound.

2 years agoAssure that inflatePrime() can't shift a 32-bit integer by 32 bits.
Mark Adler [Fri, 17 Feb 2023 08:06:32 +0000 (00:06 -0800)] 
Assure that inflatePrime() can't shift a 32-bit integer by 32 bits.

The inflate() functions never leave state->bits greater than 24, so
an inflatePrime() call could not cause this. The only way this
could have happened would be by using inflatePrime() to fill the
bit buffer with 32 bits, and then calling inflatePrime() a *second*
time asking to insert zero bits, for some reason. This commit
assures that a shift by 32 bits does not occur even in that case.

2 years agoUse ZLIB_INCLUDE_DIRS from FindZLIB instead of ZLIB_INCLUDE_DIR.
Nathan Moinvaziri [Mon, 24 Apr 2023 16:04:24 +0000 (09:04 -0700)] 
Use ZLIB_INCLUDE_DIRS from FindZLIB instead of ZLIB_INCLUDE_DIR.

ZLIB_INCLUDE_DIRS is set by FindZLIB if ZLIB_INCLUDE_DIR is set on the
command line.

2 years agoEnsure that unaligned compare256 variants are only used on little endian systems
Cameron Cawley [Sat, 15 Apr 2023 18:08:05 +0000 (19:08 +0100)] 
Ensure that unaligned compare256 variants are only used on little endian systems

2 years agoIBM zSystems: Fix calling deflateBound() before deflateInit()
Ilya Leoshkevich [Wed, 19 Apr 2023 14:03:18 +0000 (16:03 +0200)] 
IBM zSystems: Fix calling deflateBound() before deflateInit()

Even though zlib officialy forbids calling deflateBound() before
deflateInit(), Firefox does this anyway, and it happens to work [1],
but unfortunately not with DFLTCC [2], because the DFLTCC code assumes
that the deflate state is allocated, and segfaults when it isn't.

Bow down before Hyrum's Law and add deflateStateCheck() to
DEFLATE_BOUND_ADJUST_COMPLEN().

Extend the deflate_bound test accordingly.

[1] https://searchfox.org/mozilla-esr102/source/dom/script/ScriptCompression.cpp#97
[2] https://bugzilla.suse.com/show_bug.cgi?id=1210593

2 years agoRename chunkset_avx to chunkset_avx2
Cameron Cawley [Sat, 15 Apr 2023 18:40:54 +0000 (19:40 +0100)] 
Rename chunkset_avx to chunkset_avx2

2 years agoFix compilation on OpenBSD
Benjamin Stürz [Sun, 9 Apr 2023 16:02:04 +0000 (18:02 +0200)] 
Fix compilation on OpenBSD

Non-POSIX functions (like vasprintf() and swap16()) require
_BSD_SOURCE to be defined.

Signed-off-by: Benjamin Stürz <benni@stuerz.xyz>
2 years agoFix CMake check for posix_memalign and aligned_alloc
lawadr [Tue, 4 Apr 2023 13:53:35 +0000 (14:53 +0100)] 
Fix CMake check for posix_memalign and aligned_alloc

These two functions were being checked using check_function_exists. This
CMake macro does not check to see if the given function is declared in
any header as it declares its own function prototype and relies on
linking to determine function availability. This causes two issues.

Firstly, it will always succeed when the CMake toolchain file sets
CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY as no linking will take
place. See: https://gitlab.kitware.com/cmake/cmake/-/issues/18121

Secondly, it will not correctly detect macros or inline functions, or
whether the function is even declared in a header at all.

Switch to check_symbol_exists at CMake's recommendation, the logic of
which actually matches the same checks in the configure script.

2 years agoReverted description with Deprecation notice
Vladislav Shchapov [Thu, 13 Apr 2023 14:18:03 +0000 (19:18 +0500)] 
Reverted description with Deprecation notice

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoFix .pc file paths
Vladislav Shchapov [Sat, 18 Mar 2023 09:43:37 +0000 (14:43 +0500)] 
Fix .pc file paths

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoSwitch to the standard CMake module GNUInstallDirs
Vladislav Shchapov [Fri, 17 Mar 2023 18:27:38 +0000 (23:27 +0500)] 
Switch to the standard CMake module GNUInstallDirs

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoClean up SSE4.2 detection
Cameron Cawley [Tue, 28 Mar 2023 21:05:20 +0000 (22:05 +0100)] 
Clean up SSE4.2 detection

2 years agoCheck for attribute aligned compiler support
lawadr [Thu, 30 Mar 2023 19:37:14 +0000 (20:37 +0100)] 
Check for attribute aligned compiler support

Check for compiler support in CMake and the configure script. This
allows ALIGNED_ to be defined for more compilers so that more than
just Clang, GCC and MSVC can build the project.

2 years agoRemove architecture dependent endian header locations
lawadr [Thu, 30 Mar 2023 15:29:38 +0000 (16:29 +0100)] 
Remove architecture dependent endian header locations

The header locations are OS specific and not architecture specific. The
previous behaviour was to always include machine/endian.h for ARM and
AArch64 architectures on non-Windows and non-Linux OSs, causing build
failures if the OS uses other locations defined further down the
conditional block.

2 years agoEnable use of _mm_shuffle_epi8 on machines without SSE4.1
Cameron Cawley [Tue, 28 Mar 2023 18:01:44 +0000 (19:01 +0100)] 
Enable use of _mm_shuffle_epi8 on machines without SSE4.1

2 years agoShared libraries on cygwin can be named with their version number
Daisuke Fujimura (fd0) [Thu, 9 Mar 2023 13:16:13 +0000 (22:16 +0900)] 
Shared libraries on cygwin can be named with their version number

2 years agoEnable using AVX512 intrinsics with GCC <9
Georgiy Manuilov [Sun, 12 Mar 2023 13:45:53 +0000 (14:45 +0100)] 
Enable using AVX512 intrinsics with GCC <9

Replace missing '_mm512_set_epi8' with
'_mm512_set_epi32' in test code for configuring;
Add fallback for '-mtune=cascadelake' flag used
when AVX512 is enabled.

2 years agoAdd fallback function for '_mm512_set_epi8' intrinsic
Georgiy Manuilov [Sun, 12 Mar 2023 13:45:05 +0000 (14:45 +0100)] 
Add fallback function for '_mm512_set_epi8' intrinsic

'_mm512_set_epi8' intrinsic is missing in GCC <9.
However, its usage can be easily eliminated in
favor of '_mm512_set_epi32' with no loss in
performance enabling older GCC to benefit from
AVX512-optimized codepaths.

2 years agoRemove unused PREFETCH macros
Cameron Cawley [Fri, 24 Mar 2023 22:55:41 +0000 (22:55 +0000)] 
Remove unused PREFETCH macros

2 years agoAdd member to cpu_features struct if empty
lawadr [Mon, 20 Mar 2023 17:46:35 +0000 (17:46 +0000)] 
Add member to cpu_features struct if empty

When WITH_OPTIM is off, the cpu_features struct is empty. This is not
allowed in standard C and causes a build failure with various compilers,
including MSVC.

This adds a dummy char member to the struct if it would otherwise be
empty.

2 years agoFix regex for visibility attribute tests
lawadr [Fri, 17 Mar 2023 16:35:13 +0000 (16:35 +0000)] 
Fix regex for visibility attribute tests

The previous regex of `not supported` was very specific to a particular
compiler (Clang 3.4+). As Clang isn't the only compiler that throws a
warning (but otherwise succeeds) when a visibility isn't supported, make
the regex more generic to hit all such cases.

Testing on Compiler Explorer shows that looking for the string
`visibility` has a better hit rate. `attribute` is perhaps more
dangerously generic, and `hidden`/`internal` doesn't always show up in
warning messages when the visibility attribute itself isn't available.

2 years agoCreate FUNDING.yml
Hans Kristian Rosbach [Sat, 18 Mar 2023 23:36:55 +0000 (00:36 +0100)] 
Create FUNDING.yml

Adds the required file for enabling the `Sponsor` button to appear when viewing the repo.

2 years agoIBM zSystems: Use HWCAP_S390_VXRS
Ilya Leoshkevich [Mon, 6 Mar 2023 22:25:04 +0000 (23:25 +0100)] 
IBM zSystems: Use HWCAP_S390_VXRS

glibc defines HWCAP_S390_VX and, since v2.33, its alias
HWCAP_S390_VXRS; musl has only HWCAP_S390_VXRS.

Use the common HWCAP_S390_VXRS, define it as HWCAP_S390_VX if
necessary.

2 years agoRemove useless assignments
Vladislav Shchapov [Sat, 18 Feb 2023 22:01:07 +0000 (03:01 +0500)] 
Remove useless assignments

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoReplace global CPU feature flag variables with local variable in init_functable
Vladislav Shchapov [Sat, 18 Feb 2023 16:25:55 +0000 (21:25 +0500)] 
Replace global CPU feature flag variables with local variable in init_functable

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoReplace __WIN__ with X86_FEATURES
Vladislav Shchapov [Thu, 23 Feb 2023 18:22:35 +0000 (23:22 +0500)] 
Replace __WIN__ with X86_FEATURES

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoFix TEST_CRC32 macro
Vladislav Shchapov [Sat, 18 Feb 2023 12:58:36 +0000 (17:58 +0500)] 
Fix TEST_CRC32 macro

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoAdd missing test for crc32_vpclmulqdq
Vladislav Shchapov [Sat, 18 Feb 2023 12:46:40 +0000 (17:46 +0500)] 
Add missing test for crc32_vpclmulqdq

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoFix CodeQL warnings: This pointer might have type (size 4), but this pointer arithme...
Vladislav Shchapov [Sat, 18 Feb 2023 09:30:13 +0000 (14:30 +0500)] 
Fix CodeQL warnings: This pointer might have type  (size 4), but this pointer arithmetic is done with type __m128i * (size 16)

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoFix formatting
Vladislav Shchapov [Sat, 18 Feb 2023 09:18:18 +0000 (14:18 +0500)] 
Fix formatting

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoSplit crc32 pclmulqdq and vpclmulqdq implementations
Vladislav Shchapov [Fri, 17 Feb 2023 16:41:46 +0000 (21:41 +0500)] 
Split crc32 pclmulqdq and vpclmulqdq implementations

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoInflate: add fast-path for literals
Dougall Johnson [Mon, 22 Aug 2022 01:44:41 +0000 (11:44 +1000)] 
Inflate: add fast-path for literals

2 years agoInflate: refill unconditionally
Dougall Johnson [Mon, 22 Aug 2022 01:39:35 +0000 (11:39 +1000)] 
Inflate: refill unconditionally

2 years agoFix definition of z_size_t to match documentation of legacy zlib API.
Mika T. Lindqvist [Wed, 7 Dec 2022 19:48:31 +0000 (21:48 +0200)] 
Fix definition of z_size_t to match documentation of legacy zlib API.

2 years agoFix warning: comparison of integer expressions of different signedness: 'size_t'...
Vladislav Shchapov [Fri, 17 Feb 2023 19:02:49 +0000 (00:02 +0500)] 
Fix warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoUse named defines instead of hard coded numbers.
Nathan Moinvaziri [Sun, 12 Feb 2023 01:24:54 +0000 (17:24 -0800)] 
Use named defines instead of hard coded numbers.

2 years agoSort functable alphabetically
Hans Kristian Rosbach [Wed, 8 Feb 2023 21:53:36 +0000 (22:53 +0100)] 
Sort functable alphabetically

2 years agoFix CMake not enabling POWER9_FEATURES
Hans Kristian Rosbach [Tue, 7 Feb 2023 15:03:46 +0000 (16:03 +0100)] 
Fix CMake not enabling POWER9_FEATURES

2 years agoReduce the amount of different defines required for arch-specific optimizations.
Hans Kristian Rosbach [Mon, 6 Feb 2023 13:41:32 +0000 (14:41 +0100)] 
Reduce the amount of different defines required for arch-specific optimizations.
Also removed a reference to a nonexistant adler32_sse41 in test/test_adler32.cc.

2 years agoAdd missing compare256_neon activation to functable
Hans Kristian Rosbach [Mon, 6 Feb 2023 19:05:33 +0000 (20:05 +0100)] 
Add missing compare256_neon activation to functable

2 years agoCombine some of the checks that were not identical.
Hans Kristian Rosbach [Mon, 6 Feb 2023 11:40:13 +0000 (12:40 +0100)] 
Combine some of the checks that were not identical.
Made longest_match and compare256 use the X86_NOCHECK_SSE2 override,
thus now those are also automatically enabled on x86_64.

2 years agoSimplify functable.c
Hans Kristian Rosbach [Mon, 6 Feb 2023 11:29:41 +0000 (12:29 +0100)] 
Simplify functable.c

2 years agoNarrow down the amount of packages installed for Wine.
Hans Kristian Rosbach [Thu, 9 Feb 2023 11:04:09 +0000 (12:04 +0100)] 
Narrow down the amount of packages installed for Wine.

2 years ago[minigzip] Close gzFile before exiting on error.
Mika T. Lindqvist [Fri, 10 Feb 2023 10:06:59 +0000 (12:06 +0200)] 
[minigzip] Close gzFile before exiting on error.

2 years agoFix warnings in benchmarks
Ilya Leoshkevich [Fri, 10 Feb 2023 12:41:07 +0000 (13:41 +0100)] 
Fix warnings in benchmarks

1. Initialize len in benchmark_compare256.cc.

    In function ‘typename std::enable_if<(std::is_trivially_copyable<_Tp>::value && (sizeof (Tp) <= sizeof (Tp*)))>::type benchmark::DoNotOptimize(Tp&) [with Tp = unsigned int]’,
        inlined from ‘void compare256::Bench(benchmark::State&, compare256_func)’ at /zlib-ng/test/benchmarks/benchmark_compare256.cc:44:33,
        inlined from ‘virtual void compare256_c_Benchmark::BenchmarkCase(benchmark::State&)’ at /zlib-ng/test/benchmarks/benchmark_compare256.cc:62:1:
    /zlib-ng/_deps/benchmark-src/include/benchmark/benchmark.h:480:3: warning: ‘len’ may be used uninitialized [-Wmaybe-uninitialized]
      480 |   asm volatile("" : "+m,r"(value) : : "memory");
          |   ^~~
    /zlib-ng/test/benchmarks/benchmark_compare256.cc: In member function ‘virtual void compare256_c_Benchmark::BenchmarkCase(benchmark::State&)’:
    /zlib-ng/test/benchmarks/benchmark_compare256.cc:36:18: note: ‘len’ was declared here
       36 |         uint32_t len;
          |                  ^~~

2. Make the loop counter unsigned in benchmark_slidehash.cc.

    /zlib-ng/test/benchmarks/benchmark_slidehash.cc: In member function ‘virtual void slide_hash::SetUp(const benchmark::State&)’:
    /zlib-ng/test/benchmarks/benchmark_slidehash.cc:29:31: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]
       29 |         for (int32_t i = 0; i < HASH_SIZE; i++) {

2 years agoUpdate zlib-ng ABI files.
Mika Lindqvist [Mon, 6 Feb 2023 03:50:05 +0000 (05:50 +0200)] 
Update zlib-ng ABI files.

2 years agoAdjust thread counts for compiles and tests to avoid under-utilization and congestion.
Hans Kristian Rosbach [Thu, 9 Feb 2023 00:51:09 +0000 (01:51 +0100)] 
Adjust thread counts for compiles and tests to avoid under-utilization and congestion.
The free Github Actions VMs have 2 cores, the dedicated s390x VM has 4 cores.

2 years agoFix various incorrect name mangling
Hans Kristian Rosbach [Tue, 7 Feb 2023 12:57:56 +0000 (13:57 +0100)] 
Fix various incorrect name mangling

2 years agoFix wrong names and invalid entries in zlib.map and zlib-ng.map
Hans Kristian Rosbach [Tue, 7 Feb 2023 09:17:27 +0000 (10:17 +0100)] 
Fix wrong names and invalid entries in zlib.map and zlib-ng.map

2 years agoFix prefixing for internal functions calloc/cfree
Hans Kristian Rosbach [Tue, 7 Feb 2023 09:05:19 +0000 (10:05 +0100)] 
Fix prefixing for internal functions calloc/cfree

2 years agoAdd missing Z_INTERNAL to some functions that should not be exported.
Hans Kristian Rosbach [Sun, 5 Feb 2023 17:01:48 +0000 (18:01 +0100)] 
Add missing Z_INTERNAL to some functions that should not be exported.

2 years agoUse memcpy instead of memcmp for unaligned memory comparisons.
Nathan Moinvaziri [Sun, 5 Feb 2023 20:14:18 +0000 (12:14 -0800)] 
Use memcpy instead of memcmp for unaligned memory comparisons.

Use memcpy because it is better supported for compilers that support unaligned
access than memcmp.

2 years agoFixed link fuzzers against zlib when BUILD_SHARED_LIBS=ON.
Nathan Moinvaziri [Wed, 8 Feb 2023 06:27:37 +0000 (22:27 -0800)] 
Fixed link fuzzers against zlib when BUILD_SHARED_LIBS=ON.

2 years agoSimplify linking gtest_zlib with zlib target based on BUILD_SHARED_LIBS.
Nathan Moinvaziri [Wed, 8 Feb 2023 06:08:55 +0000 (22:08 -0800)] 
Simplify linking gtest_zlib with zlib target based on BUILD_SHARED_LIBS.

Since we turn ZLIBNG_ENABLE_TESTS on or off based on BUILD_SHARED_LIBS, then we
don't have to worry about it when linking against zlib.

2 years agoDisable zlib-ng internal tests when BUILD_SHARED_LIBS=ON.
Nathan Moinvaziri [Wed, 8 Feb 2023 08:32:54 +0000 (00:32 -0800)] 
Disable zlib-ng internal tests when BUILD_SHARED_LIBS=ON.

When BUILD_SHARED_LIBS=ON some zlib-ng internal functions are not exported,
which are used by gtest_zlib and benchmark_zlib. Therefore, we must disable
those tests/projects.

2 years agoAdded CI tests for checking undefined symbols in version scripts.
Nathan Moinvaziri [Wed, 8 Feb 2023 02:20:44 +0000 (18:20 -0800)] 
Added CI tests for checking undefined symbols in version scripts.

2 years agoCorrect inflate_fast function signature
Pavel P [Mon, 6 Feb 2023 15:06:30 +0000 (18:06 +0300)] 
Correct inflate_fast function signature

2 years agoFix ambiguous shift warning in inflateCopy.
Mika T. Lindqvist [Tue, 7 Feb 2023 22:38:33 +0000 (00:38 +0200)] 
Fix ambiguous shift warning in inflateCopy.

2 years agoAdd official Ubuntu mirror list as fallback for Actions caching proxy
Hans Kristian Rosbach [Mon, 6 Feb 2023 14:36:15 +0000 (15:36 +0100)] 
Add official Ubuntu mirror list as fallback for Actions caching proxy

2 years agoUbuntu 18.04 is being removed shortly, update workflows to use 20.04.
Hans Kristian Rosbach [Tue, 7 Feb 2023 22:18:31 +0000 (23:18 +0100)] 
Ubuntu 18.04 is being removed shortly, update workflows to use 20.04.
Clang-6.0 is still supported according to Ubuntu package list website.

2 years agoUpdate mymindstorm/setup-emsdk
Hans Kristian Rosbach [Tue, 7 Feb 2023 16:23:06 +0000 (17:23 +0100)] 
Update mymindstorm/setup-emsdk

2 years agoUpdate ilammy/msvc-dev-cmd
Hans Kristian Rosbach [Tue, 7 Feb 2023 16:20:24 +0000 (17:20 +0100)] 
Update ilammy/msvc-dev-cmd

2 years agoUpdate release uploader
Hans Kristian Rosbach [Tue, 7 Feb 2023 16:19:05 +0000 (17:19 +0100)] 
Update release uploader

2 years agoUpdate codecov uploader
Hans Kristian Rosbach [Tue, 7 Feb 2023 16:18:54 +0000 (17:18 +0100)] 
Update codecov uploader

2 years agoUpdate to actions/upload-artifact@v3
Hans Kristian Rosbach [Tue, 7 Feb 2023 16:10:06 +0000 (17:10 +0100)] 
Update to actions/upload-artifact@v3

2 years agoRemove x86 cpu feature detection for tzcnt
Hans Kristian Rosbach [Sun, 5 Feb 2023 11:55:39 +0000 (12:55 +0100)] 
Remove x86 cpu feature detection for tzcnt

2 years agoRemove FORCE_TZCNT/X86_NOCHECK_TZCNT
Hans Kristian Rosbach [Sat, 4 Feb 2023 21:19:40 +0000 (22:19 +0100)] 
Remove FORCE_TZCNT/X86_NOCHECK_TZCNT

2 years agoReplace __builtin_ctz[ll] fallback functions with branchless implementations.
Hans Kristian Rosbach [Sat, 4 Feb 2023 20:54:09 +0000 (21:54 +0100)] 
Replace __builtin_ctz[ll] fallback functions with branchless implementations.
Added debug assert check for value = 0.
Added more details to the comment to avoid future confusion.
Added fallback logic for older MSVC versions, just in case.

2 years agoRemove unused chunk memory functions from functable.
Nathan Moinvaziri [Sun, 28 Aug 2022 02:34:30 +0000 (19:34 -0700)] 
Remove unused chunk memory functions from functable.

2 years agoUse arch-specific versions of inflate_fast.
Nathan Moinvaziri [Mon, 29 Aug 2022 03:27:37 +0000 (20:27 -0700)] 
Use arch-specific versions of inflate_fast.

This should reduce the cost of indirection that occurs when calling functable
chunk copying functions inside inflate_fast. It should also allow the compiler
to optimize the inflate fast path for the specific architecture.

2 years agoPin Google Benchmark to v1.7.1 to fix the upstream issue https://github.com/google...
Vladislav Shchapov [Fri, 3 Feb 2023 20:06:47 +0000 (01:06 +0500)] 
Pin Google Benchmark to v1.7.1 to fix the upstream issue https://github.com/google/benchmark/issues/1454.

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2 years agoRename local `functable` variable to `ft`
Pavel P [Sun, 22 Jan 2023 11:27:16 +0000 (14:27 +0300)] 
Rename local `functable` variable to `ft`

2 years agoUse local functable variable instead of standalone function pointers
Pavel P [Sun, 22 Jan 2023 10:50:04 +0000 (13:50 +0300)] 
Use local functable variable instead of standalone function pointers

2 years agoMove initialization of functable to `init_functable` function
Pavel P [Fri, 13 Jan 2023 19:27:45 +0000 (22:27 +0300)] 
Move initialization of functable to `init_functable` function

2 years agoAvoid `functable` redefinition in functable.c
Pavel P [Fri, 13 Jan 2023 18:34:32 +0000 (21:34 +0300)] 
Avoid `functable` redefinition in functable.c

`functable` is already declared by functable.h which is included by functable.c

2 years agoSync with zlib 1.2.13 and declare compatibility.
Mika T. Lindqvist [Wed, 14 Dec 2022 13:12:43 +0000 (15:12 +0200)] 
Sync with zlib 1.2.13 and declare compatibility.

2 years agoFix crash when gzsetparams() attempted for transparent write.
Mark Adler [Tue, 27 Dec 2022 07:36:01 +0000 (23:36 -0800)] 
Fix crash when gzsetparams() attempted for transparent write.

gzsetparams() now returns a Z_STREAM_ERROR in this case.

2 years agoFix bug in deflateBound() for level 0 and memLevel 9.
Mark Adler [Thu, 15 Dec 2022 17:07:13 +0000 (09:07 -0800)] 
Fix bug in deflateBound() for level 0 and memLevel 9.

memLevel 9 would cause deflateBound() to assume the use of fixed
blocks, even if the compression level was 0, which forces stored
blocks. That could result in a bound less than the size of the
compressed data. Now level 0 always uses the stored blocks bound.

2 years agoRemove redundant check in gz_look().
Mark Adler [Thu, 6 Oct 2022 19:57:31 +0000 (12:57 -0700)] 
Remove redundant check in gz_look().

2 years agoRemove -pedantic from configure -w compile options.
Mark Adler [Thu, 6 Oct 2022 08:03:18 +0000 (01:03 -0700)] 
Remove -pedantic from configure -w compile options.

2 years agoAdd WIN32_LEAN_AND_MEAN for windows.h include.
Mark Adler [Mon, 3 Oct 2022 15:47:03 +0000 (08:47 -0700)] 
Add WIN32_LEAN_AND_MEAN for windows.h include.

2 years agoFix bug in block type selection when Z_FIXED used.
Mark Adler [Sun, 2 Oct 2022 02:55:29 +0000 (19:55 -0700)] 
Fix bug in block type selection when Z_FIXED used.

A fixed block could be chosen when a stored block was smaller. Now
the smaller of the two is always chosen.

2 years agoHave infback() deliver all of the available output up to any error.
Mark Adler [Sun, 24 Jul 2022 18:41:07 +0000 (11:41 -0700)] 
Have infback() deliver all of the available output up to any error.

2 years agoHave build test report library version if it doesn't match zlib.h.
Mark Adler [Thu, 26 May 2022 15:47:51 +0000 (08:47 -0700)] 
Have build test report library version if it doesn't match zlib.h.

2 years agoAllow disabling visibility attribute with configure
Mika Lindqvist [Sat, 21 Jan 2023 23:16:11 +0000 (01:16 +0200)] 
Allow disabling visibility attribute with configure
* Disable visibility check for Cygwin, MinGW and MSYS as the compiler will only issue warning instead of error for unsupported attributes.

2 years agoFix missing gzip functions when linking example and minigzip binaries.
Mika Lindqvist [Sat, 21 Jan 2023 23:12:24 +0000 (01:12 +0200)] 
Fix missing gzip functions when linking example and minigzip binaries.

2 years agoFix building resource files during out-of-tree build with configure
Mika Lindqvist [Sat, 21 Jan 2023 23:04:55 +0000 (01:04 +0200)] 
Fix building resource files during out-of-tree build with configure

2 years agoAdd support for symbol prefix to linker definition files.
Mika Lindqvist [Sat, 21 Jan 2023 22:59:08 +0000 (00:59 +0200)] 
Add support for symbol prefix to linker definition files.

2 years agoFix configure to use correct linker definition file when --without-gzfileops is speci...
Mika Lindqvist [Sat, 21 Jan 2023 22:57:18 +0000 (00:57 +0200)] 
Fix configure to use correct linker definition file when --without-gzfileops is specified.

2 years agoFix MinGW build
Mika Lindqvist [Fri, 20 Jan 2023 21:37:36 +0000 (23:37 +0200)] 
Fix MinGW build
* Add detection of XSAVE intrinsics

2 years agoAdd assert for tzcnt if building with X86_NOCHECK_TZCNT
Pavel P [Tue, 17 Jan 2023 01:42:24 +0000 (04:42 +0300)] 
Add assert for tzcnt if building with X86_NOCHECK_TZCNT

2 years agoAdd temporary cmake build dirs/files to gitignore
Pavel P [Sun, 22 Jan 2023 21:48:10 +0000 (00:48 +0300)] 
Add temporary cmake build dirs/files to gitignore

2 years agoFix typo found by codespell
Dimitri Papadopoulos [Thu, 2 Feb 2023 15:06:52 +0000 (16:06 +0100)] 
Fix typo found by codespell

2 years agoFix ABI checking...
Mika T. Lindqvist [Tue, 13 Dec 2022 20:06:43 +0000 (22:06 +0200)] 
Fix ABI checking...
* Ubuntu 22.04 use different format for ABI files so old ones need to be removed
* Use more recent zlib-ng commit to avoid issues with internal adler32 and crc32 functions

2 years agoMatch __builtin_ctzl/__builtin_ctzll signatures
Pavel P [Tue, 17 Jan 2023 01:39:37 +0000 (04:39 +0300)] 
Match __builtin_ctzl/__builtin_ctzll signatures

make sure input/output args match original functions from clang/gcc

2 years agoFix MSVC warnings in benchmark code
Cameron Cawley [Fri, 30 Sep 2022 17:59:55 +0000 (18:59 +0100)] 
Fix MSVC warnings in benchmark code

2 years agoUse size_t instead of uint64_t for len in all adler32 functions
Cameron Cawley [Fri, 30 Sep 2022 15:54:16 +0000 (16:54 +0100)] 
Use size_t instead of uint64_t for len in all adler32 functions

2 years agoUse size_t instead of uint64_t for len in all crc32 functions
Cameron Cawley [Fri, 30 Sep 2022 15:06:42 +0000 (16:06 +0100)] 
Use size_t instead of uint64_t for len in all crc32 functions