]> git.ipfire.org Git - thirdparty/zlib-ng.git/log
thirdparty/zlib-ng.git
37 hours agoFix scan_endstr offset in longest_match slow path. develop
Nathan Moin Vaziri [Sat, 11 Apr 2026 03:38:29 +0000 (20:38 -0700)] 
Fix scan_endstr offset in longest_match slow path.

LONGEST_MATCH_SLOW was using len - (STD_MIN_MATCH+1) instead of
len - (STD_MIN_MATCH-1) for the end-of-string hash probe, hashing a
window inside the already-matched region instead of ending one byte
past the current match. The slow path was missing match extensions
it should have been finding. The comment and the upstream fast_zlib
source both specify the correct offset.

Closes #2248.

Reported-by: Sergey "Shnatsel" Davidoff <291257+Shnatsel@users.noreply.github.com>
Reported-by: Folkert de Vries <7949978+folkertdev@users.noreply.github.com>
3 days agoMove shared code to composite actions.
Mika Lindqvist [Thu, 7 May 2026 21:28:46 +0000 (00:28 +0300)] 
Move shared code to composite actions.

3 days ago[CI] Cache Ubuntu .deb packages to speed up installing dependencies.
Mika Lindqvist [Tue, 5 May 2026 22:33:15 +0000 (01:33 +0300)] 
[CI] Cache Ubuntu .deb packages to speed up installing dependencies.
* Purge old packages and unneeded dependencies before copying remaining packages to cached directory

6 days agoAdd /delta workflow for loongarch64
Vladislav Shchapov [Tue, 5 May 2026 13:16:58 +0000 (18:16 +0500)] 
Add /delta workflow for loongarch64

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
7 days ago[CI] Force refreshing homebrew for macOS.
Mika Lindqvist [Wed, 6 May 2026 14:53:37 +0000 (17:53 +0300)] 
[CI] Force refreshing homebrew for macOS.

7 days ago[CI] Use older runner for Visual Studio 2022 jobs.
Mika Lindqvist [Wed, 6 May 2026 01:19:12 +0000 (04:19 +0300)] 
[CI] Use older runner for Visual Studio 2022 jobs.

7 days agoWhen using ALIGN_DOWN() macro, the signedness of types must match to avoid UBSAN...
Mika Lindqvist [Tue, 5 May 2026 19:59:27 +0000 (22:59 +0300)] 
When using ALIGN_DOWN() macro, the signedness of types must match to avoid UBSAN triggering warning about implicit sign change during widening.

7 days agoAdd early return when prev_length already exceeds lookahead
Nathan Moin Vaziri [Sun, 12 Apr 2026 17:00:09 +0000 (10:00 -0700)] 
Add early return when prev_length already exceeds lookahead

Near end-of-input the caller's prev_length can exceed the
current lookahead, making the chain walk pointless since no
match can be longer than the available input. The non-slow
path never clamped this case — break_matching was slow-path
only — leaving the output contract unguarded.

Together with the existing `if (len >= lookahead)` early
return in the update block — which stops the chain walk as
soon as a match reaches lookahead — this ensures no
unnecessary chain steps are taken. madler/zlib does the full
chain walk when prev_length exceeds lookahead and clamps
best_len at the function exit resulting in extra work.

7 days agoRemove dead break_matching label from longest_match
Nathan Moin Vaziri [Sun, 12 Apr 2026 17:01:47 +0000 (10:01 -0700)] 
Remove dead break_matching label from longest_match

The lookahead guard at break_matching is unreachable because
the early return `if (len >= lookahead) return lookahead` fires
before best_len is ever assigned, keeping best_len < lookahead
as a loop invariant. Replace the three goto sites with direct
returns and delete the label entirely.

8 days agoAllow /delta on fork pull requests
Nathan Moin Vaziri [Mon, 4 May 2026 20:47:20 +0000 (13:47 -0700)] 
Allow /delta on fork pull requests

The author_association gate already restricts triggers to OWNER, MEMBER,
or COLLABORATOR, so a maintainer running /delta on a fork PR carries the
same trust as checking the PR out locally. Drop the fork rejection and
the unused base/head repo id parsing.

8 days ago[CI] Use gcov from MinGW32 when generating coverage for 32-bit builds.
Mika Lindqvist [Mon, 4 May 2026 19:01:15 +0000 (22:01 +0300)] 
[CI] Use gcov from MinGW32 when generating coverage for 32-bit builds.

8 days agodeflate_rle: remove unnecessary check for too long matches
Hans Kristian Rosbach [Mon, 4 May 2026 19:38:27 +0000 (21:38 +0200)] 
deflate_rle: remove unnecessary check for too long matches

