Pavel P [Sun, 11 Feb 2024 15:33:03 +0000 (17:33 +0200)]
Increase alignment from 8 to 16 to avoid warnings with ms compiler
Fixing align attribute, makes ms compiler warn: 'internal_state': Alignment specifier is less than actual alignment (16), and will be ignored.
Increasing alignemnt fixes the warning
Pavel P [Sun, 11 Feb 2024 15:02:37 +0000 (17:02 +0200)]
Fix `deflate_state` alignment with MS or clang-cl compilers
When building with clang-cl, compiler produces the following warning:
zlib-ng/deflate.h(287,3): warning : attribute 'align' is ignored, place it after "struct" to apply attribute to type declaration [-Wignored-attributes]
zlib-ng/zbuild.h(196,34): note: expanded from macro 'ALIGNED_'
Repositioning align attribute after "struct" fixes the warning and aligns `deflate_state` correctly.
Don Olmstead [Thu, 1 Feb 2024 20:49:11 +0000 (12:49 -0800)]
Relocate CMake target export definitions
When exporting a CMake target the `install(TARGETS ${ZLIB_INSTALL_LIBRARIES})` is repeated with an `EXPORT` parameter. On Windows this would install the `.dll` files into the `lib` directory.
Set the `EXPORT_NAME` earlier and unconditionally on the `TARGET`. Then move the `EXPORT` to a single `install(TARGETS)`.
Use zng_alloc_aligned in unit tests to prevent having to use C++17.
alloc_aligned when using in C++ requires C++17 standard. zutil_p.h
include removed from test_crc32 since it was causing the same issue and was
not really needed.
Mark Adler [Tue, 30 Jan 2024 00:38:32 +0000 (16:38 -0800)]
Add LIT_MEM define to use more memory for a small deflate speedup.
A bug fix in zlib 1.2.12 resulted in a slight slowdown (1-2%) of
deflate. This commit provides the option to #define LIT_MEM, which
uses more memory to reverse most of that slowdown. The memory for
the pending buffer and symbol buffers is increased by 25%, which
increases the total memory usage with the default parameters by
about 6%.
Mika Lindqvist [Tue, 23 Jan 2024 05:42:29 +0000 (07:42 +0200)]
Generate CMake package configuration files
* For COMPAT mode, zlib-config.cmake and zlib-config-version.cmake
* For non-COMPAT mode, zlib-ng-config.cmake and zlib-ng-config-version.cmake
Mika Lindqvist [Wed, 24 Jan 2024 20:48:00 +0000 (22:48 +0200)]
Fix regression caused by 2fa631e029084b75acd81db5d33fd4aa802fd082
* POWER8/9 feature checks were enabled even if the toolchain didn't support AT_HWCAP2
* Add detection if we need to include <linux/auxvec.h>
Letu Ren [Sun, 17 Dec 2023 16:58:38 +0000 (00:58 +0800)]
Only read version information from zlib.h.in
This is a patch for https://github.com/zlib-ng/zlib-ng/commit/cd458c79c7923e76ffdd0e2638bf2a0eed4f3996
As the commit message says: "Add code to extract version information
for both ZLIB and ZLIBNG variants from the zlib.h file."
The logic of ${SUFFIX} is that zlib-ng reads version information after
parse ZLIB_COMPAT before the commit mentioned above. ${SUFFIX} will only
be set by ZLIB_COMPAT and is meaningless before ZLIB_COMPAT.
Letu Ren [Thu, 14 Dec 2023 07:27:08 +0000 (15:27 +0800)]
Remove duplicate enable tests option
There are two identical ZLIB_ENABLE_TESTS option in CMakeLists.txt which
means the latter one is meaningless. This issue is introduced in
https://github.com/zlib-ng/zlib-ng/commit/ce1a64b5147b874a2dd32920765be333f54e7095
which adds the option to top but forgets to remove the original one.
Adam Stylinski [Tue, 7 Nov 2023 20:22:55 +0000 (15:22 -0500)]
Detemplatize adler32_fold_copy for avx512
Measurements show deltas basically in the noise floor for the
benchmarks.
The AVX512 VNNI implementation is a bit special in that it seems to be
be hurt by the clock penalty enough versus a normal copy that a 256 bit
wide variant was warranted.
Adam Stylinski [Fri, 17 Nov 2023 23:26:45 +0000 (18:26 -0500)]
Fix an issue with regard to finishing out the window
if inflate is invoked with Z_FINISH, and it deems a window was not
necessary, there's a corner case where we never checksum the bytes.
Detect this by checking the window size against zero and the value
of the flush parameter.
This should fix issue #1600, and possibly #1565 as well.
Added unit test for inflate with Z_FINISH and no window.
This test decompresses a small git pack object with the text:
"alone in the dark". By providing inflate with Z_FINISH, it should not use a
sliding window according to zlib docs. We purposefully limit the read buffer
size to trigger CHECK mode to bail early.