8 days agoDeflate_fast does not have 'prev_length', fix comment.
Hans Kristian Rosbach [Sun, 3 May 2026 18:07:34 +0000 (20:07 +0200)] 
Deflate_fast does not have 'prev_length', fix comment.

12 days agoFix check against BUILD_ALT_BENCH that was always defined as OFF
Nathan Moin Vaziri [Wed, 22 Apr 2026 20:50:58 +0000 (13:50 -0700)] 
Fix check against BUILD_ALT_BENCH that was always defined as OFF

12 days agoAdd PNG decode benchmark for narrow image widths
Nathan Moinvaziri [Thu, 26 Mar 2026 19:11:59 +0000 (12:11 -0700)] 
Add PNG decode benchmark for narrow image widths

Benchmark libpng row-by-row decoding where avail_out falls
below the 260-byte inflate_fast threshold. Uses a synthetic
gradient-with-noise pixel generator that produces deflate
token distributions representative of real photographs.
Also fix encode_png to use the passed width and height
instead of the hardcoded IMWIDTH and IMHEIGHT constants.

12 days agoFix libpng linking and include paths for benchmark apps
Nathan Moinvaziri [Thu, 26 Mar 2026 17:51:33 +0000 (10:51 -0700)] 
Fix libpng linking and include paths for benchmark apps

The FetchContent path was missing the binary directory from
PNG_INCLUDE_DIR, causing pnglibconf.h not to be found. The
link target was hardcoded to libpng.a which does not resolve
when libpng is built via FetchContent. Use png_static as the
CMake target when fetched, and normalize both paths through
PNG_STATIC_LIBRARY and PNG_INCLUDE_DIR variables.

12 days agoBump actions/cache from 4 to 5
dependabot[bot] [Fri, 1 May 2026 07:52:33 +0000 (07:52 +0000)] 
Bump actions/cache from 4 to 5

Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
12 days agoBump actions/checkout from 4 to 6
dependabot[bot] [Fri, 1 May 2026 07:52:30 +0000 (07:52 +0000)] 
Bump actions/checkout from 4 to 6

Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
12 days agoBump mymindstorm/setup-emsdk from 14 to 16
dependabot[bot] [Fri, 1 May 2026 07:52:24 +0000 (07:52 +0000)] 
Bump mymindstorm/setup-emsdk from 14 to 16

Bumps [mymindstorm/setup-emsdk](https://github.com/mymindstorm/setup-emsdk) from 14 to 16.
- [Release notes](https://github.com/mymindstorm/setup-emsdk/releases)
- [Commits](https://github.com/mymindstorm/setup-emsdk/compare/v14...v16)

---
updated-dependencies:
- dependency-name: mymindstorm/setup-emsdk
  dependency-version: '16'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
12 days agoOptimize adler32_swar alignment and remove platform conditionals
Nathan Moinvaziri [Thu, 19 Mar 2026 19:28:22 +0000 (12:28 -0700)] 
Optimize adler32_swar alignment and remove platform conditionals

12 days agoCall adler32_c directly in adler32_copy_c scalar fallback
Nathan Moinvaziri [Tue, 17 Mar 2026 02:03:25 +0000 (19:03 -0700)] 
Call adler32_c directly in adler32_copy_c scalar fallback

The generic copy function was calling through the function
table, which dispatched to the best SIMD implementation
instead of the scalar path. This led to incorrect benchmarks
for adler32_copy/c since it measured the SIMD path rather
than the scalar fallback. Call adler32_c directly so the
scalar copy variant actually exercises the scalar checksum.

12 days agoAdd SWAR scalar adler32 for 64-bit platforms with unaligned access
Michael Niedermayer [Sun, 15 Mar 2026 08:03:47 +0000 (01:03 -0700)] 
Add SWAR scalar adler32 for 64-bit platforms with unaligned access

Borrows the SWAR (SIMD Within A Register) technique from FFmpeg's
libavutil/adler32.c by Michael Niedermayer. The original splits each
8-byte load into even/odd byte lanes packed as 4x16-bit accumulators
in a uint64_t, with a running prefix sum for the s2 contribution, and
a final reduction using multiply-and-shift with positional weight
constants. The chunk size is capped at 23 iterations of 8 bytes (184
bytes) to keep the 16-bit accumulators from overflowing.

Our improvements over the original FFmpeg implementation:
  - Process 16 bytes per iteration (two 64-bit loads) instead of 8,
    halving loop overhead while staying within the 23-iteration limit.
  - Handle an 8-byte remainder after the 16-byte loop so no bytes
    fall through to the slow scalar path unnecessarily.
  - Applied to both the NMAX inner loop (adler32_c) and the combined
    copy+checksum tail path (adler32_copy_tail) for all callers.

Benchmark results (AArch64, Apple M3, 10 repetitions):
  adler32_c 4MB:   1,131,242 ns -> 232,708 ns  (-79.4%)
  adler32_c 256KB:    70,672 ns ->  14,384 ns  (-79.7%)
  adler32_c 4KB:       1,105 ns ->     228 ns  (-79.3%)
  adler32_c 512B:        141 ns ->      29 ns  (-79.3%)
  adler32_c 64B:          20 ns ->       6 ns  (-69.6%)

https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/adler32.c

Co-Authored-By: Nathan Moinvaziri <nathan@nathanm.com>
12 days agoSimplify safe-mode copy path selection in inflate_fast
Nathan Moinvaziri [Wed, 25 Mar 2026 00:34:05 +0000 (17:34 -0700)] 
Simplify safe-mode copy path selection in inflate_fast

The branch structure now tests safe_mode directly, which is clearer and
produces the same code on all platforms. No functional change to the copy
operations used.

12 days agoAdd inflateBack test for safe mode bailout MATCH state handler
Nathan Moinvaziri [Tue, 10 Mar 2026 21:28:50 +0000 (14:28 -0700)] 
Add inflateBack test for safe mode bailout MATCH state handler

12 days agoImprove inflate_fast performance for small output buffers
Nathan Moinvaziri [Tue, 10 Mar 2026 19:00:02 +0000 (12:00 -0700)] 
Improve inflate_fast performance for small output buffers

Lowers the inflate_fast entry threshold from 260 to 3 bytes of
available output by adding a safe_mode parameter that uses
bounds-checked copies and bails to the MATCH state when output
space is insufficient. This eliminates the performance cliff
where libpng-style row-by-row decompression falls back to the
slow inflate path for the last 260 bytes of each row.

2 weeks agoReplace small/large buffer tests with parameterized test_chunked
Nathan Moinvaziri [Tue, 14 Apr 2026 03:20:26 +0000 (20:20 -0700)] 
Replace small/large buffer tests with parameterized test_chunked

test_large_buffers reset d_stream.next_out on every inflate iteration, so the
decompressed output was never compared against the source. test_chunked keeps
the input, compressed, and decompressed buffers separate and checks them with
memcmp.

New avail_out values (3, 64, 128, 256, 259) exercise inflate_fast()'s safe-mode
MATCH-state bailout around the 258-byte maximum match length.

2 weeks agoBump Google Benchmark to v1.9.5
Mika T. Lindqvist [Thu, 23 Apr 2026 11:46:39 +0000 (14:46 +0300)] 
Bump Google Benchmark to v1.9.5
* Google Benchmark v1.9.4 fails to compile with recent versions of clang and Visual C++ if warnings are treated as errors

2 weeks agoAdd compressed and ratio fields to deflate/corpora benchmarks
Nathan Moin Vaziri [Mon, 13 Apr 2026 05:27:42 +0000 (22:27 -0700)] 
Add compressed and ratio fields to deflate/corpora benchmarks

2 weeks agoAdd corpora benchmarks for deflate and inflate
Nathan Moin Vaziri [Wed, 8 Apr 2026 01:17:52 +0000 (18:17 -0700)] 
Add corpora benchmarks for deflate and inflate

Adds benchmark_corpora.cc which dynamically discovers and benchmarks
all files from the zlib-ng/corpora repository (silesia, calgary,
canterbury, large, snappy, etc.).

Benchmarks are registered at startup using RegisterBenchmark. If the
corpora directory is not present, no benchmarks are registered.
Deflate is tested at levels 1, 6, and 9 per file. Inflate is tested
once per file using data pre-compressed at level 9.

3 weeks agoAdd --benchmark_cooldown flag to mitigate thermal throttling
Nathan Moin Vaziri [Wed, 8 Apr 2026 01:10:20 +0000 (18:10 -0700)] 
Add --benchmark_cooldown flag to mitigate thermal throttling

Adds a --benchmark_cooldown=<seconds> flag that inserts a sleep between
benchmark families. This helps produce consistent results on systems
where sustained workloads cause thermal throttling and CPU frequency
scaling.

Uses a wrapping BenchmarkReporter that sleeps before forwarding results
to the default display reporter.

3 weeks agoAdd /delta workflow for per-PR binary size comparison
Nathan Moin Vaziri [Tue, 14 Apr 2026 18:01:39 +0000 (11:01 -0700)] 
Add /delta workflow for per-PR binary size comparison

On a /delta PR comment the job builds the PR head and base with
RelWithDebInfo, splits the DWARF into sibling .debug companions, and
runs several tools against both stripped libraries:

- binutils size for text/data/bss totals plus a Δ row
- bloaty for sections, top 30 compile units, and top 30 symbols
- nm --defined-only --dynamic to diff the exported symbol set
- abidiff for C ABI changes (honouring test/abi/ignore)
- minigzip at levels 1-9 over silesia-small.tar and, on native
  builds, the full silesia.tar

Results come back as a "## Delta Report" PR comment with a details
block per section, reporting both head and base SHAs so offset runs
are unambiguous.

Comment syntax is /delta [arch] [-N]. Arch defaults to x86_64 and
accepts aarch64, powerpc64le, riscv64, and s390x. -N selects the Nth
commit back from the PR head so a regression can be bisected without
force-pushing. Cross-compile builds reuse cmake/toolchain-*.cmake
and run the stripped binaries under qemu-user.

3 weeks agoUse fallback defines for Chorba Scalar/SSE
Nathan Moinvaziri [Wed, 18 Feb 2026 08:29:00 +0000 (00:29 -0800)] 
Use fallback defines for Chorba Scalar/SSE

Gate Scalar and SSE chorba uniformly on CRC32_CHORBA_FALLBACK and
CRC32_CHORBA_SSE_FALLBACK across prototypes, dispatch, sources, tests
and benchmarks instead of spot-checking WITHOUT_CHORBA /
WITHOUT_CHORBA_SSE directly at each site.

Also move crc32_chorba_c.c into ZLIB_GENERIC_SRCS and align Makefile.in
to match so the CMake and autotools builds stay bit-identical.

3 weeks agoRemove inert comment about disabling Chorba SSE in X86 functions header
Nathan Moin Vaziri [Sat, 18 Apr 2026 21:16:40 +0000 (14:16 -0700)] 
Remove inert comment about disabling Chorba SSE in X86 functions header

This was never correct, it should have been WITHOUT_CHORBA_SSE not NO_CHORBA_SSE

3 weeks agoFix typo in No Chorba CMake option name in CI
Nathan Moin Vaziri [Sat, 18 Apr 2026 20:49:12 +0000 (13:49 -0700)] 
Fix typo in No Chorba CMake option name in CI

The 'Ubuntu GCC No Chorba' matrix entry was passing -DWITH_CHORBA=OFF
since its introduction in 9d4af458, but the actual CMake option is
named WITH_CRC32_CHORBA.

3 weeks agoRemove CMake warning about MSVC Chorba bug
Nathan Moin Vaziri [Sat, 18 Apr 2026 20:52:57 +0000 (13:52 -0700)] 
Remove CMake warning about MSVC Chorba bug

The Chorba bug on SSE2/SSE41 has been fixed so this no longer applies.

3 weeks agoMerge duplicate 32-bit _mm_cvtsi64_si128 polyfills
Nathan Moin Vaziri [Fri, 17 Apr 2026 20:23:52 +0000 (13:23 -0700)] 
Merge duplicate 32-bit _mm_cvtsi64_si128 polyfills

The MSVC and GCC 32-bit polyfills for _mm_cvtsi64_si128 /
_mm_cvtsi128_si64 had identical bodies. Merge them into a single
block guarded by !__clang__ && ARCH_32BIT, with the MSVC-only
#include <intrin.h> nested inside.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agoFix MSVC v142 miscompile of _mm_cvtsi64_si128 polyfill on 32-bit
Nathan Moin Vaziri [Fri, 17 Apr 2026 20:22:49 +0000 (13:22 -0700)] 
Fix MSVC v142 miscompile of _mm_cvtsi64_si128 polyfill on 32-bit

MSVC v142 (Visual Studio 2019, and VS 2022 pre-17.11) miscompiles
_mm_set_epi64x(0, a) on 32-bit Windows by routing part of the synthesis
through a GPR, clobbering live register data and causing stack corruption
in the chorba SSE2/SSE4.1 CRC32 code paths.

Replace the _mm_set_epi64x(0, a) polyfill with _mm_loadl_epi64 which
compiles to a single MOVQ xmm,m64 that bypasses the buggy synthesis
path. Also convert the GCC 32-bit _mm_cvtsi64_si128 macro to a static
inline for consistency, and drop the redundant ARCH_X86 guard since
x86_intrins.h is only reachable from x86 code.

https://developercommunity.visualstudio.com/t/10853479

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agoFix UBSAN implicit conversion warning in test/fuzz/fuzzer_example_flush.c.
Hans Kristian Rosbach [Wed, 15 Apr 2026 13:31:48 +0000 (15:31 +0200)] 
Fix UBSAN implicit conversion warning in test/fuzz/fuzzer_example_flush.c.

3 weeks agoFix UBSAN implicit conversion warning in test/test_deflate_concurrency.cc.
Hans Kristian Rosbach [Wed, 15 Apr 2026 12:58:44 +0000 (14:58 +0200)] 
Fix UBSAN implicit conversion warning in test/test_deflate_concurrency.cc.

3 weeks agoFix UBSAN implicit conversion warning in test/test_shared_ng.h.
Hans Kristian Rosbach [Wed, 15 Apr 2026 12:27:27 +0000 (14:27 +0200)] 
Fix UBSAN implicit conversion warning in test/test_shared_ng.h.

3 weeks agoFix UBSAN implicit conversion warning in arch/s390/crc32_vx.c.
Hans Kristian Rosbach [Wed, 15 Apr 2026 12:13:20 +0000 (14:13 +0200)] 
Fix UBSAN implicit conversion warning in arch/s390/crc32_vx.c.

3 weeks agoFix UBSAN implicit conversion warning in inftrees.c.
Hans Kristian Rosbach [Wed, 15 Apr 2026 11:39:54 +0000 (13:39 +0200)] 
Fix UBSAN implicit conversion warning in inftrees.c.

Co-authored-by: Nathan Moin Vaziri <nathan@nathanm.com>
3 weeks agoCMake: Add 'implicit-conversion' and 'nullability' to sanitizers
Hans Kristian Rosbach [Mon, 2 Mar 2026 21:12:58 +0000 (22:12 +0100)] 
CMake: Add 'implicit-conversion' and 'nullability' to sanitizers
we attempt to enable with ubsan builds.

3 weeks agoRename longest_match_slow to longest_match_roll
Nathan Moin Vaziri [Mon, 13 Apr 2026 22:26:24 +0000 (15:26 -0700)] 
Rename longest_match_slow to longest_match_roll

The "slow" variant of longest_match uses a 3-byte rolling hash to seed
its offset-search lookups after a match has been found. Rename the
template gate, the functable entry, and all arch-specific instantiations
from *_slow to *_roll to reflect what the variant actually uses, so a
separate integer-hash offset-search variant can coexist under its own
name.

Pure rename, no behavior change.

3 weeks agoAdd small output buffer inflate benchmark #2062
Nathan Moinvaziri [Tue, 14 Apr 2026 02:00:09 +0000 (19:00 -0700)] 
Add small output buffer inflate benchmark #2062

Benchmarks the inflate fast path with constrained output
buffers ranging from 64 to 16384 bytes per call, reproducing
the libpng decompression pattern described in the "running
off a cliff" analysis.

https://nigeltao.github.io/blog/2021/fastest-safest-png-decoder.html#running-off-a-cliff

3 weeks agoRemove macro and inline inflate benchmark definition directly
Nathan Moinvaziri [Tue, 10 Mar 2026 18:40:39 +0000 (11:40 -0700)] 
Remove macro and inline inflate benchmark definition directly

4 weeks agoFix VPCLMULQDQ CRC32 build with partial AVX-512 baselines
Nathan Moin Vaziri [Fri, 10 Apr 2026 20:29:05 +0000 (13:29 -0700)] 
Fix VPCLMULQDQ CRC32 build with partial AVX-512 baselines

The 512-bit path in crc32_pclmulqdq_tpl.h assumed AVX-512F was
enough, but some of the intrinsics it used actually require
AVX-512DQ. Pick the correct variants based on the available
features.

4 weeks agoAdd fallback defines to skip generic C code when native intrinsics exist
Nathan Moinvaziri [Tue, 10 Mar 2026 06:41:45 +0000 (23:41 -0700)] 
Add fallback defines to skip generic C code when native intrinsics exist

Each arch header now sets *_FALLBACK defines (ADLER32_FALLBACK,
CHUNKSET_FALLBACK, COMPARE256_FALLBACK, CRC32_BRAID_FALLBACK,
SLIDE_HASH_FALLBACK) when no native SIMD implementation exists.
Generic C source files, declarations, functable entries, tests,
and benchmarks are guarded by these defines.

4 weeks agoUse __attribute__((constructor)) to initialize the functable
Vladislav Shchapov [Sun, 22 Mar 2026 14:43:46 +0000 (19:43 +0500)] 
Use __attribute__((constructor)) to initialize the functable

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
4 weeks ago[CI] Switch CMake workflow to use MSYS2 for MinGW32.
Mika Lindqvist [Mon, 13 Apr 2026 17:34:38 +0000 (20:34 +0300)] 
[CI] Switch CMake workflow to use MSYS2 for MinGW32.

4 weeks agoAdd ACCUM_ROUND macro to crc32_chorba_sse2
Nathan Moin Vaziri [Fri, 3 Apr 2026 00:16:27 +0000 (17:16 -0700)] 
Add ACCUM_ROUND macro to crc32_chorba_sse2

4 weeks agoAdd ACCUM_ROUND macro to crc32_chorba_c
Nathan Moin Vaziri [Thu, 2 Apr 2026 04:38:16 +0000 (21:38 -0700)] 
Add ACCUM_ROUND macro to crc32_chorba_c

4 weeks agoAdd NEXT_ROUND macro in crc32_chorba_c
Nathan Moin Vaziri [Thu, 2 Apr 2026 04:33:23 +0000 (21:33 -0700)] 
Add NEXT_ROUND macro in crc32_chorba_c

4 weeks agoFix formatting in crc32_chorba_c
Nathan Moin Vaziri [Thu, 2 Apr 2026 04:35:31 +0000 (21:35 -0700)] 
Fix formatting in crc32_chorba_c

4 weeks agoFix formatting in crc32_chorba_sse41
Nathan Moin Vaziri [Thu, 2 Apr 2026 04:11:21 +0000 (21:11 -0700)] 
Fix formatting in crc32_chorba_sse41

4 weeks agoFix formatting for crc32_chorba_sse2.
Nathan Moin Vaziri [Thu, 2 Apr 2026 04:04:41 +0000 (21:04 -0700)] 
Fix formatting for crc32_chorba_sse2.

This should fix a bunch of CodeQL warnings about commented code.

4 weeks agocrc32: use may_alias for chorba buffers
cl2t [Sat, 14 Mar 2026 06:17:20 +0000 (14:17 +0800)] 
crc32: use may_alias for chorba buffers

4 weeks agocrc32: zero initialize chorba bitbuffer
cl2t [Sat, 14 Mar 2026 03:36:16 +0000 (11:36 +0800)] 
crc32: zero initialize chorba bitbuffer

4 weeks agoExtract fold_block_chorba function for PCLMULQDQ path
Nathan Moinvaziri [Thu, 12 Mar 2026 19:58:31 +0000 (12:58 -0700)] 
Extract fold_block_chorba function for PCLMULQDQ path

4 weeks agoExtract fold_block_16/8 functions for VPCLMULQDQ paths
Nathan Moinvaziri [Thu, 12 Mar 2026 19:36:27 +0000 (12:36 -0700)] 
Extract fold_block_16/8 functions for VPCLMULQDQ paths

4 weeks ago[CI] Add configure MinGW32/MinGW64 workflows.
Mika Lindqvist [Sat, 11 Apr 2026 20:41:49 +0000 (23:41 +0300)] 
[CI] Add configure MinGW32/MinGW64 workflows.

4 weeks agoMove chunk_{128,256}bit_perm_idx_lut.h, chunk_permute_table.h to arch/shared.
Vladislav Shchapov [Mon, 30 Mar 2026 08:03:59 +0000 (13:03 +0500)] 
Move chunk_{128,256}bit_perm_idx_lut.h, chunk_permute_table.h to arch/shared.

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
4 weeks agoFix loongarch64 name in crc32_copy benchmark.
Vladislav Shchapov [Mon, 30 Mar 2026 07:57:32 +0000 (12:57 +0500)] 
Fix loongarch64 name in crc32_copy benchmark.

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
4 weeks agoReuse unrolled ARMv8 CRC32 implementation for LoongArch64.
Vladislav Shchapov [Fri, 27 Mar 2026 21:39:33 +0000 (02:39 +0500)] 
Reuse unrolled ARMv8 CRC32 implementation for LoongArch64.

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
4 weeks agoConvert crc32_armv8_align, crc32_armv8_tail and crc32_copy_impl functions to template.
Vladislav Shchapov [Fri, 27 Mar 2026 21:19:39 +0000 (02:19 +0500)] 
Convert crc32_armv8_align, crc32_armv8_tail and crc32_copy_impl functions to template.

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
4 weeks ago[CI] Build MSVC 2026 C23 with benchmarks.
Mika Lindqvist [Sat, 11 Apr 2026 19:00:54 +0000 (22:00 +0300)] 
[CI] Build MSVC 2026 C23 with benchmarks.

4 weeks agoAdd back zng_clz for big-endian and use macro for compare256
Nathan Moinvaziri [Tue, 17 Mar 2026 06:35:05 +0000 (23:35 -0700)] 
Add back zng_clz for big-endian and use macro for compare256

4 weeks agoMove S390 VX vector typedefs into vx_intrins.h
Nathan Moein Vaziri [Thu, 2 Apr 2026 02:23:27 +0000 (19:23 -0700)] 
Move S390 VX vector typedefs into vx_intrins.h

The `vector` keyword requires -fzvector which is not available on all
GCC versions (e.g. EL10). Use __attribute__((vector_size(16))) typedefs
instead, matching the existing style in crc32_vx.c.

4 weeks agoAdd compatibility header for VX instructions
Nathan Moein Vaziri [Thu, 2 Apr 2026 01:08:26 +0000 (18:08 -0700)] 
Add compatibility header for VX instructions

GCC/Clang don't support vec_sub or vec_subs, but IBM compiler does.

4 weeks agoAdd slide hash optimization for S390 VX
Nathan Moinvaziri [Tue, 17 Mar 2026 07:20:57 +0000 (00:20 -0700)] 
Add slide hash optimization for S390 VX

We can clean up the build system and combine checks for VGFMA since
they are part of base VX instruction set.

4 weeks agoFix building GH1235 test for 32-bit MinGW
Mika T. Lindqvist [Tue, 7 Apr 2026 17:57:08 +0000 (20:57 +0300)] 
Fix building GH1235 test for 32-bit MinGW

```
C:/build/git/zlib-ng/test/gh1235.c: In function 'main':
C:/build/git/zlib-ng/test/gh1235.c:34:43: error: passing argument 2 of 'compress2' from incompatible pointer type [-Wincompatible-pointer-types]
   34 |         if (PREFIX(compress2)(compressed, &bytes, plain, i, 1) != Z_OK) return -1;
      |                                           ^~~~~~
      |                                           |
      |                                           z_size_t * {aka unsigned int *}
In file included from C:/build/git/zlib-ng/zutil.h:15,
                 from C:/build/git/zlib-ng/test/gh1235.c:4:
../zlib.h:1261:69: note: expected 'long unsigned int *' but argument is of type 'z_size_t *' {aka 'unsigned int *'}
 1261 | Z_EXTERN int Z_EXPORT compress2(unsigned char *dest, unsigned long *destLen, const unsigned char *source,
      |                                                      ~~~~~~~~~~~~~~~^~~~~~~
```

6 weeks agoUpdate s390x actions runner docker build scripts
Hans Kristian Rosbach [Mon, 23 Mar 2026 18:35:05 +0000 (19:35 +0100)] 
Update s390x actions runner docker build scripts

7 weeks agoAdd an altivec variant of "count_lengths" in inftrees
Adam Stylinski [Sat, 7 Mar 2026 17:43:02 +0000 (12:43 -0500)] 
Add an altivec variant of "count_lengths" in inftrees

This accounts for a small bump in performance

7 weeks agoUpdate e2k cross compiler to version lcc-1.29.16
Vladislav Shchapov [Fri, 13 Mar 2026 15:55:47 +0000 (20:55 +0500)] 
Update e2k cross compiler to version lcc-1.29.16

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
8 weeks agoRemove check that is always true (even if WANT_MIN_MATCH was reduced from 4 to 3).
Hans Kristian Rosbach [Thu, 12 Mar 2026 19:31:30 +0000 (20:31 +0100)] 
Remove check that is always true (even if WANT_MIN_MATCH was reduced from 4 to 3).

8 weeks agoAvoid calling fizzle_matches unless checks pass
Hans Kristian Rosbach [Thu, 12 Mar 2026 16:00:39 +0000 (17:00 +0100)] 
Avoid calling fizzle_matches unless checks pass

8 weeks ago- Add local variables match_len and strstart in insert_match, to avoid extra lookups...
Hans Kristian Rosbach [Thu, 12 Mar 2026 15:35:50 +0000 (16:35 +0100)] 
- Add local variables match_len and strstart in insert_match, to avoid extra lookups from struct.
- Move check for enough lookahead outside of function, can avoid function call
  instead of calling and immediately returning.

8 weeks ago- Add local variable match_len in emit_match to avoid extra lookups from struct.
Hans Kristian Rosbach [Thu, 12 Mar 2026 14:32:09 +0000 (15:32 +0100)] 
- Add local variable match_len in emit_match to avoid extra lookups from struct.
- Move s->lookahead decrement to top of function, both branches of the function
does it and they don't care when it is done.

2 months agoAdd copy fallback for Adler32 ARM when building with no-unaligned-access
Nathan Moinvaziri [Thu, 12 Mar 2026 03:03:11 +0000 (20:03 -0700)] 
Add copy fallback for Adler32 ARM when building with no-unaligned-access

2 months agoUnroll 64-byte CRC32+copy loop for ARMv8
Nathan Moinvaziri [Fri, 13 Mar 2026 05:03:04 +0000 (22:03 -0700)] 
Unroll 64-byte CRC32+copy loop for ARMv8

Process 64 bytes per iteration using 8x uint64_t loads
with interleaved memcpy stores and __crc32d calls.
RPi5 benchmarks show 30-51% improvement over the
separate crc32 + memcpy baseline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 months agoAdd fallback for ARM CRC32 copy when compiling with no-unaligned-access
Nathan Moinvaziri [Thu, 12 Mar 2026 02:49:53 +0000 (19:49 -0700)] 
Add fallback for ARM CRC32 copy when compiling with no-unaligned-access

2 months agoReplace memcpy with NEON intrinsics for better performance alignment
Nathan Moinvaziri [Fri, 6 Mar 2026 23:48:35 +0000 (15:48 -0800)] 
Replace memcpy with NEON intrinsics for better performance alignment

2 months agoImplement interleaved copying for CRC32 ARMv8 PMULL+EOR3.
Nathan Moinvaziri [Tue, 24 Feb 2026 17:14:53 +0000 (09:14 -0800)] 
Implement interleaved copying for CRC32 ARMv8 PMULL+EOR3.

2 months agoImplement interleaved copying for CRC32 ARMv8.
Nathan Moinvaziri [Fri, 6 Mar 2026 03:01:45 +0000 (19:01 -0800)] 
Implement interleaved copying for CRC32 ARMv8.

2 months agoAdd shared align/tail helpers for CRC32 ARMv8.
Nathan Moinvaziri [Fri, 6 Mar 2026 03:00:54 +0000 (19:00 -0800)] 
Add shared align/tail helpers for CRC32 ARMv8.

2 months agoUse OSB workflow as an initial test before queueing all the other tests,
Hans Kristian Rosbach [Thu, 12 Mar 2026 19:57:21 +0000 (20:57 +0100)] 
Use OSB workflow as an initial test before queueing all the other tests,
this makes sure we don't spend a lot of CI time testing something that
won't even build.

2 months agoSeparate match finding logic in deflate_medium
Nathan Moinvaziri [Tue, 10 Mar 2026 02:39:52 +0000 (19:39 -0700)] 
Separate match finding logic in deflate_medium

2 months ago[CodeQL] Add Windows.
Mika Lindqvist [Wed, 11 Mar 2026 18:28:51 +0000 (20:28 +0200)] 
[CodeQL] Add Windows.

2 months agoRemove ASAN from s390x qemu build, it fails for unknown reasons.
Hans Kristian Rosbach [Wed, 11 Mar 2026 15:28:09 +0000 (16:28 +0100)] 
Remove ASAN from s390x qemu build, it fails for unknown reasons.

2 months agoGuard against ls-remote failing
pmqs [Tue, 10 Mar 2026 12:24:32 +0000 (12:24 +0000)] 
Guard against ls-remote failing

2 months agoCache LLVM C++ libraries for MSAN
Paul Marquess [Sun, 15 Feb 2026 16:18:59 +0000 (16:18 +0000)] 
Cache LLVM C++ libraries for MSAN

2 months agoExpand codeql testing to run on multiple platforms and two configs.
Hans Kristian Rosbach [Mon, 9 Mar 2026 13:09:14 +0000 (14:09 +0100)] 
Expand codeql testing to run on multiple platforms and two configs.

2 months ago[CI] Fix lint when using workflow_dispatch.
Mika Lindqvist [Tue, 10 Mar 2026 07:18:23 +0000 (09:18 +0200)] 
[CI] Fix lint when using workflow_dispatch.

2 months agoAdd ARM64EC builds to GitHub Actions
Cameron Cawley [Tue, 10 Mar 2026 20:59:18 +0000 (20:59 +0000)] 
Add ARM64EC builds to GitHub Actions

2 months agoFix CPU detection for ARM64EC
Cameron Cawley [Tue, 10 Mar 2026 20:57:50 +0000 (20:57 +0000)] 
Fix CPU detection for ARM64EC

2 months agoReplace macros with inline functions in deflate_quick.
Nathan Moinvaziri [Tue, 10 Mar 2026 01:03:26 +0000 (18:03 -0700)] 
Replace macros with inline functions in deflate_quick.

On -O2, Clang produces identical output, GCC produces 2 fewer instructions.

2 months agoClean up dead assignments in insert_match
Nathan Moinvaziri [Tue, 10 Mar 2026 03:15:34 +0000 (20:15 -0700)] 
Clean up dead assignments in insert_match

When 56d3d985 was reverted in b85cfdf9, it restored dead
stores to match.strstart and match.match_length that
have no effect since match is passed by value. The
compiler already eliminated them; remove from source.

2 months ago[CI] Fix 32-bit ARM release.
Mika Lindqvist [Tue, 10 Mar 2026 07:33:04 +0000 (09:33 +0200)] 
[CI] Fix 32-bit ARM release.

2 months agoAdd parameterized deflate tests
Nathan Moinvaziri [Tue, 10 Mar 2026 03:53:22 +0000 (20:53 -0700)] 
Add parameterized deflate tests

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
2 months agoUse uintptr_t for ASan function signatures and macro variables
Nathan Moinvaziri [Tue, 10 Mar 2026 03:20:40 +0000 (20:20 -0700)] 
Use uintptr_t for ASan function signatures and macro variables

The ASan runtime ABI expects uptr (pointer-sized unsigned) for both
parameters of __asan_loadN/__asan_storeN. On LLP64 targets like
Windows x64, long is 32-bit while pointers are 64-bit, truncating
size values. Use uintptr_t to match the ABI correctly.