From d5dbbfb31d2bf3c7beedc635d1789ad06ee87664 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:03:44 +0100 Subject: [PATCH] Updated internal zlib-ng to 2.2.2 --- CMakeLists.txt | 2 +- RELEASE_NOTES.md | 2 +- .../zlib-ng-2.0.7/CMakeLists.txt | 1428 --- internal-complibs/zlib-ng-2.0.7/README.md | 220 - .../zlib-ng-2.0.7/arch/.gitignore | 2 - .../zlib-ng-2.0.7/arch/arm/adler32_neon.c | 126 - .../zlib-ng-2.0.7/arch/arm/arm.h | 13 - .../zlib-ng-2.0.7/arch/arm/crc32_acle.c | 96 - .../zlib-ng-2.0.7/arch/arm/ctzl.h | 12 - .../arch/arm/insert_string_acle.c | 22 - .../zlib-ng-2.0.7/arch/arm/slide_neon.c | 52 - .../zlib-ng-2.0.7/arch/generic/Makefile.in | 21 - .../zlib-ng-2.0.7/arch/power/Makefile.in | 50 - .../zlib-ng-2.0.7/arch/power/power.c | 19 - .../zlib-ng-2.0.7/arch/power/power.h | 13 - .../arch/power/slide_hash_power8.c | 60 - .../zlib-ng-2.0.7/arch/s390/dfltcc_common.c | 89 - .../zlib-ng-2.0.7/arch/s390/dfltcc_common.h | 53 - .../zlib-ng-2.0.7/arch/s390/dfltcc_deflate.h | 55 - .../zlib-ng-2.0.7/arch/s390/dfltcc_detail.h | 229 - .../zlib-ng-2.0.7/arch/s390/dfltcc_inflate.h | 49 - .../actions-runner.Dockerfile | 42 - .../actions-runner.service | 23 - .../qemu-user-static.service | 11 - .../zlib-ng-2.0.7/arch/x86/INDEX.md | 8 - .../zlib-ng-2.0.7/arch/x86/Makefile.in | 108 - .../zlib-ng-2.0.7/arch/x86/adler32_avx.c | 117 - .../zlib-ng-2.0.7/arch/x86/adler32_ssse3.c | 118 - .../zlib-ng-2.0.7/arch/x86/chunkset_avx.c | 53 - .../zlib-ng-2.0.7/arch/x86/compare258_sse.c | 74 - .../zlib-ng-2.0.7/arch/x86/crc_folding.h | 19 - .../arch/x86/insert_string_sse.c | 46 - .../zlib-ng-2.0.7/arch/x86/slide_avx.c | 47 - .../zlib-ng-2.0.7/arch/x86/slide_sse.c | 46 - .../zlib-ng-2.0.7/arch/x86/x86.c | 80 - .../zlib-ng-2.0.7/arch/x86/x86.h | 18 - .../cmake/detect-install-dirs.cmake | 55 - .../zlib-ng-2.0.7/cmake/test-tools.cmake | 34 - internal-complibs/zlib-ng-2.0.7/compare258.c | 186 - internal-complibs/zlib-ng-2.0.7/crc32.c | 202 - internal-complibs/zlib-ng-2.0.7/crc32_comb.c | 111 - .../zlib-ng-2.0.7/crc32_comb_tbl._h | 300 - .../zlib-ng-2.0.7/crc32_comb_tbl.h | 300 - internal-complibs/zlib-ng-2.0.7/crc32_p.h | 19 - internal-complibs/zlib-ng-2.0.7/crc32_tbl._h | 444 - internal-complibs/zlib-ng-2.0.7/crc32_tbl.h | 444 - internal-complibs/zlib-ng-2.0.7/deflate_p.h | 79 - .../zlib-ng-2.0.7/fallback_builtins.h | 48 - internal-complibs/zlib-ng-2.0.7/functable.c | 466 - internal-complibs/zlib-ng-2.0.7/functable.h | 29 - internal-complibs/zlib-ng-2.0.7/inffast.h | 18 - .../zlib-ng-2.0.7/inffixed_tbl._h | 94 - internal-complibs/zlib-ng-2.0.7/inflate_p.h | 101 - .../zlib-ng-2.0.7/insert_string.c | 25 - .../zlib-ng-2.0.7/insert_string_tpl.h | 89 - internal-complibs/zlib-ng-2.0.7/match_tpl.h | 180 - .../zlib-ng-2.0.7/test/.gitignore | 5 - .../zlib-ng-2.0.7/test/Makefile.in | 123 - .../abi/zlib-v1.2.11-arm-linux-gnueabihf.abi | 119 - .../abi/zlib-v1.2.11-x86_64-linux-gnu.abi | 1037 -- .../zlib-ng-2.0.7/test/crc32_test.c | 199 - .../zlib-ng-2.0.7/test/hash_head_0.c | 110 - .../zlib-ng-2.0.7/test/testCVEinputs.sh | 30 - .../zlib-ng-2.0.7/tools/codecov-upload.sh | 9 - .../zlib-ng-2.0.7/tools/makecrct.c | 177 - internal-complibs/zlib-ng-2.0.7/trees_tbl._h | 132 - .../zlib-ng-2.0.7/win32/DLL_FAQ.txt | 397 - .../zlib-ng-2.0.7/win32/Makefile.a64 | 208 - .../zlib-ng-2.0.7/win32/Makefile.arm | 220 - .../zlib-ng-2.0.7/win32/Makefile.msc | 215 - .../zlib-ng-2.0.7/win32/README-WIN32.txt | 103 - .../zlib-ng-2.0.7/win32/zlib-ng.def | 60 - .../zlib-ng-2.0.7/win32/zlib.def | 61 - .../zlib-ng-2.0.7/win32/zlibcompat.def | 94 - internal-complibs/zlib-ng-2.0.7/zbuild.h | 47 - internal-complibs/zlib-ng-2.0.7/zconf.h | 201 - .../zlib-ng-2.0.7/zconf.h.included | 201 - internal-complibs/zlib-ng-2.0.7/zutil.h | 274 - internal-complibs/zlib-ng-2.0.7/zutil_p.h | 46 - internal-complibs/zlib-ng-2.2.2/.codecov.yaml | 27 + .../.shellcheckrc | 0 .../zlib-ng-2.2.2/CMakeLists.txt | 1424 +++ .../{zlib-ng-2.0.7 => zlib-ng-2.2.2}/FAQ.zlib | 3 +- .../{zlib-ng-2.0.7 => zlib-ng-2.2.2}/INDEX.md | 0 .../LICENSE.md | 2 +- .../Makefile.in | 193 +- .../PORTING.md | 39 +- internal-complibs/zlib-ng-2.2.2/README.md | 229 + .../adler32.c | 78 +- .../adler32_p.h | 35 +- .../arch/arm/Makefile.in | 40 +- .../zlib-ng-2.2.2/arch/arm/acle_intrins.h | 35 + .../zlib-ng-2.2.2/arch/arm/adler32_neon.c | 215 + .../arch/arm/arm_features.c} | 55 +- .../zlib-ng-2.2.2/arch/arm/arm_features.h | 16 + .../zlib-ng-2.2.2/arch/arm/arm_functions.h | 65 + .../zlib-ng-2.2.2/arch/arm/chunkset_neon.c | 101 + .../zlib-ng-2.2.2/arch/arm/compare256_neon.c | 60 + .../zlib-ng-2.2.2/arch/arm/crc32_acle.c | 78 + .../zlib-ng-2.2.2/arch/arm/neon_intrins.h | 65 + .../zlib-ng-2.2.2/arch/arm/slide_hash_armv6.c | 48 + .../zlib-ng-2.2.2/arch/arm/slide_hash_neon.c | 47 + .../zlib-ng-2.2.2/arch/generic/Makefile.in | 75 + .../zlib-ng-2.2.2/arch/generic/adler32_c.c | 54 + .../arch/generic/adler32_fold_c.c | 15 + .../arch/generic/chunk_permute_table.h | 53 + .../arch/generic/chunkset_c.c} | 13 +- .../zlib-ng-2.2.2/arch/generic/compare256_c.c | 181 + .../arch/generic/crc32_braid_c.c | 216 + .../zlib-ng-2.2.2/arch/generic/crc32_fold_c.c | 31 + .../arch/generic/generic_functions.h | 106 + .../zlib-ng-2.2.2/arch/generic/slide_hash_c.c | 52 + .../zlib-ng-2.2.2/arch/power/Makefile.in | 93 + .../arch/power/adler32_power8.c | 11 +- .../zlib-ng-2.2.2/arch/power/adler32_vmx.c | 186 + .../arch/power/chunkset_power8.c} | 42 +- .../arch/power/compare256_power9.c | 66 + .../arch/power/crc32_constants.h | 1123 ++ .../zlib-ng-2.2.2/arch/power/crc32_power8.c | 589 + .../arch/power/fallback_builtins.h | 31 + .../zlib-ng-2.2.2/arch/power/power_features.c | 49 + .../zlib-ng-2.2.2/arch/power/power_features.h | 18 + .../arch/power/power_functions.h | 67 + .../arch/power/slide_hash_power8.c | 12 + .../zlib-ng-2.2.2/arch/power/slide_hash_vmx.c | 10 + .../zlib-ng-2.2.2/arch/power/slide_ppc_tpl.h | 32 + .../zlib-ng-2.2.2/arch/riscv/README.md | 45 + .../zlib-ng-2.2.2/arch/riscv/adler32_rvv.c | 132 + .../zlib-ng-2.2.2/arch/riscv/chunkset_rvv.c | 121 + .../zlib-ng-2.2.2/arch/riscv/compare256_rvv.c | 49 + .../zlib-ng-2.2.2/arch/riscv/riscv_features.c | 71 + .../zlib-ng-2.2.2/arch/riscv/riscv_features.h | 18 + .../arch/riscv/riscv_functions.h | 49 + .../zlib-ng-2.2.2/arch/riscv/slide_hash_rvv.c | 33 + .../arch/s390/Makefile.in | 18 +- .../arch/s390/README.md | 86 +- .../zlib-ng-2.2.2/arch/s390/crc32-vx.c | 222 + .../zlib-ng-2.2.2/arch/s390/dfltcc_common.h | 119 + .../arch/s390/dfltcc_deflate.c | 113 +- .../zlib-ng-2.2.2/arch/s390/dfltcc_deflate.h | 58 + .../zlib-ng-2.2.2/arch/s390/dfltcc_detail.h | 275 + .../arch/s390/dfltcc_inflate.c | 100 +- .../zlib-ng-2.2.2/arch/s390/dfltcc_inflate.h | 67 + .../zlib-ng-2.2.2/arch/s390/s390_features.c | 14 + .../zlib-ng-2.2.2/arch/s390/s390_features.h | 14 + .../zlib-ng-2.2.2/arch/s390/s390_functions.h | 20 + .../actions-runner.Dockerfile | 47 + .../actions-runner.service | 18 + .../fs/usr/bin/actions-runner | 0 .../self-hosted-builder/fs/usr/bin/entrypoint | 0 .../self-hosted-builder/runner-global.json | 5 + .../self-hosted-builder/runner-s390x.patch | 243 + .../zlib-ng-2.2.2/arch/x86/Makefile.in | 140 + .../zlib-ng-2.2.2/arch/x86/adler32_avx2.c | 145 + .../zlib-ng-2.2.2/arch/x86/adler32_avx2_p.h | 32 + .../zlib-ng-2.2.2/arch/x86/adler32_avx512.c | 108 + .../zlib-ng-2.2.2/arch/x86/adler32_avx512_p.h | 57 + .../arch/x86/adler32_avx512_vnni.c | 210 + .../zlib-ng-2.2.2/arch/x86/adler32_sse42.c | 120 + .../zlib-ng-2.2.2/arch/x86/adler32_ssse3.c | 156 + .../zlib-ng-2.2.2/arch/x86/adler32_ssse3_p.h | 29 + .../zlib-ng-2.2.2/arch/x86/chunkset_avx2.c | 133 + .../arch/x86/chunkset_sse2.c} | 8 +- .../zlib-ng-2.2.2/arch/x86/chunkset_ssse3.c | 93 + .../arch/x86/compare256_avx2.c} | 31 +- .../zlib-ng-2.2.2/arch/x86/compare256_sse2.c | 97 + .../arch/x86/crc32_fold_pclmulqdq_tpl.h | 199 + .../arch/x86/crc32_fold_vpclmulqdq_tpl.h | 107 + .../zlib-ng-2.2.2/arch/x86/crc32_pclmulqdq.c | 30 + .../arch/x86/crc32_pclmulqdq_tpl.h} | 250 +- .../zlib-ng-2.2.2/arch/x86/crc32_vpclmulqdq.c | 17 + .../zlib-ng-2.2.2/arch/x86/slide_hash_avx2.c | 40 + .../zlib-ng-2.2.2/arch/x86/slide_hash_sse2.c | 63 + .../zlib-ng-2.2.2/arch/x86/x86_features.c | 115 + .../zlib-ng-2.2.2/arch/x86/x86_features.h | 28 + .../zlib-ng-2.2.2/arch/x86/x86_functions.h | 172 + .../zlib-ng-2.2.2/arch/x86/x86_intrins.h | 92 + .../zlib-ng-2.2.2/arch_functions.h | 29 + .../chunkset_tpl.h | 175 +- .../cmake/detect-arch.c | 10 +- .../cmake/detect-arch.cmake | 12 +- .../cmake/detect-coverage.cmake | 20 +- .../cmake/detect-install-dirs.cmake | 43 + .../cmake/detect-intrinsics.cmake | 604 ++ .../cmake/detect-sanitizer.cmake | 49 +- .../zlib-ng-2.2.2/cmake/fallback-macros.cmake | 19 + .../cmake/toolchain-aarch64.cmake | 0 .../cmake/toolchain-arm.cmake | 0 .../cmake/toolchain-armhf.cmake | 0 .../cmake/toolchain-llvm-mingw-aarch64.cmake | 41 + .../cmake/toolchain-llvm-mingw-armv7.cmake | 41 + .../cmake/toolchain-llvm-mingw-i686.cmake | 41 + .../cmake/toolchain-llvm-mingw-x86_64.cmake | 41 + .../cmake/toolchain-mingw-i686.cmake | 0 .../cmake/toolchain-mingw-x86_64.cmake | 0 .../zlib-ng-2.2.2/cmake/toolchain-mips.cmake | 29 + .../cmake/toolchain-mips64.cmake | 29 + .../cmake/toolchain-powerpc.cmake | 0 .../cmake/toolchain-powerpc64-clang.cmake | 16 + .../cmake/toolchain-powerpc64-power9.cmake | 25 + .../cmake/toolchain-powerpc64.cmake | 0 .../cmake/toolchain-powerpc64le-clang.cmake | 16 + .../cmake/toolchain-powerpc64le-power9.cmake | 25 + .../cmake/toolchain-powerpc64le.cmake | 0 .../zlib-ng-2.2.2/cmake/toolchain-riscv.cmake | 28 + .../cmake/toolchain-s390x.cmake | 0 .../cmake/toolchain-sparc64.cmake | 0 .../zlib-ng-2.2.2/compare256_rle.h | 134 + .../compress.c | 17 +- .../configure | 1618 +-- .../zlib-ng-2.2.2/cpu_features.c | 23 + .../zlib-ng-2.2.2/cpu_features.h | 43 + internal-complibs/zlib-ng-2.2.2/crc32.c | 42 + internal-complibs/zlib-ng-2.2.2/crc32.h | 16 + .../zlib-ng-2.2.2/crc32_braid_comb.c | 56 + .../zlib-ng-2.2.2/crc32_braid_comb_p.h | 42 + .../zlib-ng-2.2.2/crc32_braid_p.h | 64 + .../zlib-ng-2.2.2/crc32_braid_tbl.h | 9446 +++++++++++++++++ .../deflate.c | 871 +- .../deflate.h | 120 +- .../deflate_fast.c | 39 +- .../zlib-ng-2.2.2/deflate_huff.c | 45 + .../deflate_medium.c | 91 +- internal-complibs/zlib-ng-2.2.2/deflate_p.h | 128 + .../deflate_quick.c | 45 +- internal-complibs/zlib-ng-2.2.2/deflate_rle.c | 86 + .../deflate_slow.c | 47 +- .../zlib-ng-2.2.2/deflate_stored.c | 186 + .../doc/algorithm.txt | 0 .../zlib-ng-2.2.2/doc/crc-doc.1.0.pdf | Bin 0 -> 776142 bytes .../zlib-ng-2.2.2/doc/crc-pclmulqdq.pdf | Bin 0 -> 384202 bytes .../doc/rfc1950.txt | 0 .../doc/rfc1951.txt | 0 .../doc/rfc1952.txt | 0 .../doc/txtvsbin.txt | 0 .../zlib-ng-2.2.2/fallback_builtins.h | 47 + internal-complibs/zlib-ng-2.2.2/functable.c | 355 + internal-complibs/zlib-ng-2.2.2/functable.h | 55 + .../{zlib-ng-2.0.7 => zlib-ng-2.2.2}/gzguts.h | 13 +- .../{zlib-ng-2.0.7 => zlib-ng-2.2.2}/gzlib.c | 12 +- .../gzread.c => zlib-ng-2.2.2/gzread.c.in} | 14 +- .../gzwrite.c | 4 +- .../infback.c | 68 +- .../inffast.c => zlib-ng-2.2.2/inffast_tpl.h} | 80 +- .../inffixed_tbl.h | 0 .../inflate.c | 459 +- .../inflate.h | 43 +- internal-complibs/zlib-ng-2.2.2/inflate_p.h | 231 + .../inftrees.c | 36 +- .../inftrees.h | 12 +- .../zlib-ng-2.2.2/insert_string.c | 21 + .../zlib-ng-2.2.2/insert_string_roll.c | 24 + .../zlib-ng-2.2.2/insert_string_tpl.h | 113 + internal-complibs/zlib-ng-2.2.2/match_tpl.h | 284 + .../zlib-ng-2.2.2/test/CMakeLists.txt | 265 + .../test/CVE-2002-0059/test.gz | Bin .../test/CVE-2004-0797/test.gz | Bin .../test/CVE-2005-1849/test.gz | Bin .../test/CVE-2005-2096/test.gz | Bin .../test/CVE-2018-25032/default.txt | 0 .../test/CVE-2018-25032/fixed.txt | 0 .../zlib-ng-2.2.2/test/GH-1600/packobj.gz | Bin 0 -> 46 bytes .../test/GH-361/test.txt | 0 .../test/GH-364/test.bin | Bin .../test/GH-382/defneg3.dat | 0 .../test/GH-751/test.txt | 0 .../test/GH-979/pigz-2.6.tar.gz | Bin .../zlib-ng-2.2.2/test/Makefile.in | 82 + .../test/README.md | 4 +- .../test/abi/ignore | 2 +- ...c2a18c1281fc-aarch64-unknown-linux-gnu.abi | 1286 +++ ...c2a18c1281fc-arm-unknown-linux-gnueabi.abi | 1276 +++ ...a18c1281fc-arm-unknown-linux-gnueabihf.abi | 1276 +++ ...806c2a18c1281fc-mips-unknown-linux-gnu.abi | 1032 ++ ...8c1281fc-mips64-unknown-linux-gnuabi64.abi | 1030 ++ ...c2a18c1281fc-powerpc-unknown-linux-gnu.abi | 1286 +++ ...a18c1281fc-powerpc64-unknown-linux-gnu.abi | 1268 +++ ...8c1281fc-powerpc64le-unknown-linux-gnu.abi | 1268 +++ ...06c2a18c1281fc-x86_64-pc-linux-gnu-m32.abi | 1263 +++ ...e93806c2a18c1281fc-x86_64-pc-linux-gnu.abi | 1281 +++ ...4baf80882311-aarch64-unknown-linux-gnu.abi | 1904 ++++ ...4baf80882311-arm-unknown-linux-gnueabi.abi | 1889 ++++ ...af80882311-arm-unknown-linux-gnueabihf.abi | 1881 ++++ ...55e4baf80882311-mips-unknown-linux-gnu.abi | 1241 +++ ...80882311-mips64-unknown-linux-gnuabi64.abi | 1250 +++ ...4baf80882311-powerpc-unknown-linux-gnu.abi | 1895 ++++ ...af80882311-powerpc64-unknown-linux-gnu.abi | 1894 ++++ ...80882311-powerpc64le-unknown-linux-gnu.abi | 1886 ++++ ...5e4baf80882311-x86_64-pc-linux-gnu-m32.abi | 2032 ++++ ...3c155e4baf80882311-x86_64-pc-linux-gnu.abi | 2064 ++++ .../test/abicheck.md | 2 +- .../test/abicheck.sh | 9 +- .../add-subdirectory-project/CMakeLists.txt | 13 + .../test/add-subdirectory-project/main.c | 7 + .../test/benchmarks/CMakeLists.txt | 109 + .../zlib-ng-2.2.2/test/benchmarks/README.md | 47 + .../test/benchmarks/benchmark_adler32.cc | 100 + .../test/benchmarks/benchmark_adler32_copy.cc | 130 + .../test/benchmarks/benchmark_compare256.cc | 94 + .../benchmarks/benchmark_compare256_rle.cc | 72 + .../test/benchmarks/benchmark_compress.cc | 67 + .../test/benchmarks/benchmark_crc32.cc | 83 + .../test/benchmarks/benchmark_main.cc | 32 + .../test/benchmarks/benchmark_png_decode.cc | 126 + .../test/benchmarks/benchmark_png_encode.cc | 54 + .../test/benchmarks/benchmark_png_shared.h | 146 + .../test/benchmarks/benchmark_slidehash.cc | 98 + .../test/cmake/compress-and-verify.cmake} | 103 +- .../test}/cmake/run-and-compare.cmake | 0 .../test}/cmake/run-and-redirect.cmake | 0 .../zlib-ng-2.2.2/test/cmake/test-cves.cmake | 33 + .../zlib-ng-2.2.2/test/cmake/test-data.cmake | 68 + .../test/cmake/test-issues.cmake | 84 + .../zlib-ng-2.2.2/test/cmake/test-tools.cmake | 80 + .../test/data/fireworks.jpg | Bin .../test/data/lcet10.txt | 0 .../test/data/paper-100k.pdf | Bin .../test/example.c | 90 +- .../zlib-ng-2.2.2/test/fuzz/CMakeLists.txt | 49 + .../test/fuzz/fuzzer_checksum.c} | 11 +- .../test/fuzz/fuzzer_compress.c} | 5 - .../test/fuzz/fuzzer_example_dict.c} | 5 - .../test/fuzz/fuzzer_example_flush.c} | 5 - .../test/fuzz/fuzzer_example_large.c} | 4 - .../test/fuzz/fuzzer_example_small.c} | 5 - .../test/fuzz/fuzzer_minigzip.c} | 98 +- .../test/fuzz/standalone_fuzz_target_runner.c | 1 - .../test/gh1235.c | 6 +- .../test/infcover.c | 20 +- .../test/minideflate.c | 74 +- .../test/minigzip.c | 114 +- .../test/pigz/CMakeLists.txt | 5 +- .../test/pkgcheck.sh | 17 +- .../test/switchlevels.c | 6 +- .../test/test_adler32.cc} | 362 +- .../zlib-ng-2.2.2/test/test_compare256.cc | 93 + .../zlib-ng-2.2.2/test/test_compare256_rle.cc | 63 + .../zlib-ng-2.2.2/test/test_compress.cc | 33 + .../zlib-ng-2.2.2/test/test_compress_bound.cc | 59 + .../zlib-ng-2.2.2/test/test_compress_dual.cc | 28 + .../zlib-ng-2.2.2/test/test_cpu_features.h | 12 + .../zlib-ng-2.2.2/test/test_crc32.cc | 231 + .../test/test_cve-2003-0107.cc} | 22 +- .../zlib-ng-2.2.2/test/test_deflate_bound.cc | 99 + .../test/test_deflate_concurrency.cc | 170 + .../zlib-ng-2.2.2/test/test_deflate_copy.cc | 60 + .../zlib-ng-2.2.2/test/test_deflate_dict.cc | 54 + .../test/test_deflate_hash_head_0.cc | 83 + .../zlib-ng-2.2.2/test/test_deflate_header.cc | 71 + .../zlib-ng-2.2.2/test/test_deflate_params.cc | 143 + .../test/test_deflate_pending.cc | 66 + .../zlib-ng-2.2.2/test/test_deflate_prime.cc | 91 + .../test/test_deflate_quick_bi_valid.cc} | 37 +- .../test/test_deflate_quick_block_open.cc} | 58 +- .../zlib-ng-2.2.2/test/test_deflate_tune.cc | 56 + .../zlib-ng-2.2.2/test/test_dict.cc | 98 + .../zlib-ng-2.2.2/test/test_gzio.cc | 106 + .../test/test_inflate_adler32.cc} | 41 +- .../zlib-ng-2.2.2/test/test_inflate_copy.cc | 31 + .../zlib-ng-2.2.2/test/test_inflate_sync.cc | 75 + .../zlib-ng-2.2.2/test/test_large_buffers.cc | 87 + .../zlib-ng-2.2.2/test/test_main.cc | 22 + .../zlib-ng-2.2.2/test/test_raw.cc | 58 + .../zlib-ng-2.2.2/test/test_shared.h | 18 + .../zlib-ng-2.2.2/test/test_shared_ng.h | 23 + .../zlib-ng-2.2.2/test/test_small_buffers.cc | 69 + .../zlib-ng-2.2.2/test/test_small_window.cc | 67 + .../zlib-ng-2.2.2/test/test_version.cc | 27 + .../tools/config.sub | 0 .../zlib-ng-2.2.2/tools/makecrct.c | 244 + .../tools/makefixed.c | 0 .../tools/maketrees.c | 14 +- .../{zlib-ng-2.0.7 => zlib-ng-2.2.2}/trees.c | 84 +- .../{zlib-ng-2.0.7 => zlib-ng-2.2.2}/trees.h | 0 .../trees_emit.h | 5 +- .../trees_tbl.h | 2 +- .../uncompr.c | 13 +- .../zlib-ng-2.2.2/win32/Makefile.a64 | 252 + .../zlib-ng-2.2.2/win32/Makefile.arm | 272 + .../zlib-ng-2.2.2/win32/Makefile.msc | 292 + .../zlib-ng-2.2.2/win32/depcheck.cpp | 321 + .../zlib-ng-2.2.2/win32/replace.vbs | 15 + .../zlib-ng-2.2.2/win32/zlib-ng.def.in | 60 + .../win32/zlib-ng1.rc | 4 +- .../zlib-ng-2.2.2/win32/zlib.def.in | 64 + .../win32/zlib1.rc | 4 +- .../zlib-ng-2.2.2/win32/zlibcompat.def.in | 97 + internal-complibs/zlib-ng-2.2.2/zbuild.h | 327 + .../zconf-ng.h.in | 18 +- .../zconf.h.in | 23 +- .../zendian.h | 4 +- .../zlib-ng-2.2.2/zlib-config.cmake.in | 12 + .../zlib-ng-2.2.2/zlib-ng-config.cmake.in | 10 + .../zlib-ng.h => zlib-ng-2.2.2/zlib-ng.h.in} | 157 +- .../zlib-ng.map | 27 +- .../zlib.h => zlib-ng-2.2.2/zlib.h.in} | 128 +- .../{zlib-ng-2.0.7 => zlib-ng-2.2.2}/zlib.map | 3 +- .../zlib.pc.cmakein | 3 +- .../zlib.pc.in | 3 +- .../zlib-ng-2.2.2/zlib_name_mangling-ng.h.in | 178 + .../zlib-ng-2.2.2/zlib_name_mangling.h.empty | 8 + .../zlib-ng-2.2.2/zlib_name_mangling.h.in | 170 + .../{zlib-ng-2.0.7 => zlib-ng-2.2.2}/zutil.c | 14 +- internal-complibs/zlib-ng-2.2.2/zutil.h | 140 + internal-complibs/zlib-ng-2.2.2/zutil_p.h | 75 + 405 files changed, 61799 insertions(+), 13911 deletions(-) delete mode 100644 internal-complibs/zlib-ng-2.0.7/CMakeLists.txt delete mode 100644 internal-complibs/zlib-ng-2.0.7/README.md delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/.gitignore delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/arm/adler32_neon.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/arm/arm.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/arm/crc32_acle.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/arm/ctzl.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/arm/insert_string_acle.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/arm/slide_neon.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/generic/Makefile.in delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/power/Makefile.in delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/power/power.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/power/power.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/power/slide_hash_power8.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_common.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_common.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_deflate.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_detail.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_inflate.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/actions-runner.Dockerfile delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/actions-runner.service delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/qemu-user-static.service delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/INDEX.md delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/Makefile.in delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/adler32_avx.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/adler32_ssse3.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/chunkset_avx.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/compare258_sse.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/crc_folding.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/insert_string_sse.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/slide_avx.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/slide_sse.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/x86.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/arch/x86/x86.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/cmake/detect-install-dirs.cmake delete mode 100644 internal-complibs/zlib-ng-2.0.7/cmake/test-tools.cmake delete mode 100644 internal-complibs/zlib-ng-2.0.7/compare258.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/crc32.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/crc32_comb.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/crc32_comb_tbl._h delete mode 100644 internal-complibs/zlib-ng-2.0.7/crc32_comb_tbl.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/crc32_p.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/crc32_tbl._h delete mode 100644 internal-complibs/zlib-ng-2.0.7/crc32_tbl.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/deflate_p.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/fallback_builtins.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/functable.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/functable.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/inffast.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/inffixed_tbl._h delete mode 100644 internal-complibs/zlib-ng-2.0.7/inflate_p.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/insert_string.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/insert_string_tpl.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/match_tpl.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/test/.gitignore delete mode 100644 internal-complibs/zlib-ng-2.0.7/test/Makefile.in delete mode 100644 internal-complibs/zlib-ng-2.0.7/test/abi/zlib-v1.2.11-arm-linux-gnueabihf.abi delete mode 100644 internal-complibs/zlib-ng-2.0.7/test/abi/zlib-v1.2.11-x86_64-linux-gnu.abi delete mode 100644 internal-complibs/zlib-ng-2.0.7/test/crc32_test.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/test/hash_head_0.c delete mode 100755 internal-complibs/zlib-ng-2.0.7/test/testCVEinputs.sh delete mode 100644 internal-complibs/zlib-ng-2.0.7/tools/codecov-upload.sh delete mode 100644 internal-complibs/zlib-ng-2.0.7/tools/makecrct.c delete mode 100644 internal-complibs/zlib-ng-2.0.7/trees_tbl._h delete mode 100644 internal-complibs/zlib-ng-2.0.7/win32/DLL_FAQ.txt delete mode 100644 internal-complibs/zlib-ng-2.0.7/win32/Makefile.a64 delete mode 100644 internal-complibs/zlib-ng-2.0.7/win32/Makefile.arm delete mode 100644 internal-complibs/zlib-ng-2.0.7/win32/Makefile.msc delete mode 100644 internal-complibs/zlib-ng-2.0.7/win32/README-WIN32.txt delete mode 100644 internal-complibs/zlib-ng-2.0.7/win32/zlib-ng.def delete mode 100644 internal-complibs/zlib-ng-2.0.7/win32/zlib.def delete mode 100644 internal-complibs/zlib-ng-2.0.7/win32/zlibcompat.def delete mode 100644 internal-complibs/zlib-ng-2.0.7/zbuild.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/zconf.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/zconf.h.included delete mode 100644 internal-complibs/zlib-ng-2.0.7/zutil.h delete mode 100644 internal-complibs/zlib-ng-2.0.7/zutil_p.h create mode 100644 internal-complibs/zlib-ng-2.2.2/.codecov.yaml rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/.shellcheckrc (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/CMakeLists.txt rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/FAQ.zlib (99%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/INDEX.md (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/LICENSE.md (94%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/Makefile.in (61%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/PORTING.md (64%) create mode 100644 internal-complibs/zlib-ng-2.2.2/README.md rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/adler32.c (52%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/adler32_p.h (61%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/arch/arm/Makefile.in (58%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/arm/acle_intrins.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/arm/adler32_neon.c rename internal-complibs/{zlib-ng-2.0.7/arch/arm/armfeature.c => zlib-ng-2.2.2/arch/arm/arm_features.c} (52%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/arm/arm_features.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/arm/arm_functions.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/arm/chunkset_neon.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/arm/compare256_neon.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/arm/crc32_acle.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/arm/neon_intrins.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/arm/slide_hash_armv6.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/arm/slide_hash_neon.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/generic/Makefile.in create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/generic/adler32_c.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/generic/adler32_fold_c.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/generic/chunk_permute_table.h rename internal-complibs/{zlib-ng-2.0.7/chunkset.c => zlib-ng-2.2.2/arch/generic/chunkset_c.c} (78%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/generic/compare256_c.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/generic/crc32_braid_c.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/generic/crc32_fold_c.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/generic/generic_functions.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/generic/slide_hash_c.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/Makefile.in rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/arch/power/adler32_power8.c (94%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/adler32_vmx.c rename internal-complibs/{zlib-ng-2.0.7/arch/arm/chunkset_neon.c => zlib-ng-2.2.2/arch/power/chunkset_power8.c} (50%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/compare256_power9.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/crc32_constants.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/crc32_power8.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/fallback_builtins.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/power_features.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/power_features.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/power_functions.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/slide_hash_power8.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/slide_hash_vmx.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/power/slide_ppc_tpl.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/riscv/README.md create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/riscv/adler32_rvv.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/riscv/chunkset_rvv.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/riscv/compare256_rvv.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_features.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_features.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_functions.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/riscv/slide_hash_rvv.c rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/arch/s390/Makefile.in (62%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/arch/s390/README.md (82%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/crc32-vx.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_common.h rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/arch/s390/dfltcc_deflate.c (77%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_deflate.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_detail.h rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/arch/s390/dfltcc_inflate.c (54%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_inflate.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/s390_features.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/s390_features.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/s390_functions.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/actions-runner.Dockerfile create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/actions-runner.service rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/arch/s390/self-hosted-builder/fs/usr/bin/actions-runner (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/arch/s390/self-hosted-builder/fs/usr/bin/entrypoint (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/runner-global.json create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/runner-s390x.patch create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/Makefile.in create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx2.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx2_p.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512_p.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512_vnni.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_sse42.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_ssse3.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_ssse3_p.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_avx2.c rename internal-complibs/{zlib-ng-2.0.7/arch/x86/chunkset_sse.c => zlib-ng-2.2.2/arch/x86/chunkset_sse2.c} (89%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_ssse3.c rename internal-complibs/{zlib-ng-2.0.7/arch/x86/compare258_avx.c => zlib-ng-2.2.2/arch/x86/compare256_avx2.c} (61%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/compare256_sse2.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_fold_pclmulqdq_tpl.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_fold_vpclmulqdq_tpl.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_pclmulqdq.c rename internal-complibs/{zlib-ng-2.0.7/arch/x86/crc_folding.c => zlib-ng-2.2.2/arch/x86/crc32_pclmulqdq_tpl.h} (66%) create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_vpclmulqdq.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/slide_hash_avx2.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/slide_hash_sse2.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/x86_features.c create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/x86_features.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/x86_functions.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch/x86/x86_intrins.h create mode 100644 internal-complibs/zlib-ng-2.2.2/arch_functions.h rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/chunkset_tpl.h (52%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/detect-arch.c (94%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/detect-arch.cmake (88%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/detect-coverage.cmake (61%) create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/detect-install-dirs.cmake create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/detect-intrinsics.cmake rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/detect-sanitizer.cmake (67%) create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/fallback-macros.cmake rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/toolchain-aarch64.cmake (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/toolchain-arm.cmake (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/toolchain-armhf.cmake (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-aarch64.cmake create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-armv7.cmake create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-i686.cmake create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-x86_64.cmake rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/toolchain-mingw-i686.cmake (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/toolchain-mingw-x86_64.cmake (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mips.cmake create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mips64.cmake rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/toolchain-powerpc.cmake (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64-clang.cmake create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64-power9.cmake rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/toolchain-powerpc64.cmake (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64le-clang.cmake create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64le-power9.cmake rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/toolchain-powerpc64le.cmake (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/cmake/toolchain-riscv.cmake rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/toolchain-s390x.cmake (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/cmake/toolchain-sparc64.cmake (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/compare256_rle.h rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/compress.c (86%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/configure (52%) create mode 100644 internal-complibs/zlib-ng-2.2.2/cpu_features.c create mode 100644 internal-complibs/zlib-ng-2.2.2/cpu_features.h create mode 100644 internal-complibs/zlib-ng-2.2.2/crc32.c create mode 100644 internal-complibs/zlib-ng-2.2.2/crc32.h create mode 100644 internal-complibs/zlib-ng-2.2.2/crc32_braid_comb.c create mode 100644 internal-complibs/zlib-ng-2.2.2/crc32_braid_comb_p.h create mode 100644 internal-complibs/zlib-ng-2.2.2/crc32_braid_p.h create mode 100644 internal-complibs/zlib-ng-2.2.2/crc32_braid_tbl.h rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/deflate.c (66%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/deflate.h (80%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/deflate_fast.c (73%) create mode 100644 internal-complibs/zlib-ng-2.2.2/deflate_huff.c rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/deflate_medium.c (72%) create mode 100644 internal-complibs/zlib-ng-2.2.2/deflate_p.h rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/deflate_quick.c (69%) create mode 100644 internal-complibs/zlib-ng-2.2.2/deflate_rle.c rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/deflate_slow.c (75%) create mode 100644 internal-complibs/zlib-ng-2.2.2/deflate_stored.c rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/doc/algorithm.txt (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/doc/crc-doc.1.0.pdf create mode 100644 internal-complibs/zlib-ng-2.2.2/doc/crc-pclmulqdq.pdf rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/doc/rfc1950.txt (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/doc/rfc1951.txt (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/doc/rfc1952.txt (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/doc/txtvsbin.txt (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/fallback_builtins.h create mode 100644 internal-complibs/zlib-ng-2.2.2/functable.c create mode 100644 internal-complibs/zlib-ng-2.2.2/functable.h rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/gzguts.h (96%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/gzlib.c (98%) rename internal-complibs/{zlib-ng-2.0.7/gzread.c => zlib-ng-2.2.2/gzread.c.in} (98%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/gzwrite.c (99%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/infback.c (92%) rename internal-complibs/{zlib-ng-2.0.7/inffast.c => zlib-ng-2.2.2/inffast_tpl.h} (87%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/inffixed_tbl.h (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/inflate.c (78%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/inflate.h (85%) create mode 100644 internal-complibs/zlib-ng-2.2.2/inflate_p.h rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/inftrees.c (94%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/inftrees.h (87%) create mode 100644 internal-complibs/zlib-ng-2.2.2/insert_string.c create mode 100644 internal-complibs/zlib-ng-2.2.2/insert_string_roll.c create mode 100644 internal-complibs/zlib-ng-2.2.2/insert_string_tpl.h create mode 100644 internal-complibs/zlib-ng-2.2.2/match_tpl.h create mode 100644 internal-complibs/zlib-ng-2.2.2/test/CMakeLists.txt rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/CVE-2002-0059/test.gz (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/CVE-2004-0797/test.gz (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/CVE-2005-1849/test.gz (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/CVE-2005-2096/test.gz (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/CVE-2018-25032/default.txt (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/CVE-2018-25032/fixed.txt (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/test/GH-1600/packobj.gz rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/GH-361/test.txt (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/GH-364/test.bin (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/GH-382/defneg3.dat (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/GH-751/test.txt (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/GH-979/pigz-2.6.tar.gz (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/test/Makefile.in rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/README.md (93%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/abi/ignore (85%) create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc-aarch64-unknown-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc-arm-unknown-linux-gnueabi.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc-arm-unknown-linux-gnueabihf.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc-mips-unknown-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc-mips64-unknown-linux-gnuabi64.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc-powerpc-unknown-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc-powerpc64-unknown-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc-powerpc64le-unknown-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc-x86_64-pc-linux-gnu-m32.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc-x86_64-pc-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-ng-e4614ebcb9b3e5b108dc983c155e4baf80882311-aarch64-unknown-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-ng-e4614ebcb9b3e5b108dc983c155e4baf80882311-arm-unknown-linux-gnueabi.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-ng-e4614ebcb9b3e5b108dc983c155e4baf80882311-arm-unknown-linux-gnueabihf.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-ng-e4614ebcb9b3e5b108dc983c155e4baf80882311-mips-unknown-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-ng-e4614ebcb9b3e5b108dc983c155e4baf80882311-mips64-unknown-linux-gnuabi64.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-ng-e4614ebcb9b3e5b108dc983c155e4baf80882311-powerpc-unknown-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-ng-e4614ebcb9b3e5b108dc983c155e4baf80882311-powerpc64-unknown-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-ng-e4614ebcb9b3e5b108dc983c155e4baf80882311-powerpc64le-unknown-linux-gnu.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-ng-e4614ebcb9b3e5b108dc983c155e4baf80882311-x86_64-pc-linux-gnu-m32.abi create mode 100644 internal-complibs/zlib-ng-2.2.2/test/abi/zlib-ng-e4614ebcb9b3e5b108dc983c155e4baf80882311-x86_64-pc-linux-gnu.abi rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/abicheck.md (97%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/abicheck.sh (94%) create mode 100644 internal-complibs/zlib-ng-2.2.2/test/add-subdirectory-project/CMakeLists.txt create mode 100644 internal-complibs/zlib-ng-2.2.2/test/add-subdirectory-project/main.c create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/CMakeLists.txt create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/README.md create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_adler32.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_adler32_copy.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_compare256.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_compare256_rle.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_compress.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_crc32.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_main.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_png_decode.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_png_encode.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_png_shared.h create mode 100644 internal-complibs/zlib-ng-2.2.2/test/benchmarks/benchmark_slidehash.cc rename internal-complibs/{zlib-ng-2.0.7/cmake/test-compress.cmake => zlib-ng-2.2.2/test/cmake/compress-and-verify.cmake} (75%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2/test}/cmake/run-and-compare.cmake (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2/test}/cmake/run-and-redirect.cmake (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/test/cmake/test-cves.cmake create mode 100644 internal-complibs/zlib-ng-2.2.2/test/cmake/test-data.cmake create mode 100644 internal-complibs/zlib-ng-2.2.2/test/cmake/test-issues.cmake create mode 100644 internal-complibs/zlib-ng-2.2.2/test/cmake/test-tools.cmake rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/data/fireworks.jpg (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/data/lcet10.txt (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/data/paper-100k.pdf (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/example.c (90%) create mode 100644 internal-complibs/zlib-ng-2.2.2/test/fuzz/CMakeLists.txt rename internal-complibs/{zlib-ng-2.0.7/test/fuzz/checksum_fuzzer.c => zlib-ng-2.2.2/test/fuzz/fuzzer_checksum.c} (92%) rename internal-complibs/{zlib-ng-2.0.7/test/fuzz/compress_fuzzer.c => zlib-ng-2.2.2/test/fuzz/fuzzer_compress.c} (96%) rename internal-complibs/{zlib-ng-2.0.7/test/fuzz/example_dict_fuzzer.c => zlib-ng-2.2.2/test/fuzz/fuzzer_example_dict.c} (98%) rename internal-complibs/{zlib-ng-2.0.7/test/fuzz/example_flush_fuzzer.c => zlib-ng-2.2.2/test/fuzz/fuzzer_example_flush.c} (97%) rename internal-complibs/{zlib-ng-2.0.7/test/fuzz/example_large_fuzzer.c => zlib-ng-2.2.2/test/fuzz/fuzzer_example_large.c} (98%) rename internal-complibs/{zlib-ng-2.0.7/test/fuzz/example_small_fuzzer.c => zlib-ng-2.2.2/test/fuzz/fuzzer_example_small.c} (96%) rename internal-complibs/{zlib-ng-2.0.7/test/fuzz/minigzip_fuzzer.c => zlib-ng-2.2.2/test/fuzz/fuzzer_minigzip.c} (89%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/fuzz/standalone_fuzz_target_runner.c (98%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/gh1235.c (82%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/infcover.c (98%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/minideflate.c (88%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/minigzip.c (87%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/pigz/CMakeLists.txt (98%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/pkgcheck.sh (91%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/test/switchlevels.c (97%) rename internal-complibs/{zlib-ng-2.0.7/test/adler32_test.c => zlib-ng-2.2.2/test/test_adler32.cc} (66%) create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_compare256.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_compare256_rle.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_compress.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_compress_bound.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_compress_dual.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_cpu_features.h create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_crc32.cc rename internal-complibs/{zlib-ng-2.0.7/test/CVE-2003-0107.c => zlib-ng-2.2.2/test/test_cve-2003-0107.cc} (55%) create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_deflate_bound.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_deflate_concurrency.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_deflate_copy.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_deflate_dict.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_deflate_hash_head_0.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_deflate_header.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_deflate_params.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_deflate_pending.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_deflate_prime.cc rename internal-complibs/{zlib-ng-2.0.7/test/deflate_quick_bi_valid.c => zlib-ng-2.2.2/test/test_deflate_quick_bi_valid.cc} (85%) rename internal-complibs/{zlib-ng-2.0.7/test/deflate_quick_block_open.c => zlib-ng-2.2.2/test/test_deflate_quick_block_open.cc} (71%) create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_deflate_tune.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_dict.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_gzio.cc rename internal-complibs/{zlib-ng-2.0.7/test/inflate_adler32.c => zlib-ng-2.2.2/test/test_inflate_adler32.cc} (52%) create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_inflate_copy.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_inflate_sync.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_large_buffers.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_main.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_raw.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_shared.h create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_shared_ng.h create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_small_buffers.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_small_window.cc create mode 100644 internal-complibs/zlib-ng-2.2.2/test/test_version.cc rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/tools/config.sub (100%) create mode 100644 internal-complibs/zlib-ng-2.2.2/tools/makecrct.c rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/tools/makefixed.c (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/tools/maketrees.c (90%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/trees.c (95%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/trees.h (100%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/trees_emit.h (97%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/trees_tbl.h (98%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/uncompr.c (88%) create mode 100644 internal-complibs/zlib-ng-2.2.2/win32/Makefile.a64 create mode 100644 internal-complibs/zlib-ng-2.2.2/win32/Makefile.arm create mode 100644 internal-complibs/zlib-ng-2.2.2/win32/Makefile.msc create mode 100644 internal-complibs/zlib-ng-2.2.2/win32/depcheck.cpp create mode 100644 internal-complibs/zlib-ng-2.2.2/win32/replace.vbs create mode 100644 internal-complibs/zlib-ng-2.2.2/win32/zlib-ng.def.in rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/win32/zlib-ng1.rc (91%) create mode 100644 internal-complibs/zlib-ng-2.2.2/win32/zlib.def.in rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/win32/zlib1.rc (91%) create mode 100644 internal-complibs/zlib-ng-2.2.2/win32/zlibcompat.def.in create mode 100644 internal-complibs/zlib-ng-2.2.2/zbuild.h rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/zconf-ng.h.in (95%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/zconf.h.in (95%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/zendian.h (93%) create mode 100644 internal-complibs/zlib-ng-2.2.2/zlib-config.cmake.in create mode 100644 internal-complibs/zlib-ng-2.2.2/zlib-ng-config.cmake.in rename internal-complibs/{zlib-ng-2.0.7/zlib-ng.h => zlib-ng-2.2.2/zlib-ng.h.in} (94%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/zlib-ng.map (89%) rename internal-complibs/{zlib-ng-2.0.7/zlib.h => zlib-ng-2.2.2/zlib.h.in} (95%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/zlib.map (97%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/zlib.pc.cmakein (78%) rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/zlib.pc.in (77%) create mode 100644 internal-complibs/zlib-ng-2.2.2/zlib_name_mangling-ng.h.in create mode 100644 internal-complibs/zlib-ng-2.2.2/zlib_name_mangling.h.empty create mode 100644 internal-complibs/zlib-ng-2.2.2/zlib_name_mangling.h.in rename internal-complibs/{zlib-ng-2.0.7 => zlib-ng-2.2.2}/zutil.c (92%) create mode 100644 internal-complibs/zlib-ng-2.2.2/zutil.h create mode 100644 internal-complibs/zlib-ng-2.2.2/zutil_p.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dee780f6..301ef770e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,7 +203,7 @@ if(NOT DEACTIVATE_ZLIB) message(STATUS "Using ZLIB-NG internal sources for ZLIB support.") set(HAVE_ZLIB_NG TRUE) add_definitions(-DZLIB_COMPAT) - set(ZLIB_NG_DIR "zlib-ng-2.0.7") # update to the actual included version + set(ZLIB_NG_DIR "zlib-ng-2.2.2") # update to the actual included version set(ZLIB_COMPAT TRUE) set(SKIP_INSTALL_ALL TRUE) set(BUILD_SHARED_LIBS FALSE) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e6d522a80..3c86f3e15 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -4,7 +4,7 @@ Release notes for C-Blosc2 Changes from 2.15.2 to 2.15.3 ============================= -#XXX version-specific blurb XXX# +* Updated internal zlib-ng to 2.2.2. Changes from 2.15.1 to 2.15.2 diff --git a/internal-complibs/zlib-ng-2.0.7/CMakeLists.txt b/internal-complibs/zlib-ng-2.0.7/CMakeLists.txt deleted file mode 100644 index 778d5def9..000000000 --- a/internal-complibs/zlib-ng-2.0.7/CMakeLists.txt +++ /dev/null @@ -1,1428 +0,0 @@ -cmake_minimum_required(VERSION 3.5.1) -if(CMAKE_VERSION VERSION_LESS 3.12) - cmake_policy(VERSION ${CMAKE_VERSION}) -else() - cmake_policy(VERSION 3.5.1...3.13.2) -endif() -message(STATUS "Using CMake version ${CMAKE_VERSION}") - -set(CMAKE_MACOSX_RPATH 1) - -# If not specified on the command line, enable C99 as the default -# Configuration items that affect the global compiler environment standards -# should be issued before the "project" command. -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) # The C standard whose features are requested to build this target -endif() -if(NOT CMAKE_C_STANDARD_REQUIRED) - set(CMAKE_C_STANDARD_REQUIRED ON) # Boolean describing whether the value of C_STANDARD is a requirement -endif() -if(NOT CMAKE_C_EXTENSIONS) - set(CMAKE_C_EXTENSIONS OFF) # Boolean specifying whether compiler specific extensions are requested -endif() -set(VALID_C_STANDARDS "99" "11") -if(NOT CMAKE_C_STANDARD IN_LIST VALID_C_STANDARDS) - MESSAGE(FATAL_ERROR "CMAKE_C_STANDARD:STRING=${CMAKE_C_STANDARD} not in know standards list\n ${VALID_C_STANDARDS}") -endif() - -# Parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.h _zlib_h_contents) -string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9]+.[0-9]+.[0-9]+).*\".*" - "\\1" ZLIB_HEADER_VERSION ${_zlib_h_contents}) -string(REGEX REPLACE ".*#define[ \t]+ZLIBNG_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" - "\\1" ZLIBNG_HEADER_VERSION ${_zlib_h_contents}) -message(STATUS "ZLIB_HEADER_VERSION: ${ZLIB_HEADER_VERSION}") -message(STATUS "ZLIBNG_HEADER_VERSION: ${ZLIBNG_HEADER_VERSION}") - -project(zlib VERSION ${ZLIB_HEADER_VERSION} LANGUAGES C) - -include(CheckTypeSize) -include(CheckSymbolExists) -include(CheckFunctionExists) -include(CheckIncludeFile) -include(CheckCSourceCompiles) -include(CheckCSourceRuns) -include(CheckCCompilerFlag) -include(CMakeDependentOption) -include(FeatureSummary) - -include(cmake/detect-arch.cmake) -include(cmake/detect-install-dirs.cmake) -include(cmake/detect-coverage.cmake) -include(cmake/detect-sanitizer.cmake) - -if(CMAKE_TOOLCHAIN_FILE) - message(STATUS "Using CMake toolchain: ${CMAKE_TOOLCHAIN_FILE}") -endif() - -# Make sure we use an appropriate BUILD_TYPE by default, "Release" to be exact -# this should select the maximum generic optimisation on the current platform (i.e. -O3 for gcc/clang) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release" CACHE STRING - "Choose the type of build, standard options are: Debug Release RelWithDebInfo MinSizeRel." - FORCE) - add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (default)") -else() - add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (selected)") -endif() - -# -# Options parsing -# -macro(add_option name description value) - option(${name} ${description} ${value}) - add_feature_info(${name} ${name} ${description}) -endmacro() - -add_option(WITH_GZFILEOP "Compile with support for gzFile related functions" ON) -add_option(ZLIB_COMPAT "Compile with zlib compatible API" OFF) -add_option(ZLIB_ENABLE_TESTS "Build test binaries" ON) -add_option(ZLIB_DUAL_LINK "Dual link tests against system zlib" OFF) -add_option(WITH_FUZZERS "Build test/fuzz" OFF) -add_option(WITH_OPTIM "Build with optimisation" ON) -add_option(WITH_NEW_STRATEGIES "Use new strategies" ON) -add_option(WITH_NATIVE_INSTRUCTIONS - "Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)" OFF) -add_option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF) -add_option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF) -add_option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF) -add_option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF) -add_option(WITH_UNALIGNED "Support unaligned reads on platforms that support it" ON) - -# Add multi-choice option -set(WITH_SANITIZER AUTO CACHE STRING "Enable sanitizer support") -set_property(CACHE WITH_SANITIZER PROPERTY STRINGS "Memory" "Address" "Undefined" "Thread") - -if(BASEARCH_ARM_FOUND) - add_option(WITH_ACLE "Build with ACLE" ON) - add_option(WITH_NEON "Build with NEON intrinsics" ON) -elseif(BASEARCH_PPC_FOUND) - add_option(WITH_POWER8 "Build with optimisations for POWER8" ON) -elseif(BASEARCH_S360_FOUND) - add_option(WITH_DFLTCC_DEFLATE "Build with DFLTCC intrinsics for compression on IBM Z" OFF) - add_option(WITH_DFLTCC_INFLATE "Build with DFLTCC intrinsics for decompression on IBM Z" OFF) -elseif(BASEARCH_X86_FOUND) - option(FORCE_TZCNT "Always assume CPU is TZCNT capable" OFF) - add_option(WITH_AVX2 "Build with AVX2" ON) - add_option(WITH_SSE2 "Build with SSE2" ON) - add_option(WITH_SSSE3 "Build with SSSE3" ON) - add_option(WITH_SSE4 "Build with SSE4" ON) - add_option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON) -endif() -add_option(INSTALL_UTILS "Copy minigzip and minideflate during install" OFF) - -mark_as_advanced(FORCE - ZLIB_DUAL_LINK - WITH_ACLE WITH_NEON - WITH_DFLTCC_DEFLATE - WITH_DFLTCC_INFLATE - WITH_AVX2 WITH_SSE2 - WITH_SSSE3 WITH_SSE4 - WITH_PCLMULQDQ - WITH_POWER8 - WITH_INFLATE_STRICT - WITH_INFLATE_ALLOW_INVALID_DIST - WITH_UNALIGNED - INSTALL_UTILS - ) - -if(ZLIB_COMPAT) - add_definitions(-DZLIB_COMPAT) - set(WITH_GZFILEOP ON) - set(SUFFIX "") - set(ZLIB_FULL_VERSION ${ZLIB_HEADER_VERSION}.zlib-ng) -else() - set(SUFFIX "-ng") - set(ZLIB_FULL_VERSION ${ZLIBNG_HEADER_VERSION}) -endif() - -if(WITH_GZFILEOP) - add_definitions(-DWITH_GZFILEOP) -endif() - -if(CMAKE_C_COMPILER_ID MATCHES "Intel") - if(CMAKE_HOST_UNIX) - set(WARNFLAGS "-w3") - set(WARNFLAGS_MAINTAINER "-w3 -Wcheck -Wremarks") - set(WARNFLAGS_DISABLE "") - if(BASEARCH_X86_FOUND) - set(AVX2FLAG "-mavx2") - set(SSE2FLAG "-msse2") - set(SSSE3FLAG "-mssse3") - set(SSE4FLAG "-msse4.2") - endif() - else() - set(WARNFLAGS "/W3") - set(WARNFLAGS_MAINTAINER "/W5") - set(WARNFLAGS_DISABLE "") - if(BASEARCH_X86_FOUND) - set(AVX2FLAG "/arch:AVX2") - set(SSE2FLAG "/arch:SSE2") - set(SSSE3FLAG "/arch:SSSE3") - set(SSE4FLAG "/arch:SSE4.2") - endif() - endif() - if(WITH_NATIVE_INSTRUCTIONS) - message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not supported on this configuration") - endif() -elseif(MSVC) - # Minimum supported MSVC version is 1800 = Visual Studio 12.0/2013 - # See also https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html - if(MSVC_VERSION VERSION_LESS 1800) - message(SEND_ERROR "Unsupported Visual Studio compiler version (requires 2013 or later).") - endif() - # TODO. ICC can be used through MSVC. I'm not sure if we'd ever see that combination - # (who'd use cmake from an IDE...) but checking for ICC before checking for MSVC should - # avoid mistakes. - # /Oi ? - set(WARNFLAGS "/W3") - set(WARNFLAGS_MAINTAINER "/W4") - set(WARNFLAGS_DISABLE "") - if(BASEARCH_ARM_FOUND) - add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE) - if(NOT "${ARCH}" MATCHES "aarch64") - set(NEONFLAG "/arch:VFPv4") - endif() - elseif(BASEARCH_X86_FOUND) - if(NOT "${ARCH}" MATCHES "x86_64") - set(SSE2FLAG "/arch:SSE2") - endif() - endif() - if(WITH_NATIVE_INSTRUCTIONS) - message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not supported on this configuration") - endif() - if(MINGW) - list(APPEND WARNFLAGS_DISABLE -Wno-pedantic-ms-format) - endif() -else() - # catch all GNU C compilers as well as Clang and AppleClang - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - set(__GNUC__ ON) - endif() - # Enable warnings in GCC and Clang - if(__GNUC__) - set(WARNFLAGS "-Wall") - set(WARNFLAGS_MAINTAINER "-Wextra -Wpedantic") - set(WARNFLAGS_DISABLE "-Wno-implicit-fallthrough") - endif() - if(WITH_NATIVE_INSTRUCTIONS) - if(__GNUC__) - if(BASEARCH_PPC_FOUND) - set(NATIVEFLAG "-mcpu=native") - else() - set(NATIVEFLAG "-march=native") - endif() - else() - message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not implemented yet on this configuration") - endif() - endif() - if(NOT NATIVEFLAG) - if(__GNUC__) - if(BASEARCH_ARM_FOUND) - if("${ARCH}" MATCHES "arm" AND NOT CMAKE_C_FLAGS MATCHES "-mfloat-abi") - # Auto-detect support for ARM floating point ABI - check_c_compiler_flag(-mfloat-abi=softfp HAVE_FLOATABI_SOFTFP) - if(HAVE_FLOATABI_SOFTFP) - set(FLOATABI "-mfloat-abi=softfp") - else() - check_c_compiler_flag(-mfloat-abi=hard HAVE_FLOATABI_HARD) - if(HAVE_FLOATABI_HARD) - set(FLOATABI "-mfloat-abi=hard") - endif() - endif() - if(FLOATABI) - message(STATUS "ARM floating point arch: ${FLOATABI}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLOATABI}") - else() - message(STATUS "ARM floating point arch not auto-detected") - endif() - endif() - # NEON - if("${ARCH}" MATCHES "aarch64") - set(NEONFLAG "-march=armv8-a+simd") - else() - # Check whether -mfpu=neon is available - set(CMAKE_REQUIRED_FLAGS "-mfpu=neon") - check_c_source_compiles( - "int main() { return 0; }" - MFPU_NEON_AVAILABLE FAIL_REGEX "not supported") - set(CMAKE_REQUIRED_FLAGS) - if(MFPU_NEON_AVAILABLE) - set(NEONFLAG "-mfpu=neon") - endif() - endif() - # ACLE - set(ACLEFLAG "-march=armv8-a+crc") - elseif(BASEARCH_PPC_FOUND) - set(POWER8FLAG "-mcpu=power8") - elseif(BASEARCH_X86_FOUND) - set(AVX2FLAG "-mavx2") - set(SSE2FLAG "-msse2") - set(SSSE3FLAG "-mssse3") - set(SSE4FLAG "-msse4") - set(PCLMULFLAG "-mpclmul") - endif() - # Check whether -fno-lto is available - set(CMAKE_REQUIRED_FLAGS "-fno-lto") - check_c_source_compiles( - "int main() { return 0; }" - FNO_LTO_AVAILABLE FAIL_REGEX "not supported") - set(CMAKE_REQUIRED_FLAGS) - if(FNO_LTO_AVAILABLE) - set(NOLTOFLAG "-fno-lto") - endif() - endif() - endif() -endif() - -# Replace optimization level 3 added by default with level 2 -if(NOT MSVC AND NOT CMAKE_C_FLAGS MATCHES "([\\/\\-]O)3") - string(REGEX REPLACE "([\\/\\-]O)3" "\\12" - CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") -endif() - -# Disable LTO -if(NOT WITH_NATIVE_INSTRUCTIONS) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) - foreach(_cfg_name IN LISTS CMAKE_CONFIGURATION_TYPES) - string(TOUPPER "${_cfg_name}" _cfg_name_uc) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_${_cfg_name_uc} OFF) - endforeach() -endif() - -# Set architecture alignment requirements -if(WITH_UNALIGNED) - if((BASEARCH_ARM_FOUND AND NOT "${ARCH}" MATCHES "armv[2-7]") OR (BASEARCH_PPC_FOUND AND "${ARCH}" MATCHES "powerpc64le") OR BASEARCH_X86_FOUND) - if(NOT DEFINED UNALIGNED_OK) - set(UNALIGNED_OK TRUE) - endif() - endif() - if(UNALIGNED_OK) - add_definitions(-DUNALIGNED_OK) - message(STATUS "Architecture supports unaligned reads") - endif() - if(BASEARCH_ARM_FOUND) - if(NOT DEFINED UNALIGNED64_OK) - if("${ARCH}" MATCHES "armv[2-7]") - set(UNALIGNED64_OK FALSE) - elseif("${ARCH}" MATCHES "(arm(v[8-9])?|aarch64)") - set(UNALIGNED64_OK TRUE) - endif() - endif() - endif() - if(BASEARCH_PPC_FOUND) - if(NOT DEFINED UNALIGNED64_OK) - if("${ARCH}" MATCHES "powerpc64le") - set(UNALIGNED64_OK TRUE) - endif() - endif() - endif() - if(BASEARCH_X86_FOUND) - if(NOT DEFINED UNALIGNED64_OK) - set(UNALIGNED64_OK TRUE) - endif() - endif() - if(UNALIGNED64_OK) - add_definitions(-DUNALIGNED64_OK) - message(STATUS "Architecture supports unaligned reads of > 4 bytes") - endif() -else() - message(STATUS "Unaligned reads manually disabled") -endif() - -# Apply warning compiler flags -if(WITH_MAINTAINER_WARNINGS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNFLAGS} ${WARNFLAGS_MAINTAINER} ${WARNFLAGS_DISABLE}") -else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNFLAGS} ${WARNFLAGS_DISABLE}") -endif() - -# Set code coverage compiler flags -if(WITH_CODE_COVERAGE) - add_code_coverage() -endif() - -# Set native instruction set compiler flag -if(WITH_NATIVE_INSTRUCTIONS AND DEFINED NATIVEFLAG) - # Apply flag to all source files and compilation checks - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NATIVEFLAG}") -endif() - -# -# Check for standard/system includes -# -check_include_file(sys/sdt.h HAVE_SYS_SDT_H) -if(HAVE_SYS_SDT_H) - add_definitions(-DHAVE_SYS_SDT_H) -endif() -check_include_file(unistd.h HAVE_UNISTD_H) - -# -# Check to see if we have large file support -# -set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64) -check_type_size(off64_t OFF64_T) -if(HAVE_OFF64_T) - add_definitions(-D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64) -else() - check_type_size(_off64_t _OFF64_T) - if(HAVE__OFF64_T) - add_definitions(-D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64) - else() - check_type_size(__off64_t __OFF64_T) - endif() -endif() -set(CMAKE_REQUIRED_DEFINITIONS) # clear variable - -# -# Check for fseeko and other optional functions -# -check_function_exists(fseeko HAVE_FSEEKO) -if(NOT HAVE_FSEEKO) - add_definitions(-DNO_FSEEKO) -endif() -check_function_exists(strerror HAVE_STRERROR) -if(NOT HAVE_STRERROR) - add_definitions(-DNO_STRERROR) -endif() -set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112L) -check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN) -if(HAVE_POSIX_MEMALIGN) - add_definitions(-DHAVE_POSIX_MEMALIGN) -endif() -set(CMAKE_REQUIRED_DEFINITIONS) -set(CMAKE_REQUIRED_DEFINITIONS -D_ISOC11_SOURCE=1) -check_function_exists(aligned_alloc HAVE_ALIGNED_ALLOC) -if(HAVE_ALIGNED_ALLOC) - add_definitions(-DHAVE_ALIGNED_ALLOC) -endif() -set(CMAKE_REQUIRED_DEFINITIONS) - -if(WITH_SANITIZER STREQUAL "Address") - add_address_sanitizer() -elseif(WITH_SANITIZER STREQUAL "Memory") - add_memory_sanitizer() -elseif(WITH_SANITIZER STREQUAL "Thread") - add_thread_sanitizer() -elseif(WITH_SANITIZER STREQUAL "Undefined") - add_undefined_sanitizer() -endif() - -# -# Check whether compiler supports -fno-semantic-interposition parameter -# -check_c_compiler_flag(-fno-semantic-interposition HAVE_NO_INTERPOSITION) - -# -# Check if we can hide zlib internal symbols that are linked between separate source files using hidden -# -check_c_source_compiles( - "#define Z_INTERNAL __attribute__((visibility (\"hidden\"))) - int Z_INTERNAL foo; - int main() { - return 0; - }" - HAVE_ATTRIBUTE_VISIBILITY_HIDDEN FAIL_REGEX "not supported") -if(HAVE_ATTRIBUTE_VISIBILITY_HIDDEN) - add_definitions(-DHAVE_VISIBILITY_HIDDEN) -endif() - -# -# Check if we can hide zlib internal symbols that are linked between separate source files using internal -# -check_c_source_compiles( - "#define Z_INTERNAL __attribute__((visibility (\"internal\"))) - int Z_INTERNAL foo; - int main() { - return 0; - }" - HAVE_ATTRIBUTE_VISIBILITY_INTERNAL FAIL_REGEX "not supported") -if(HAVE_ATTRIBUTE_VISIBILITY_INTERNAL) - add_definitions(-DHAVE_VISIBILITY_INTERNAL) -endif() - -# -# check for __builtin_ctz() support in the compiler -# -check_c_source_compiles( - "int main(void) { - unsigned int zero = 0; - long test = __builtin_ctz(zero); - (void)test; - return 0; - }" - HAVE_BUILTIN_CTZ -) -if(HAVE_BUILTIN_CTZ) - add_definitions(-DHAVE_BUILTIN_CTZ) -endif() -# -# check for __builtin_ctzll() support in the compiler -# -check_c_source_compiles( - "int main(void) { - unsigned int zero = 0; - long test = __builtin_ctzll(zero); - (void)test; - return 0; - }" - HAVE_BUILTIN_CTZLL -) -if(HAVE_BUILTIN_CTZLL) - add_definitions(-DHAVE_BUILTIN_CTZLL) -endif() - -# -# check for ptrdiff_t support -# -check_c_source_compiles( - "#include - int main() { - ptrdiff_t *a; - (void)a; - return 0; - }" - HAVE_PTRDIFF_T -) -if(NOT HAVE_PTRDIFF_T) - set(NEED_PTRDIFF_T 1) - - check_type_size("void *" SIZEOF_DATA_PTR) - message(STATUS "sizeof(void *) is ${SIZEOF_DATA_PTR} bytes") - - if(${SIZEOF_DATA_PTR} MATCHES "4") - set(PTRDIFF_TYPE "uint32_t") - elseif(${SIZEOF_DATA_PTR} MATCHES "8") - set(PTRDIFF_TYPE "uint64_t") - else() - message(FATAL_ERROR "sizeof(void *) is neither 32 nor 64 bit") - endif() -endif() - -# Macro to check if source compiles -# (and, when compiling very natively, also runs). -macro(check_c_source_compile_or_run source flag) - if(CMAKE_CROSSCOMPILING OR NOT WITH_NATIVE_INSTRUCTIONS) - check_c_source_compiles("${source}" ${flag}) - else() - check_c_source_runs("${source}" ${flag}) - endif() -endmacro() - -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DZLIB_DEBUG") - -if(MSVC) - set(CMAKE_DEBUG_POSTFIX "d") - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) -endif() - -if(BASEARCH_PPC_FOUND) - # Check if we have what we need for POWER8 optimizations - set(CMAKE_REQUIRED_FLAGS "${POWER8FLAG}") - check_c_source_compiles( - "#include - int main() { - return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07); - }" - HAVE_POWER8 - ) - set(CMAKE_REQUIRED_FLAGS) -elseif(BASEARCH_X86_FOUND) - # Check whether compiler supports SSE2 instrinics - set(CMAKE_REQUIRED_FLAGS "${SSE2FLAG}") - check_c_source_compile_or_run( - "#include - int main(void) { - __m128i zero = _mm_setzero_si128(); - (void)zero; - return 0; - }" - HAVE_SSE2_INTRIN - ) - # Check whether compiler supports SSSE3 intrinsics - set(CMAKE_REQUIRED_FLAGS "${SSSE3FLAG}") - check_c_source_compile_or_run( - "#include - int main(void) { - __m128i u, v, w; - u = _mm_set1_epi32(1); - v = _mm_set1_epi32(2); - w = _mm_hadd_epi32(u, v); - (void)w; - return 0; - }" - HAVE_SSSE3_INTRIN - ) - # Check whether compiler supports SSE4 CRC inline asm - set(CMAKE_REQUIRED_FLAGS "${SSE4FLAG}") - check_c_source_compile_or_run( - "int main(void) { - unsigned val = 0, h = 0; - #if defined(_MSC_VER) - { __asm mov edx, h __asm mov eax, val __asm crc32 eax, edx __asm mov val, eax } - #else - __asm__ __volatile__ ( \"crc32 %1,%0\" : \"+r\" (h) : \"r\" (val) ); - #endif - return (int)h; - }" - HAVE_SSE42CRC_INLINE_ASM - ) - # Check whether compiler supports SSE4 CRC intrinsics - check_c_source_compile_or_run( - "#include - int main(void) { - unsigned crc = 0; - char c = 'c'; - #if defined(_MSC_VER) - crc = _mm_crc32_u32(crc, c); - #else - crc = __builtin_ia32_crc32qi(crc, c); - #endif - (void)crc; - return 0; - }" - HAVE_SSE42CRC_INTRIN - ) - # Check whether compiler supports SSE4.2 compare string instrinics - check_c_source_compile_or_run( - "#include - int main(void) { - unsigned char a[64] = { 0 }; - unsigned char b[64] = { 0 }; - __m128i xmm_src0, xmm_src1; - xmm_src0 = _mm_loadu_si128((__m128i *)(char *)a); - xmm_src1 = _mm_loadu_si128((__m128i *)(char *)b); - return _mm_cmpestri(xmm_src0, 16, xmm_src1, 16, 0); - }" - HAVE_SSE42CMPSTR_INTRIN - ) - # Check whether compiler supports PCLMULQDQ intrinsics - set(CMAKE_REQUIRED_FLAGS "${PCLMULFLAG}") - if(NOT (APPLE AND "${ARCH}" MATCHES "i386")) - # The pclmul code currently crashes on Mac in 32bit mode. Avoid for now. - check_c_source_compile_or_run( - "#include - int main(void) { - __m128i a = _mm_setzero_si128(); - __m128i b = _mm_setzero_si128(); - __m128i c = _mm_clmulepi64_si128(a, b, 0x10); - (void)c; - return 0; - }" - HAVE_PCLMULQDQ_INTRIN - ) - else() - set(HAVE_PCLMULQDQ_INTRIN NO) - endif() - # Check whether compiler supports AVX2 intrinics - set(CMAKE_REQUIRED_FLAGS "${AVX2FLAG}") - check_c_source_compile_or_run( - "#include - int main(void) { - __m256i x = _mm256_set1_epi16(2); - const __m256i y = _mm256_set1_epi16(1); - x = _mm256_subs_epu16(x, y); - (void)x; - return 0; - }" - HAVE_AVX2_INTRIN - ) - set(CMAKE_REQUIRED_FLAGS) - - # FORCE_SSE2 option will only be shown if HAVE_SSE2_INTRIN is true - if("${ARCH}" MATCHES "i[3-6]86") - cmake_dependent_option(FORCE_SSE2 "Always assume CPU is SSE2 capable" OFF "HAVE_SSE2_INTRIN" OFF) - endif() -endif() - -# -# Enable deflate_quick at level 1 -# -if(NOT WITH_NEW_STRATEGIES) - add_definitions(-DNO_QUICK_STRATEGY) -endif() -# -# Enable deflate_medium at level 4-6 -# -if(NOT WITH_NEW_STRATEGIES) - add_definitions(-DNO_MEDIUM_STRATEGY) -endif() -# -# Enable inflate compilation options -# -if(WITH_INFLATE_STRICT) - add_definitions(-DINFLATE_STRICT) - message(STATUS "Inflate strict distance checking enabled") -endif() -if(WITH_INFLATE_ALLOW_INVALID_DIST) - add_definitions(-DINFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR) - message(STATUS "Inflate zero data for invalid distances enabled") -endif() - - -set(ZLIB_ARCH_SRCS) -set(ZLIB_ARCH_HDRS) -set(ARCHDIR "arch/generic") -if(BASEARCH_ARM_FOUND) - set(ARCHDIR "arch/arm") -elseif(BASEARCH_PPC_FOUND) - set(ARCHDIR "arch/power") -elseif(BASEARCH_S360_FOUND) - set(ARCHDIR "arch/s390") -elseif(BASEARCH_X86_FOUND) - set(ARCHDIR "arch/x86") - if(NOT ${ARCH} MATCHES "x86_64") - add_feature_info(SSE2 1 "Support the SSE2 instruction set, using \"${SSE2FLAG}\"") - endif() -else() - message(STATUS "No optimized architecture: using ${ARCHDIR}") -endif() - -if(WITH_OPTIM) - if(BASEARCH_ARM_FOUND) - add_definitions(-DARM_FEATURES) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - if(NOT "${ARCH}" MATCHES "aarch64") - check_c_source_compiles( - "#include - int main() { - return (getauxval(AT_HWCAP2) & HWCAP2_CRC32); - }" - ARM_AUXV_HAS_CRC32 - ) - if(ARM_AUXV_HAS_CRC32) - add_definitions(-DARM_AUXV_HAS_CRC32) - else() - check_c_source_compiles( - "#include - #include - int main() { - return (getauxval(AT_HWCAP2) & HWCAP2_CRC32); - }" - ARM_HWCAP_HAS_CRC32 - ) - if (ARM_HWCAP_HAS_CRC32) - add_definitions(-DARM_AUXV_HAS_CRC32 -DARM_ASM_HWCAP) - else() - message(STATUS "HWCAP2_CRC32 not present in sys/auxv.h; cannot detect support at runtime.") - endif() - endif() - else() - check_c_source_compiles( - "#include - int main() { - return (getauxval(AT_HWCAP) & HWCAP_CRC32); - }" - ARM_AUXV_HAS_CRC32 - ) - if(ARM_AUXV_HAS_CRC32) - add_definitions(-DARM_AUXV_HAS_CRC32) - else() - message(STATUS "HWCAP_CRC32 not present in sys/auxv.h; cannot detect support at runtime.") - endif() - endif() - if(NOT "${ARCH}" MATCHES "aarch64") - check_c_source_compiles( - "#include - int main() { - return (getauxval(AT_HWCAP) & HWCAP_ARM_NEON); - }" - ARM_AUXV_HAS_NEON - ) - if(ARM_AUXV_HAS_NEON) - add_definitions(-DARM_AUXV_HAS_NEON) - else() - check_c_source_compiles( - "#include - int main() { - return (getauxval(AT_HWCAP) & HWCAP_NEON); - }" - ARM_AUXV_HAS_NEON - ) - if (ARM_AUXV_HAS_NEON) - add_definitions(-DARM_AUXV_HAS_NEON) - else() - message(STATUS "Neither HWCAP_ARM_NEON or HWCAP_NEON present in sys/auxv.h; cannot detect support at runtime.") - endif() - endif() - endif() - endif() - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/arm.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/armfeature.c) - if(WITH_ACLE AND NOT MSVC AND NOT "${ARCH}" MATCHES "armv[2-7]") - add_definitions(-DARM_ACLE_CRC_HASH) - set(ACLE_SRCS ${ARCHDIR}/crc32_acle.c ${ARCHDIR}/insert_string_acle.c) - set_property(SOURCE ${ACLE_SRCS} PROPERTY COMPILE_FLAGS "${ACLEFLAG} ${NOLTOFLAG}") - list(APPEND ZLIB_ARCH_SRCS ${ACLE_SRCS}) - add_feature_info(ACLE_CRC 1 "Support ACLE optimized CRC hash generation, using \"${ACLEFLAG}\"") - endif() - if(WITH_NEON) - add_definitions(-DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH) - set(NEON_SRCS ${ARCHDIR}/adler32_neon.c ${ARCHDIR}/chunkset_neon.c ${ARCHDIR}/slide_neon.c) - list(APPEND ZLIB_ARCH_SRCS ${NEON_SRCS}) - set_property(SOURCE ${NEON_SRCS} PROPERTY COMPILE_FLAGS "${NEONFLAG} ${NOLTOFLAG}") - if(MSVC) - add_definitions(-D__ARM_NEON__) - endif() - add_feature_info(NEON_ADLER32 1 "Support NEON instructions in adler32, using \"${NEONFLAG}\"") - add_feature_info(NEON_SLIDEHASH 1 "Support NEON instructions in slide_hash, using \"${NEONFLAG}\"") - endif() - elseif(BASEARCH_PPC_FOUND) - if(WITH_POWER8 AND HAVE_POWER8) - add_definitions(-DPOWER8) - add_definitions(-DPOWER_FEATURES) - add_definitions(-DPOWER8_VSX_ADLER32) - add_definitions(-DPOWER8_VSX_SLIDEHASH) - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/power.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/power.c) - set(POWER8_SRCS ${ARCHDIR}/adler32_power8.c ${ARCHDIR}/slide_hash_power8.c) - list(APPEND ZLIB_ARCH_SRCS ${POWER8_SRCS}) - set_property(SOURCE ${POWER8_SRCS} PROPERTY COMPILE_FLAGS "${POWER8FLAG} ${NOLTOFLAG}") - endif() - elseif(BASEARCH_S360_FOUND) - if(WITH_DFLTCC_DEFLATE OR WITH_DFLTCC_INFLATE) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_common.c) - add_definitions(-DGZBUFSIZE=262144) - endif() - if(WITH_DFLTCC_DEFLATE) - add_definitions(-DS390_DFLTCC_DEFLATE) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_deflate.c) - endif() - if(WITH_DFLTCC_INFLATE) - add_definitions(-DS390_DFLTCC_INFLATE) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_inflate.c) - endif() - elseif(BASEARCH_X86_FOUND) - add_definitions(-DX86_FEATURES) - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/x86.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/x86.c) - if(MSVC) - list(APPEND ZLIB_ARCH_HDRS fallback_builtins.h) - endif() - if(WITH_AVX2 AND HAVE_AVX2_INTRIN) - add_definitions(-DX86_AVX2 -DX86_AVX2_ADLER32 -DX86_AVX_CHUNKSET) - set(AVX2_SRCS ${ARCHDIR}/slide_avx.c) - add_feature_info(AVX2_SLIDEHASH 1 "Support AVX2 optimized slide_hash, using \"${AVX2FLAG}\"") - list(APPEND AVX2_SRCS ${ARCHDIR}/chunkset_avx.c) - add_feature_info(AVX_CHUNKSET 1 "Support AVX optimized chunkset, using \"${AVX2FLAG}\"") - list(APPEND AVX2_SRCS ${ARCHDIR}/compare258_avx.c) - add_feature_info(AVX2_COMPARE258 1 "Support AVX2 optimized compare258, using \"${AVX2FLAG}\"") - list(APPEND AVX2_SRCS ${ARCHDIR}/adler32_avx.c) - add_feature_info(AVX2_ADLER32 1 "Support AVX2-accelerated adler32, using \"${AVX2FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${AVX2_SRCS}) - set_property(SOURCE ${AVX2_SRCS} PROPERTY COMPILE_FLAGS "${AVX2FLAG} ${NOLTOFLAG}") - endif() - if(WITH_SSE4 AND (HAVE_SSE42CRC_INLINE_ASM OR HAVE_SSE42CRC_INTRIN)) - add_definitions(-DX86_SSE42_CRC_HASH) - set(SSE42_SRCS ${ARCHDIR}/insert_string_sse.c) - add_feature_info(SSE42_CRC 1 "Support SSE4.2 optimized CRC hash generation, using \"${SSE4FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS}) - set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE4FLAG} ${NOLTOFLAG}") - if(HAVE_SSE42CRC_INTRIN) - add_definitions(-DX86_SSE42_CRC_INTRIN) - endif() - endif() - if(WITH_SSE4 AND HAVE_SSE42CMPSTR_INTRIN) - add_definitions(-DX86_SSE42_CMP_STR) - set(SSE42_SRCS ${ARCHDIR}/compare258_sse.c) - add_feature_info(SSE42_COMPARE258 1 "Support SSE4.2 optimized compare258, using \"${SSE4FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS}) - set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE4FLAG} ${NOLTOFLAG}") - endif() - if(WITH_SSE2 AND HAVE_SSE2_INTRIN) - add_definitions(-DX86_SSE2 -DX86_SSE2_CHUNKSET -DX86_SSE2_SLIDEHASH) - set(SSE2_SRCS ${ARCHDIR}/chunkset_sse.c ${ARCHDIR}/slide_sse.c) - list(APPEND ZLIB_ARCH_SRCS ${SSE2_SRCS}) - if(NOT ${ARCH} MATCHES "x86_64") - set_property(SOURCE ${SSE2_SRCS} PROPERTY COMPILE_FLAGS "${SSE2FLAG} ${NOLTOFLAG}") - add_feature_info(FORCE_SSE2 FORCE_SSE2 "Assume CPU is SSE2 capable") - if(FORCE_SSE2) - add_definitions(-DX86_NOCHECK_SSE2) - endif() - endif() - endif() - if(WITH_SSSE3) - if(HAVE_SSSE3_INTRIN) - add_definitions(-DX86_SSSE3 -DX86_SSSE3_ADLER32) - set(SSSE3_SRCS ${ARCHDIR}/adler32_ssse3.c) - add_feature_info(SSSE3_ADLER32 1 "Support SSSE3-accelerated adler32, using \"${SSSE3FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${SSSE3_SRCS}) - set_property(SOURCE ${SSSE3_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${NOLTOFLAG}") - else() - set(WITH_SSSE3 OFF) - endif() - endif() - if(FORCE_TZCNT) - add_definitions(-DX86_NOCHECK_TZCNT) - endif() - add_feature_info(FORCE_TZCNT FORCE_TZCNT "Assume CPU is TZCNT capable") - if(WITH_PCLMULQDQ AND HAVE_PCLMULQDQ_INTRIN AND WITH_SSSE3 AND WITH_SSE4) - add_definitions(-DX86_PCLMULQDQ_CRC) - set(PCLMULQDQ_SRCS ${ARCHDIR}/crc_folding.c) - add_feature_info(PCLMUL_CRC 1 "Support CRC hash generation using PCLMULQDQ, using \"${SSSE3FLAG} ${SSE4FLAG} ${PCLMULFLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${PCLMULQDQ_SRCS}) - set_property(SOURCE ${PCLMULQDQ_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${SSE4FLAG} ${PCLMULFLAG} ${NOLTOFLAG}") - endif() - endif() -endif() -message(STATUS "Architecture-specific source files: ${ZLIB_ARCH_SRCS}") - -#============================================================================ -# zconf.h -#============================================================================ - -macro(generate_cmakein input output) - file(REMOVE ${output}) - file(STRINGS ${input} _lines) - foreach(_line IN LISTS _lines) - string(REGEX REPLACE "#ifdef HAVE_UNISTD_H.*" "@ZCONF_UNISTD_LINE@" _line "${_line}") - string(REGEX REPLACE "#ifdef NEED_PTRDIFF_T.*" "@ZCONF_PTRDIFF_LINE@" _line "${_line}") - if(NEED_PTRDIFF_T) - string(REGEX REPLACE "typedef PTRDIFF_TYPE" "typedef @PTRDIFF_TYPE@" _line "${_line}") - endif() - file(APPEND ${output} "${_line}\n") - endforeach() -endmacro(generate_cmakein) - -generate_cmakein( ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.in ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h.cmakein ) - -if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) - # If we're doing an out of source build and the user has a zconf.h - # in their source tree... - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h) - message(STATUS "Renaming") - message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h") - message(STATUS "to 'zconf${SUFFIX}.h.included' because this file is included with zlib") - message(STATUS "but CMake generates it automatically in the build directory.") - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.included) - endif() - - # If we're doing an out of source build and the user has a zconf.h.cmakein - # in their source tree... - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein) - message(STATUS "Renaming") - message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein") - message(STATUS "to 'zconf${SUFFIX}.h.cmakeincluded' because this file is included with zlib") - message(STATUS "but CMake generates it automatically in the build directory.") - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakeincluded) - endif() -endif() - -# Refer to prefix symbolically to ease relocation by end user, -# as Makefile-generated .pc file does. -if(INC_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/include") - set(PC_INC_INSTALL_DIR "\${prefix}/include") -else() - set(PC_INC_INSTALL_DIR "${INC_INSTALL_DIR}") -endif() -if(LIB_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/lib") - set(PC_LIB_INSTALL_DIR "\${exec_prefix}/lib") -else() - set(PC_LIB_INSTALL_DIR "${LIB_INSTALL_DIR}") -endif() - -#============================================================================ -# zlib -#============================================================================ - -set(ZLIB_PUBLIC_HDRS - ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h - zlib${SUFFIX}.h -) -set(ZLIB_PRIVATE_HDRS - adler32_p.h - chunkset_tpl.h - crc32_p.h - crc32_tbl.h - crc32_comb_tbl.h - deflate.h - deflate_p.h - functable.h - inffast.h - inffixed_tbl.h - inflate.h - inflate_p.h - inftrees.h - insert_string_tpl.h - match_tpl.h - trees.h - trees_emit.h - trees_tbl.h - zbuild.h - zendian.h - zutil.h -) -set(ZLIB_SRCS - adler32.c - chunkset.c - compare258.c - compress.c - crc32.c - crc32_comb.c - deflate.c - deflate_fast.c - deflate_medium.c - deflate_quick.c - deflate_slow.c - functable.c - infback.c - inffast.c - inflate.c - inftrees.c - insert_string.c - trees.c - uncompr.c - zutil.c -) - -set(ZLIB_GZFILE_PRIVATE_HDRS - gzguts.h -) -set(ZLIB_GZFILE_SRCS - gzlib.c - gzread.c - gzwrite.c -) - -if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) - set(ZLIB_DLL_SRCS win32/zlib${SUFFIX}1.rc) -endif() - -set(ZLIB_ALL_SRCS ${ZLIB_SRCS} ${ZLIB_ARCH_HDRS} ${ZLIB_ARCH_SRCS} ${ZLIB_DLL_SRCS} - ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -if(WITH_GZFILEOP) - list(APPEND ZLIB_ALL_SRCS ${ZLIB_GZFILE_PRIVATE_HDRS} ${ZLIB_GZFILE_SRCS}) -endif() - -if(NOT DEFINED BUILD_SHARED_LIBS) - add_library(zlib SHARED ${ZLIB_ALL_SRCS}) - add_library(zlibstatic STATIC ${ZLIB_ALL_SRCS}) - - set(ZLIB_INSTALL_LIBRARIES zlib zlibstatic) -else() - add_library(zlib ${ZLIB_ALL_SRCS}) - - if(NOT BUILD_SHARED_LIBS) - add_library(zlibstatic ALIAS zlib) - endif() - - set(ZLIB_INSTALL_LIBRARIES zlib) -endif() - -foreach(ZLIB_INSTALL_LIBRARY ${ZLIB_INSTALL_LIBRARIES}) - if(NOT ZLIB_COMPAT) - target_compile_definitions(${ZLIB_INSTALL_LIBRARY} PUBLIC ZLIBNG_NATIVE_API) - endif() - target_include_directories(${ZLIB_INSTALL_LIBRARY} PUBLIC - "$" - "$") -endforeach() - -if(WIN32) - # Shared library - if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) - set_target_properties(zlib PROPERTIES OUTPUT_NAME zlib${SUFFIX}) - endif() - # Static library - if(NOT DEFINED BUILD_SHARED_LIBS) - if(MSVC) - set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME zlibstatic${SUFFIX}) - else() - set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z${SUFFIX}) - endif() - elseif(NOT BUILD_SHARED_LIBS) - if(MSVC) - set_target_properties(zlib PROPERTIES OUTPUT_NAME zlibstatic${SUFFIX}) - else() - set_target_properties(zlib PROPERTIES OUTPUT_NAME z${SUFFIX}) - endif() - endif() -else() - # On unix-like platforms the library is almost always called libz - set_target_properties(${ZLIB_INSTALL_LIBRARIES} PROPERTIES OUTPUT_NAME z${SUFFIX}) -endif() - -if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) - set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) - - if(ZLIB_COMPAT) - set_target_properties(zlib PROPERTIES SOVERSION 1) - else() - set_target_properties(zlib PROPERTIES SOVERSION 2) - endif() - - if(NOT CYGWIN) - # This property causes shared libraries on Linux to have the full version - # encoded into their final filename. We disable this on Cygwin because - # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll - # seems to be the default. - # - # This has no effect with MSVC, on that platform the version info for - # the DLL comes from the resource file win32/zlib1.rc - set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) - endif() - - if(UNIX) - if(HAVE_NO_INTERPOSITION) - set_target_properties(zlib PROPERTIES COMPILE_FLAGS "-fno-semantic-interposition") - endif() - if(NOT APPLE) - set_target_properties(zlib PROPERTIES LINK_FLAGS - "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.map\"") - else() - # Match configure/make's behavior (i.e. don't use @rpath on mac). - set_target_properties(zlib PROPERTIES INSTALL_NAME_DIR "${LIB_INSTALL_DIR}") - endif() - endif() - if(MSYS OR CYGWIN) - # Suppress version number from shared library name - set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 0) - elseif(WIN32) - # Creates zlib1.dll when building shared library version - if(ZLIB_COMPAT) - set_target_properties(zlib PROPERTIES SUFFIX "1.dll") - else() - set_target_properties(zlib PROPERTIES SUFFIX "2.dll") - endif() - endif() -endif() - -if(HAVE_UNISTD_H) - SET(ZCONF_UNISTD_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */") -else() - SET(ZCONF_UNISTD_LINE "#if 0 /* was set to #if 0 by configure/cmake/etc */") -endif() -if(NEED_PTRDIFF_T) - SET(ZCONF_PTRDIFF_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */") -else() - SET(ZCONF_PTRDIFF_LINE "#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */") -endif() - -set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib${SUFFIX}.pc) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein - ${ZLIB_PC} @ONLY) -configure_file(${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h.cmakein - ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h @ONLY) - -if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) - install(TARGETS ${ZLIB_INSTALL_LIBRARIES} - RUNTIME DESTINATION "${BIN_INSTALL_DIR}" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" - LIBRARY DESTINATION "${LIB_INSTALL_DIR}") -endif() -if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) - install(FILES zlib${SUFFIX}.h - DESTINATION "${INC_INSTALL_DIR}" RENAME zlib${SUFFIX}.h) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h - DESTINATION "${INC_INSTALL_DIR}" RENAME zconf${SUFFIX}.h) -endif() -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL) - install(FILES ${ZLIB_PC} DESTINATION "${PKGCONFIG_INSTALL_DIR}") -endif() - -#============================================================================ -# Example binaries -#============================================================================ - -option(ZLIB_ENABLE_TESTS "Build test binaries" ON) -if(ZLIB_ENABLE_TESTS) - enable_testing() - macro(configure_test_executable target) - target_include_directories(${target} PUBLIC - "$" - "$") - if(NOT WITH_GZFILEOP) - target_compile_definitions(${target} PUBLIC -DWITH_GZFILEOP) - target_sources(${target} PRIVATE ${ZLIB_GZFILE_PRIVATE_HDRS} ${ZLIB_GZFILE_SRCS}) - endif() - if(ZLIB_DUAL_LINK) - find_package(ZLIB) - if(ZLIB_FOUND) - target_link_libraries(${target} ${ZLIB_LIBRARIES}) - endif() - endif() - endmacro() - - macro(add_simple_test_executable target) - add_executable(${target} test/${target}.c) - configure_test_executable(${target}) - target_link_libraries(${target} zlib) - add_test(NAME ${target} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - endmacro() - - add_simple_test_executable(adler32_test) - add_simple_test_executable(crc32_test) - add_simple_test_executable(example) - - set(MINIGZIP_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_executable(minigzip test/minigzip.c) - configure_test_executable(minigzip) - if(NOT DEFINED BUILD_SHARED_LIBS) - target_link_libraries(minigzip zlibstatic) - else() - target_link_libraries(minigzip zlib) - endif() - if(BASEARCH_S360_FOUND) - if(WITH_DFLTCC_DEFLATE OR WITH_DFLTCC_INFLATE) - set_source_files_properties(test/minigzip.c PROPERTIES COMPILE_DEFINITIONS BUFLEN=262144) - endif() - endif() - - set(MINIDEFLATE_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_executable(minideflate test/minideflate.c) - configure_test_executable(minideflate) - target_link_libraries(minideflate zlib) - - if(INSTALL_UTILS) - install(TARGETS minigzip minideflate - RUNTIME DESTINATION "${BIN_INSTALL_DIR}" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" - LIBRARY DESTINATION "${LIB_INSTALL_DIR}") - endif() - - set(SWITCHLEVELS_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_executable(switchlevels test/switchlevels.c) - configure_test_executable(switchlevels) - target_link_libraries(switchlevels zlib) - - add_simple_test_executable(infcover) - target_sources(infcover PRIVATE inftrees.c) - - add_executable(makefixed tools/makefixed.c inftrees.c) - target_include_directories(makefixed PUBLIC - "$" - "$") - - set(MAKEFIXED_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_test(NAME makefixed - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${MAKEFIXED_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/inffixed_tbl._h - -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/inffixed_tbl.h - -DIGNORE_LINE_ENDINGS=ON - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) - - add_executable(maketrees tools/maketrees.c trees.c zutil.c) - target_include_directories(maketrees PUBLIC - "$" - "$") - - set(MAKETREES_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_test(NAME maketrees - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${MAKETREES_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/trees_tbl._h - -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/trees_tbl.h - -DIGNORE_LINE_ENDINGS=ON - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) - - add_executable(makecrct tools/makecrct.c) - target_include_directories(makecrct PUBLIC - "$" - "$") - - set(MAKECRCT_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_test(NAME makecrct-crc32 - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${MAKECRCT_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/crc32_tbl._h - -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/crc32_tbl.h - -DIGNORE_LINE_ENDINGS=ON - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) - - set(MAKECRCT_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -c) - add_test(NAME makecrct-crc32-combine - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${MAKECRCT_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/crc32_comb_tbl._h - -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/crc32_comb_tbl.h - -DIGNORE_LINE_ENDINGS=ON - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) - - if(WITH_FUZZERS) - set(FUZZERS checksum compress example_small example_large example_flush example_dict minigzip) - file(GLOB ALL_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*") - foreach(FUZZER ${FUZZERS}) - add_executable(${FUZZER}_fuzzer test/fuzz/${FUZZER}_fuzzer.c test/fuzz/standalone_fuzz_target_runner.c) - configure_test_executable(${FUZZER}_fuzzer) - target_link_libraries(${FUZZER}_fuzzer zlib) - set(FUZZER_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ALL_SRC_FILES}) - add_test(NAME ${FUZZER}_fuzzer COMMAND ${FUZZER_COMMAND}) - endforeach() - endif() - - macro(test_minigzip name path) - # Construct compression arguments for minigzip - set(compress_args -k -c) - foreach(extra_arg IN ITEMS "${ARGN}") - list(APPEND compress_args ${extra_arg}) - endforeach() - - # Create unique friendly string for test - string(REPLACE ";" "" arg_list "${ARGN}") - string(REPLACE " " "" arg_list "${arg_list}") - string(REPLACE "-" "" arg_list "${arg_list}") - - set(test_id minigzip-${name}-${arg_list}) - - if(NOT TEST ${test_id}) - add_test(NAME ${test_id} - COMMAND ${CMAKE_COMMAND} - "-DTARGET=${MINIGZIP_COMMAND}" - "-DCOMPRESS_ARGS=${compress_args}" - "-DDECOMPRESS_ARGS=-d;-c" - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/${path} - -DTEST_NAME=${test_id} - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - endif() - endmacro() - - set(TEST_CONFIGS - -R # Z_RLE - -h # Z_HUFFMAN_ONLY - -T # Direct store - -0 # No compression - -1 # Deflate quick - -4 # Deflate medium (lazy matches) - "-5;-F" # Deflate medium (Z_FIXED) - -6 # Deflate medium - -9 # Deflate slow - "-9;-f" # Deflate slow (Z_FILTERED) - ) - - file(GLOB_RECURSE TEST_FILE_PATHS - LIST_DIRECTORIES false - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/test/data/*) - - foreach(TEST_FILE_PATH ${TEST_FILE_PATHS}) - if("${TEST_FILE_PATH}" MATCHES ".gz$" OR "${TEST_FILE_PATH}" MATCHES ".out$" OR - "${TEST_FILE_PATH}" MATCHES "/.git/" OR "${TEST_FILE_PATH}" MATCHES ".md$") - continue() - endif() - foreach(TEST_CONFIG ${TEST_CONFIGS}) - get_filename_component(TEST_NAME ${TEST_FILE_PATH} NAME) - if (TEST_NAME STREQUAL "") - continue() - endif() - test_minigzip(${TEST_NAME} ${TEST_FILE_PATH} ${TEST_CONFIG}) - endforeach() - endforeach() - - test_minigzip("detect-text" "test/data/lcet10.txt" -A) - test_minigzip("detect-binary" "test/data/paper-100k.pdf" -A) - - set(CVES CVE-2002-0059 CVE-2004-0797 CVE-2005-1849 CVE-2005-2096) - foreach(CVE ${CVES}) - set(CVE_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -d) - add_test(NAME ${CVE} - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${CVE_COMMAND}" - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/${CVE}/test.gz - "-DSUCCESS_EXIT=0;1" - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) - endforeach() - - set(TEST_LEVELS 6 1 2) - foreach(TEST_LEVEL ${TEST_LEVELS}) - add_test(NAME CVE-2018-25032-fixed-level-${TEST_LEVEL} - COMMAND ${CMAKE_COMMAND} - "-DTARGET=${MINIDEFLATE_COMMAND}" - "-DCOMPRESS_ARGS=-c;-k;-m;1;-w;-15;-s;4;-F;-${TEST_LEVEL}" - "-DDECOMPRESS_ARGS=-c;-k;-d;-m;1;-w;-15;-${TEST_LEVEL}" - -DGZIP_VERIFY=OFF - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/CVE-2018-25032/fixed.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME CVE-2018-25032-default-level-${TEST_LEVEL} - COMMAND ${CMAKE_COMMAND} - "-DTARGET=${MINIDEFLATE_COMMAND}" - "-DCOMPRESS_ARGS=-c;-k;-m;1;-w;-15;-s;4;-${TEST_LEVEL}" - "-DDECOMPRESS_ARGS=-c;-k;-d;-m;1;-w;-15;-${TEST_LEVEL}" - -DGZIP_VERIFY=OFF - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/CVE-2018-25032/default.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - endforeach() - - # Run tests targeting tools - include(cmake/test-tools.cmake) - - if(NOT WIN32 AND ZLIB_COMPAT) - add_simple_test_executable(CVE-2003-0107) - endif() - - add_test(NAME GH-361 - COMMAND ${CMAKE_COMMAND} - "-DTARGET=${MINIGZIP_COMMAND}" - "-DCOMPRESS_ARGS=-c;-k;-4" - -DTEST_NAME=GH-361-test-txt - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/GH-361/test.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-364 - COMMAND ${CMAKE_COMMAND} - "-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}" - "-DCOMPRESS_ARGS=1;5;9;3" - "-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}" - -DTEST_NAME=GH-364-test-bin - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/GH-364/test.bin - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-382 - COMMAND ${CMAKE_COMMAND} - "-DTARGET=${MINIDEFLATE_COMMAND}" - "-DCOMPRESS_ARGS=-c;-m;1;-w;-15;-1;-s;4" - "-DDECOMPRESS_ARGS=-c;-d;-m;1;-w;-15" - -DGZIP_VERIFY=OFF - -DTEST_NAME=GH-382-defneg3-dat - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/GH-382/defneg3.dat - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-536-segfault - COMMAND ${CMAKE_COMMAND} - "-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}" - "-DCOMPRESS_ARGS=6;9744;1;91207" - "-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}" - -DCOMPARE=OFF - -DGZIP_VERIFY=OFF - -DTEST_NAME=GH-536-segfault-lcet10-txt - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/data/lcet10.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-536-incomplete-read - COMMAND ${CMAKE_COMMAND} - "-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}" - "-DCOMPRESS_ARGS=6;88933;1;195840;2;45761" - "-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}" - -DCOMPARE=OFF - -DGZIP_VERIFY=OFF - -DTEST_NAME=GH-536-incomplete-read-lcet10-txt - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/data/lcet10.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-536-zero-stored-block - COMMAND ${CMAKE_COMMAND} - "-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}" - "-DCOMPRESS_ARGS=6;15248;1;1050;2;25217" - "-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}" - -DCOMPARE=OFF - -DGZIP_VERIFY=OFF - -DTEST_NAME=GH-536-zero-stored-block-lcet10-txt - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/data/lcet10.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-751 - COMMAND ${CMAKE_COMMAND} - "-DTARGET=${MINIGZIP_COMMAND}" - -DTEST_NAME=GH-751-test-txt - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/GH-751/test.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_simple_test_executable(deflate_quick_bi_valid) - add_simple_test_executable(deflate_quick_block_open) - add_simple_test_executable(inflate_adler32) - add_simple_test_executable(hash_head_0) -endif() - -FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES) diff --git a/internal-complibs/zlib-ng-2.0.7/README.md b/internal-complibs/zlib-ng-2.0.7/README.md deleted file mode 100644 index a702ba934..000000000 --- a/internal-complibs/zlib-ng-2.0.7/README.md +++ /dev/null @@ -1,220 +0,0 @@ -## zlib-ng -*zlib data compression library for the next generation systems* - -Maintained by Hans Kristian Rosbach - aka Dead2 (zlib-ng àt circlestorm dót org) - -|CI|Status| -|:-|-| -|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)| -|Buildkite|[![Build status](https://badge.buildkite.com/7bb1ef84356d3baee26202706cc053ee1de871c0c712b65d26.svg?branch=develop)](https://buildkite.com/circlestorm-productions/zlib-ng)| -|CodeFactor|[![CodeFactor](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng/badge)](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng)| -|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) -|Codecov|[![codecov.io](https://codecov.io/github/zlib-ng/zlib-ng/coverage.svg?branch=develop)](https://codecov.io/github/zlib-ng/zlib-ng/)| - - -Features --------- - -* Zlib compatible API with support for dual-linking -* Modernized native API based on zlib API for ease of porting -* Modern C99 syntax and a clean code layout -* Deflate medium and quick algorithms based on Intels zlib fork -* Support for CPU intrinsics when available - * Adler32 implementation using SSSE3, AVX2, Neon & VSX - * CRC32-B implementation using PCLMULQDQ & ACLE - * Hash table implementation using CRC32-C intrinsics on x86 and ARM - * Slide hash implementations using SSE2, AVX2, Neon & VSX - * Compare256/258 implementations using SSE4.2 & AVX2 - * Inflate chunk copying using SSE2, AVX2 & Neon - * Support for hardware-accelerated deflate using IBM Z DFLTCC -* Unaligned memory read/writes and large bit buffer improvements -* Includes improvements from Cloudflare and Intel forks -* Configure, CMake, and NMake build system support -* Comprehensive set of CMake unit tests -* Code sanitizers, fuzzing, and coverage -* GitHub Actions continuous integration on Windows, macOS, and Linux - * Emulated CI for ARM, AARCH64, PPC, PPC64, SPARC64, S390x using qemu - - -History -------- - -The motivation for this fork came after seeing several 3rd party -contributions containing new optimizations not getting implemented -into the official zlib repository. - -Mark Adler has been maintaining zlib for a very long time, and he has -done a great job and hopefully he will continue for a long time yet. -The idea of zlib-ng is not to replace zlib, but to co-exist as a -drop-in replacement with a lower threshold for code change. - -zlib has a long history and is incredibly portable, even supporting -lots of systems that predate the Internet. This is great, but it does -complicate further development and maintainability. -The zlib code has numerous workarounds for old compilers that do not -understand ANSI-C or to accommodate systems with limitations such as -operating in a 16-bit environment. - -Many of these workarounds are only maintenance burdens, some of them -are pretty huge code-wise. For example, the [v]s[n]printf workaround -code has a whopping 8 different implementations just to cater to -various old compilers. With this many workarounds cluttered throughout -the code, new programmers with an idea/interest for zlib will need -to take some time to figure out why all of these seemingly strange -things are used, and how to work within those confines. - -So I decided to make a fork, merge all the Intel optimizations, merge -the Cloudflare optimizations that did not conflict, plus a couple -of other smaller patches. Then I started cleaning out workarounds, -various dead code, all contrib and example code as there is little -point in having those in this fork for various reasons. - -A lot of improvements have gone into zlib-ng since its start, and -numerous people and companies have contributed both small and big -improvements, or valuable testing. - -Please read LICENSE.md, it is very simple and very liberal. - - -Build ------ - -There are two ways to build zlib-ng: - -### Cmake - -To build zlib-ng using the cross-platform makefile generator cmake. - -``` -cmake . -cmake --build . --config Release -ctest --verbose -C Release -``` - -Alternatively, you can use the cmake configuration GUI tool ccmake: - -``` -ccmake . -``` - -### Configure - -To build zlib-ng using the bash configure script: - -``` -./configure -make -make test -``` - -Build Options -------------- - -| CMake | configure | Description | Default | -|:-------------------------|:-------------------------|:--------------------------------------------------------------------------------------|---------| -| ZLIB_COMPAT | --zlib-compat | Compile with zlib compatible API | OFF | -| ZLIB_ENABLE_TESTS | | Build test binaries | ON | -| WITH_GZFILEOP | --without-gzfileops | Compile with support for gzFile related functions | ON | -| WITH_OPTIM | --without-optimizations | Build with optimisations | ON | -| WITH_NEW_STRATEGIES | --without-new-strategies | Use new strategies | ON | -| WITH_NATIVE_INSTRUCTIONS | --native | Compiles with full instruction set supported on this host (gcc/clang -march=native) | OFF | -| WITH_SANITIZER | --with-sanitizer | Build with sanitizer (memory, address, undefined) | OFF | -| WITH_FUZZERS | --with-fuzzers | Build test/fuzz | OFF | -| WITH_MAINTAINER_WARNINGS | | Build with project maintainer warnings | OFF | -| WITH_CODE_COVERAGE | | Enable code coverage reporting | OFF | - - -Install -------- - -WARNING: We do not recommend manually installing unless you really -know what you are doing, because this can potentially override the system -default zlib library, and any incompatibility or wrong configuration of -zlib-ng can make the whole system unusable, requiring recovery or reinstall. -If you still want a manual install, we recommend using the /opt/ path prefix. - -For Linux distros, an alternative way to use zlib-ng (if compiled in -zlib-compat mode) instead of zlib, is through the use of the -_LD_PRELOAD_ environment variable. If the program is dynamically linked -with zlib, then zlib-ng will temporarily be used instead by the program, -without risking system-wide instability. - -``` -LD_PRELOAD=/opt/zlib-ng/libz.so.1.2.11.zlib-ng /usr/bin/program -``` - -### Cmake - -To install zlib-ng system-wide using cmake: - -``` -cmake --build . --target install -``` - -### Configure - -To install zlib-ng system-wide using the configure script: - -``` -make install -``` - -Contributing ------------- - -Zlib-ng is a aiming to be open to contributions, and we would be delighted to -receive pull requests on github. -Just remember that any code you submit must be your own and it must be zlib licensed. -Help with testing and reviewing of pull requests etc is also very much appreciated. - -If you are interested in contributing, please consider joining our -IRC channel #zlib-ng on the Freenode IRC network. - - -Acknowledgments ----------------- - -Thanks to Servebolt.com for sponsoring my maintainership of zlib-ng. - -Thanks go out to all the people and companies who have taken the time to contribute -code reviews, testing and/or patches. Zlib-ng would not have been nearly as good without you. - -The deflate format used by zlib was defined by Phil Katz. -The deflate and zlib specifications were written by L. Peter Deutsch. - -zlib was originally created by Jean-loup Gailly (compression) -and Mark Adler (decompression). - - -Advanced Build Options ----------------------- - -| CMake | configure | Description | Default | -|:--------------------------------|:----------------------|:--------------------------------------------------------------------|------------------------| -| ZLIB_DUAL_LINK | | Dual link tests with system zlib | OFF | -| UNALIGNED_OK | | Allow unaligned reads | ON (x86, arm) | -| FORCE_SSE2 | --force-sse2 | Skip runtime check for SSE2 instructions (Always on for x86_64) | OFF (x86) | -| FORCE_TZCNT | --force-tzcnt | Skip runtime check for TZCNT instructions | OFF | -| WITH_AVX2 | | Build with AVX2 intrinsics | ON | -| WITH_SSE2 | | Build with SSE2 intrinsics | ON | -| WITH_SSE4 | | Build with SSE4 intrinsics | ON | -| WITH_PCLMULQDQ | | Build with PCLMULQDQ intrinsics | ON | -| WITH_ACLE | --without-acle | Build with ACLE intrinsics | ON | -| WITH_NEON | --without-neon | Build with NEON intrinsics | ON | -| WITH_POWER8 | | Build with POWER8 optimisations | ON | -| WITH_DFLTCC_DEFLATE | --with-dfltcc-deflate | Build with DFLTCC intrinsics for compression on IBM Z | OFF | -| WITH_DFLTCC_INFLATE | --with-dfltcc-inflate | Build with DFLTCC intrinsics for decompression on IBM Z | OFF | -| WITH_UNALIGNED | | Allow optimizations that use unaligned reads if safe on current arch| ON | -| WITH_INFLATE_STRICT | | Build with strict inflate distance checking | OFF | -| WITH_INFLATE_ALLOW_INVALID_DIST | | Build with zero fill for inflate invalid distances | OFF | -| INSTALL_UTILS | | Copy minigzip and minideflate during install | OFF | - - -Related Projects ----------------- - -* Fork of the popular minizip https://github.com/zlib-ng/minizip-ng -* Python tool to benchmark minigzip/minideflate https://github.com/zlib-ng/deflatebench -* Python tool to benchmark pigz https://github.com/zlib-ng/pigzbench -* 3rd party patches for zlib-ng compatibility https://github.com/zlib-ng/patches diff --git a/internal-complibs/zlib-ng-2.0.7/arch/.gitignore b/internal-complibs/zlib-ng-2.0.7/arch/.gitignore deleted file mode 100644 index 2c3af0a08..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# ignore Makefiles; they're all automatically generated -Makefile diff --git a/internal-complibs/zlib-ng-2.0.7/arch/arm/adler32_neon.c b/internal-complibs/zlib-ng-2.0.7/arch/arm/adler32_neon.c deleted file mode 100644 index adda6f61d..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/arm/adler32_neon.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright (C) 1995-2011, 2016 Mark Adler - * Copyright (C) 2017 ARM Holdings Inc. - * Author: Adenilson Cavalcanti - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ -#ifdef ARM_NEON_ADLER32 -#ifdef _M_ARM64 -# include -#else -# include -#endif -#include "../../zutil.h" -#include "../../adler32_p.h" - -static void NEON_accum32(uint32_t *s, const unsigned char *buf, size_t len) { - static const uint8_t taps[32] = { - 32, 31, 30, 29, 28, 27, 26, 25, - 24, 23, 22, 21, 20, 19, 18, 17, - 16, 15, 14, 13, 12, 11, 10, 9, - 8, 7, 6, 5, 4, 3, 2, 1 }; - - uint32x2_t adacc2, s2acc2, as; - uint8x16_t t0 = vld1q_u8(taps), t1 = vld1q_u8(taps + 16); - - uint32x4_t adacc = vdupq_n_u32(0), s2acc = vdupq_n_u32(0); - adacc = vsetq_lane_u32(s[0], adacc, 0); - s2acc = vsetq_lane_u32(s[1], s2acc, 0); - - while (len >= 2) { - uint8x16_t d0 = vld1q_u8(buf), d1 = vld1q_u8(buf + 16); - uint16x8_t adler, sum2; - s2acc = vaddq_u32(s2acc, vshlq_n_u32(adacc, 5)); - adler = vpaddlq_u8( d0); - adler = vpadalq_u8(adler, d1); - sum2 = vmull_u8( vget_low_u8(t0), vget_low_u8(d0)); - sum2 = vmlal_u8(sum2, vget_high_u8(t0), vget_high_u8(d0)); - sum2 = vmlal_u8(sum2, vget_low_u8(t1), vget_low_u8(d1)); - sum2 = vmlal_u8(sum2, vget_high_u8(t1), vget_high_u8(d1)); - adacc = vpadalq_u16(adacc, adler); - s2acc = vpadalq_u16(s2acc, sum2); - len -= 2; - buf += 32; - } - - while (len > 0) { - uint8x16_t d0 = vld1q_u8(buf); - uint16x8_t adler, sum2; - s2acc = vaddq_u32(s2acc, vshlq_n_u32(adacc, 4)); - adler = vpaddlq_u8(d0); - sum2 = vmull_u8( vget_low_u8(t1), vget_low_u8(d0)); - sum2 = vmlal_u8(sum2, vget_high_u8(t1), vget_high_u8(d0)); - adacc = vpadalq_u16(adacc, adler); - s2acc = vpadalq_u16(s2acc, sum2); - buf += 16; - len--; - } - - adacc2 = vpadd_u32(vget_low_u32(adacc), vget_high_u32(adacc)); - s2acc2 = vpadd_u32(vget_low_u32(s2acc), vget_high_u32(s2acc)); - as = vpadd_u32(adacc2, s2acc2); - s[0] = vget_lane_u32(as, 0); - s[1] = vget_lane_u32(as, 1); -} - -static void NEON_handle_tail(uint32_t *pair, const unsigned char *buf, size_t len) { - unsigned int i; - for (i = 0; i < len; ++i) { - pair[0] += buf[i]; - pair[1] += pair[0]; - } -} - -uint32_t adler32_neon(uint32_t adler, const unsigned char *buf, size_t len) { - /* split Adler-32 into component sums */ - uint32_t sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (len == 1) - return adler32_len_1(adler, buf, sum2); - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (buf == NULL) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (len < 16) - return adler32_len_16(adler, buf, len, sum2); - - uint32_t pair[2]; - int n = NMAX; - unsigned int done = 0; - unsigned int i; - - /* Split Adler-32 into component sums, it can be supplied by - * the caller sites (e.g. in a PNG file). - */ - pair[0] = adler; - pair[1] = sum2; - - for (i = 0; i < len; i += n) { - if ((i + n) > len) - n = (int)(len - i); - - if (n < 16) - break; - - NEON_accum32(pair, buf + i, n / 16); - pair[0] %= BASE; - pair[1] %= BASE; - - done += (n / 16) * 16; - } - - /* Handle the tail elements. */ - if (done < len) { - NEON_handle_tail(pair, (buf + done), len - done); - pair[0] %= BASE; - pair[1] %= BASE; - } - - /* D = B * 65536 + A, see: https://en.wikipedia.org/wiki/Adler-32. */ - return (pair[1] << 16) | pair[0]; -} -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/arm/arm.h b/internal-complibs/zlib-ng-2.0.7/arch/arm/arm.h deleted file mode 100644 index 378006efb..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/arm/arm.h +++ /dev/null @@ -1,13 +0,0 @@ -/* arm.h -- check for ARM features. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef ARM_H_ -#define ARM_H_ - -extern int arm_cpu_has_neon; -extern int arm_cpu_has_crc32; - -void Z_INTERNAL arm_check_features(void); - -#endif /* ARM_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/arch/arm/crc32_acle.c b/internal-complibs/zlib-ng-2.0.7/arch/arm/crc32_acle.c deleted file mode 100644 index 37b1b98a2..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/arm/crc32_acle.c +++ /dev/null @@ -1,96 +0,0 @@ -/* crc32_acle.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler - * Copyright (C) 2016 Yang Zhang - * For conditions of distribution and use, see copyright notice in zlib.h - * -*/ - -#ifdef ARM_ACLE_CRC_HASH -#ifndef _MSC_VER -# include -#endif -#include "../../zutil.h" - -uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) { - Z_REGISTER uint32_t c; - Z_REGISTER const uint16_t *buf2; - Z_REGISTER const uint32_t *buf4; - - c = ~crc; - if (len && ((ptrdiff_t)buf & 1)) { - c = __crc32b(c, *buf++); - len--; - } - - if ((len >= sizeof(uint16_t)) && ((ptrdiff_t)buf & sizeof(uint16_t))) { - buf2 = (const uint16_t *) buf; - c = __crc32h(c, *buf2++); - len -= sizeof(uint16_t); - buf4 = (const uint32_t *) buf2; - } else { - buf4 = (const uint32_t *) buf; - } - -#if defined(__aarch64__) - if ((len >= sizeof(uint32_t)) && ((ptrdiff_t)buf & sizeof(uint32_t))) { - c = __crc32w(c, *buf4++); - len -= sizeof(uint32_t); - } - - if (len == 0) { - c = ~c; - return c; - } - - const uint64_t *buf8 = (const uint64_t *) buf4; - - while (len >= sizeof(uint64_t)) { - c = __crc32d(c, *buf8++); - len -= sizeof(uint64_t); - } - - if (len >= sizeof(uint32_t)) { - buf4 = (const uint32_t *) buf8; - c = __crc32w(c, *buf4++); - len -= sizeof(uint32_t); - buf2 = (const uint16_t *) buf4; - } else { - buf2 = (const uint16_t *) buf8; - } - - if (len >= sizeof(uint16_t)) { - c = __crc32h(c, *buf2++); - len -= sizeof(uint16_t); - } - - buf = (const unsigned char *) buf2; -#else /* __aarch64__ */ - - if (len == 0) { - c = ~c; - return c; - } - - while (len >= sizeof(uint32_t)) { - c = __crc32w(c, *buf4++); - len -= sizeof(uint32_t); - } - - if (len >= sizeof(uint16_t)) { - buf2 = (const uint16_t *) buf4; - c = __crc32h(c, *buf2++); - len -= sizeof(uint16_t); - buf = (const unsigned char *) buf2; - } else { - buf = (const unsigned char *) buf4; - } -#endif /* __aarch64__ */ - - if (len) { - c = __crc32b(c, *buf); - } - - c = ~c; - return c; -} -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/arm/ctzl.h b/internal-complibs/zlib-ng-2.0.7/arch/arm/ctzl.h deleted file mode 100644 index 77218deec..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/arm/ctzl.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef ARM_CTZL_H -#define ARM_CTZL_H - -#include - -#if defined(_MSC_VER) && !defined(__clang__) -static __forceinline unsigned long __builtin_ctzl(unsigned long value) { - return _arm_clz(_arm_rbit(value)); -} -#endif - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/arm/insert_string_acle.c b/internal-complibs/zlib-ng-2.0.7/arch/arm/insert_string_acle.c deleted file mode 100644 index 2daf9ba3e..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/arm/insert_string_acle.c +++ /dev/null @@ -1,22 +0,0 @@ -/* insert_string_acle.c -- insert_string variant using ACLE's CRC instructions - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - */ - -#ifdef ARM_ACLE_CRC_HASH -#ifndef _MSC_VER -# include -#endif -#include "../../zbuild.h" -#include "../../deflate.h" - -#define UPDATE_HASH(s, h, val) \ - h = __crc32w(0, val) - -#define INSERT_STRING insert_string_acle -#define QUICK_INSERT_STRING quick_insert_string_acle - -#include "../../insert_string_tpl.h" -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/arm/slide_neon.c b/internal-complibs/zlib-ng-2.0.7/arch/arm/slide_neon.c deleted file mode 100644 index f64fa5b5b..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/arm/slide_neon.c +++ /dev/null @@ -1,52 +0,0 @@ -/* slide_neon.c -- Optimized hash table shifting for ARM with support for NEON instructions - * Copyright (C) 2017-2020 Mika T. Lindqvist - * - * Authors: - * Mika T. Lindqvist - * Jun He - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#if defined(ARM_NEON_SLIDEHASH) -#ifdef _M_ARM64 -# include -#else -# include -#endif -#include "../../zbuild.h" -#include "../../deflate.h" - -/* SIMD version of hash_chain rebase */ -static inline void slide_hash_chain(Pos *table, unsigned int entries, uint16_t window_size) { - Z_REGISTER uint16x8_t v, *p; - Z_REGISTER size_t n; - - size_t size = entries*sizeof(table[0]); - Assert((size % sizeof(uint16x8_t) * 8 == 0), "hash table size err"); - - Assert(sizeof(Pos) == 2, "Wrong Pos size"); - v = vdupq_n_u16(window_size); - - p = (uint16x8_t *)table; - n = size / (sizeof(uint16x8_t) * 8); - do { - p[0] = vqsubq_u16(p[0], v); - p[1] = vqsubq_u16(p[1], v); - p[2] = vqsubq_u16(p[2], v); - p[3] = vqsubq_u16(p[3], v); - p[4] = vqsubq_u16(p[4], v); - p[5] = vqsubq_u16(p[5], v); - p[6] = vqsubq_u16(p[6], v); - p[7] = vqsubq_u16(p[7], v); - p += 8; - } while (--n); -} - -Z_INTERNAL void slide_hash_neon(deflate_state *s) { - unsigned int wsize = s->w_size; - - slide_hash_chain(s->head, HASH_SIZE, wsize); - slide_hash_chain(s->prev, wsize, wsize); -} -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/generic/Makefile.in b/internal-complibs/zlib-ng-2.0.7/arch/generic/Makefile.in deleted file mode 100644 index be8c18545..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/generic/Makefile.in +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler -# For conditions of distribution and use, see copyright notice in zlib.h - -CC= -CFLAGS= -SFLAGS= -INCLUDES= - -SRCDIR=. -SRCTOP=../.. -TOPDIR=$(SRCTOP) - -all: - - -mostlyclean: clean -clean: - rm -f *.o *.lo *~ \ - rm -rf objs - rm -f *.gcda *.gcno *.gcov diff --git a/internal-complibs/zlib-ng-2.0.7/arch/power/Makefile.in b/internal-complibs/zlib-ng-2.0.7/arch/power/Makefile.in deleted file mode 100644 index cf5839b93..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/power/Makefile.in +++ /dev/null @@ -1,50 +0,0 @@ -# Makefile for POWER-specific files -# Copyright (C) 2020 Matheus Castanho , IBM -# For conditions of distribution and use, see copyright notice in zlib.h - -CC= -CFLAGS= -SFLAGS= -INCLUDES= -SUFFIX= - -P8FLAGS=-mcpu=power8 -NOLTOFLAG= - -SRCDIR=. -SRCTOP=../.. -TOPDIR=$(SRCTOP) - -all: power.o \ - power.lo \ - adler32_power8.o \ - adler32_power8.lo \ - slide_hash_power8.o \ - slide_hash_power8.lo - -power.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/power.c - -power.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/power.c - -adler32_power8.o: - $(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_power8.c - -adler32_power8.lo: - $(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_power8.c - -slide_hash_power8.o: - $(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_power8.c - -slide_hash_power8.lo: - $(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_power8.c - -mostlyclean: clean -clean: - rm -f *.o *.lo *~ - rm -rf objs - rm -f *.gcda *.gcno *.gcov - -distclean: - rm -f Makefile diff --git a/internal-complibs/zlib-ng-2.0.7/arch/power/power.c b/internal-complibs/zlib-ng-2.0.7/arch/power/power.c deleted file mode 100644 index f93b586d5..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/power/power.c +++ /dev/null @@ -1,19 +0,0 @@ -/* POWER feature check - * Copyright (C) 2020 Matheus Castanho , IBM - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include -#include "../../zutil.h" - -Z_INTERNAL int power_cpu_has_arch_2_07; - -void Z_INTERNAL power_check_features(void) { - unsigned long hwcap2; - hwcap2 = getauxval(AT_HWCAP2); - -#ifdef POWER8 - if (hwcap2 & PPC_FEATURE2_ARCH_2_07) - power_cpu_has_arch_2_07 = 1; -#endif -} diff --git a/internal-complibs/zlib-ng-2.0.7/arch/power/power.h b/internal-complibs/zlib-ng-2.0.7/arch/power/power.h deleted file mode 100644 index b36c26141..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/power/power.h +++ /dev/null @@ -1,13 +0,0 @@ -/* power.h -- check for POWER CPU features - * Copyright (C) 2020 Matheus Castanho , IBM - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef POWER_H_ -#define POWER_H_ - -extern int power_cpu_has_arch_2_07; - -void Z_INTERNAL power_check_features(void); - -#endif /* POWER_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/arch/power/slide_hash_power8.c b/internal-complibs/zlib-ng-2.0.7/arch/power/slide_hash_power8.c deleted file mode 100644 index b1e30cea0..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/power/slide_hash_power8.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Optimized slide_hash for POWER processors - * Copyright (C) 2019-2020 IBM Corporation - * Author: Matheus Castanho - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifdef POWER8_VSX_SLIDEHASH - -#include -#include "zbuild.h" -#include "deflate.h" - -static inline void slide_hash_power8_loop(deflate_state *s, unsigned n_elems, Pos *table_end) { - vector unsigned short vw, vm, *vp; - unsigned chunks; - - /* Each vector register (chunk) corresponds to 128 bits == 8 Posf, - * so instead of processing each of the n_elems in the hash table - * individually, we can do it in chunks of 8 with vector instructions. - * - * This function is only called from slide_hash_power8(), and both calls - * pass n_elems as a power of 2 higher than 2^7, as defined by - * deflateInit2_(), so n_elems will always be a multiple of 8. */ - chunks = n_elems >> 3; - Assert(n_elems % 8 == 0, "Weird hash table size!"); - - /* This type casting is safe since s->w_size is always <= 64KB - * as defined by deflateInit2_() and Posf == unsigned short */ - vw[0] = (Pos) s->w_size; - vw = vec_splat(vw,0); - - vp = (vector unsigned short *) table_end; - - do { - /* Processing 8 elements at a time */ - vp--; - vm = *vp; - - /* This is equivalent to: m >= w_size ? m - w_size : 0 - * Since we are using a saturated unsigned subtraction, any - * values that are > w_size will be set to 0, while the others - * will be subtracted by w_size. */ - *vp = vec_subs(vm,vw); - } while (--chunks); -} - -void Z_INTERNAL slide_hash_power8(deflate_state *s) { - unsigned int n; - Pos *p; - - n = HASH_SIZE; - p = &s->head[n]; - slide_hash_power8_loop(s,n,p); - - n = s->w_size; - p = &s->prev[n]; - slide_hash_power8_loop(s,n,p); -} - -#endif /* POWER8_VSX_SLIDEHASH */ diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_common.c b/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_common.c deleted file mode 100644 index f1ae904ad..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_common.c +++ /dev/null @@ -1,89 +0,0 @@ -/* dfltcc_deflate.c - IBM Z DEFLATE CONVERSION CALL general support. */ - -#include "zbuild.h" -#include "dfltcc_common.h" -#include "dfltcc_detail.h" - -/* - Memory management. - - DFLTCC requires parameter blocks and window to be aligned. zlib-ng allows - users to specify their own allocation functions, so using e.g. - `posix_memalign' is not an option. Thus, we overallocate and take the - aligned portion of the buffer. -*/ -static inline int is_dfltcc_enabled(void) { - uint64_t facilities[(DFLTCC_FACILITY / 64) + 1]; - Z_REGISTER uint8_t r0 __asm__("r0"); - - memset(facilities, 0, sizeof(facilities)); - r0 = sizeof(facilities) / sizeof(facilities[0]) - 1; - /* STFLE is supported since z9-109 and only in z/Architecture mode. When - * compiling with -m31, gcc defaults to ESA mode, however, since the kernel - * is 64-bit, it's always z/Architecture mode at runtime. - */ - __asm__ volatile( -#ifndef __clang__ - ".machinemode push\n" - ".machinemode zarch\n" -#endif - "stfle %[facilities]\n" -#ifndef __clang__ - ".machinemode pop\n" -#endif - : [facilities] "=Q" (facilities), [r0] "+r" (r0) :: "cc"); - return is_bit_set((const char *)facilities, DFLTCC_FACILITY); -} - -void Z_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size) { - struct dfltcc_state *dfltcc_state = (struct dfltcc_state *)((char *)strm->state + ALIGN_UP(size, 8)); - struct dfltcc_qaf_param *param = (struct dfltcc_qaf_param *)&dfltcc_state->param; - - /* Initialize available functions */ - if (is_dfltcc_enabled()) { - dfltcc(DFLTCC_QAF, param, NULL, NULL, NULL, NULL, NULL); - memmove(&dfltcc_state->af, param, sizeof(dfltcc_state->af)); - } else - memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af)); - - /* Initialize parameter block */ - memset(&dfltcc_state->param, 0, sizeof(dfltcc_state->param)); - dfltcc_state->param.nt = 1; - - /* Initialize tuning parameters */ - dfltcc_state->level_mask = DFLTCC_LEVEL_MASK; - dfltcc_state->block_size = DFLTCC_BLOCK_SIZE; - dfltcc_state->block_threshold = DFLTCC_FIRST_FHT_BLOCK_SIZE; - dfltcc_state->dht_threshold = DFLTCC_DHT_MIN_SAMPLE_SIZE; - dfltcc_state->param.ribm = DFLTCC_RIBM; -} - -void Z_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size) { - return ZALLOC(strm, ALIGN_UP(items * size, 8) + sizeof(struct dfltcc_state), sizeof(unsigned char)); -} - -void Z_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size) { - memcpy(dst, src, ALIGN_UP(size, 8) + sizeof(struct dfltcc_state)); -} - -static const int PAGE_ALIGN = 0x1000; - -void Z_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size) { - void *p; - void *w; - - /* To simplify freeing, we store the pointer to the allocated buffer right - * before the window. - */ - p = ZALLOC(strm, sizeof(void *) + items * size + PAGE_ALIGN, sizeof(unsigned char)); - if (p == NULL) - return NULL; - w = ALIGN_UP((char *)p + sizeof(void *), PAGE_ALIGN); - *(void **)((char *)w - sizeof(void *)) = p; - return w; -} - -void Z_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w) { - if (w) - ZFREE(strm, *(void **)((unsigned char *)w - sizeof(void *))); -} diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_common.h b/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_common.h deleted file mode 100644 index 6de8bb18f..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_common.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef DFLTCC_COMMON_H -#define DFLTCC_COMMON_H - -#ifdef ZLIB_COMPAT -#include "zlib.h" -#else -#include "zlib-ng.h" -#endif -#include "zutil.h" - -void Z_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size); -void Z_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size); -void Z_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size); -void Z_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size); -void Z_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w); - -#define ZALLOC_STATE dfltcc_alloc_state - -#define ZFREE_STATE ZFREE - -#define ZCOPY_STATE dfltcc_copy_state - -#define ZALLOC_WINDOW dfltcc_alloc_window - -#define ZFREE_WINDOW dfltcc_free_window - -#define TRY_FREE_WINDOW dfltcc_free_window - -#define DFLTCC_BLOCK_HEADER_BITS 3 -#define DFLTCC_HLITS_COUNT_BITS 5 -#define DFLTCC_HDISTS_COUNT_BITS 5 -#define DFLTCC_HCLENS_COUNT_BITS 4 -#define DFLTCC_MAX_HCLENS 19 -#define DFLTCC_HCLEN_BITS 3 -#define DFLTCC_MAX_HLITS 286 -#define DFLTCC_MAX_HDISTS 30 -#define DFLTCC_MAX_HLIT_HDIST_BITS 7 -#define DFLTCC_MAX_SYMBOL_BITS 16 -#define DFLTCC_MAX_EOBS_BITS 15 -#define DFLTCC_MAX_PADDING_BITS 7 - -#define DEFLATE_BOUND_COMPLEN(source_len) \ - ((DFLTCC_BLOCK_HEADER_BITS + \ - DFLTCC_HLITS_COUNT_BITS + \ - DFLTCC_HDISTS_COUNT_BITS + \ - DFLTCC_HCLENS_COUNT_BITS + \ - DFLTCC_MAX_HCLENS * DFLTCC_HCLEN_BITS + \ - (DFLTCC_MAX_HLITS + DFLTCC_MAX_HDISTS) * DFLTCC_MAX_HLIT_HDIST_BITS + \ - (source_len) * DFLTCC_MAX_SYMBOL_BITS + \ - DFLTCC_MAX_EOBS_BITS + \ - DFLTCC_MAX_PADDING_BITS) >> 3) - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_deflate.h b/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_deflate.h deleted file mode 100644 index 218e59469..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_deflate.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef DFLTCC_DEFLATE_H -#define DFLTCC_DEFLATE_H - -#include "dfltcc_common.h" - -int Z_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm); -int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result); -int Z_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush); -int Z_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush); -int Z_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible); -int Z_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm, - const unsigned char *dictionary, uInt dict_length); -int Z_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length); - -#define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \ - do { \ - if (dfltcc_can_deflate((strm))) \ - return dfltcc_deflate_set_dictionary((strm), (dict), (dict_len)); \ - } while (0) - -#define DEFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) \ - do { \ - if (dfltcc_can_deflate((strm))) \ - return dfltcc_deflate_get_dictionary((strm), (dict), (dict_len)); \ - } while (0) - -#define DEFLATE_RESET_KEEP_HOOK(strm) \ - dfltcc_reset((strm), sizeof(deflate_state)) - -#define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) \ - do { \ - int err; \ -\ - err = dfltcc_deflate_params((strm), (level), (strategy), (hook_flush)); \ - if (err == Z_STREAM_ERROR) \ - return err; \ - } while (0) - -#define DEFLATE_DONE dfltcc_deflate_done - -#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, source_len) \ - do { \ - if (dfltcc_can_deflate((strm))) \ - (complen) = DEFLATE_BOUND_COMPLEN(source_len); \ - } while (0) - -#define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) (dfltcc_can_deflate((strm))) - -#define DEFLATE_HOOK dfltcc_deflate - -#define DEFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_deflate((strm))) - -#define DEFLATE_CAN_SET_REPRODUCIBLE dfltcc_can_set_reproducible - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_detail.h b/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_detail.h deleted file mode 100644 index 411e9f6c7..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_detail.h +++ /dev/null @@ -1,229 +0,0 @@ -#include -#include -#include - -#ifdef HAVE_SYS_SDT_H -#include -#endif - -/* - Tuning parameters. - */ -#ifndef DFLTCC_LEVEL_MASK -#define DFLTCC_LEVEL_MASK 0x2 -#endif -#ifndef DFLTCC_BLOCK_SIZE -#define DFLTCC_BLOCK_SIZE 1048576 -#endif -#ifndef DFLTCC_FIRST_FHT_BLOCK_SIZE -#define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096 -#endif -#ifndef DFLTCC_DHT_MIN_SAMPLE_SIZE -#define DFLTCC_DHT_MIN_SAMPLE_SIZE 4096 -#endif -#ifndef DFLTCC_RIBM -#define DFLTCC_RIBM 0 -#endif - -/* - Parameter Block for Query Available Functions. - */ -#define static_assert(c, msg) __attribute__((unused)) static char static_assert_failed_ ## msg[c ? 1 : -1] - -struct dfltcc_qaf_param { - char fns[16]; - char reserved1[8]; - char fmts[2]; - char reserved2[6]; -}; - -#define DFLTCC_SIZEOF_QAF 32 -static_assert(sizeof(struct dfltcc_qaf_param) == DFLTCC_SIZEOF_QAF, qaf); - -static inline int is_bit_set(const char *bits, int n) { - return bits[n / 8] & (1 << (7 - (n % 8))); -} - -static inline void clear_bit(char *bits, int n) { - bits[n / 8] &= ~(1 << (7 - (n % 8))); -} - -#define DFLTCC_FACILITY 151 - -#define DFLTCC_FMT0 0 - -/* - Parameter Block for Generate Dynamic-Huffman Table, Compress and Expand. - */ -#define CVT_CRC32 0 -#define CVT_ADLER32 1 -#define HTT_FIXED 0 -#define HTT_DYNAMIC 1 - -struct dfltcc_param_v0 { - uint16_t pbvn; /* Parameter-Block-Version Number */ - uint8_t mvn; /* Model-Version Number */ - uint8_t ribm; /* Reserved for IBM use */ - uint32_t reserved32 : 31; - uint32_t cf : 1; /* Continuation Flag */ - uint8_t reserved64[8]; - uint32_t nt : 1; /* New Task */ - uint32_t reserved129 : 1; - uint32_t cvt : 1; /* Check Value Type */ - uint32_t reserved131 : 1; - uint32_t htt : 1; /* Huffman-Table Type */ - uint32_t bcf : 1; /* Block-Continuation Flag */ - uint32_t bcc : 1; /* Block Closing Control */ - uint32_t bhf : 1; /* Block Header Final */ - uint32_t reserved136 : 1; - uint32_t reserved137 : 1; - uint32_t dhtgc : 1; /* DHT Generation Control */ - uint32_t reserved139 : 5; - uint32_t reserved144 : 5; - uint32_t sbb : 3; /* Sub-Byte Boundary */ - uint8_t oesc; /* Operation-Ending-Supplemental Code */ - uint32_t reserved160 : 12; - uint32_t ifs : 4; /* Incomplete-Function Status */ - uint16_t ifl; /* Incomplete-Function Length */ - uint8_t reserved192[8]; - uint8_t reserved256[8]; - uint8_t reserved320[4]; - uint16_t hl; /* History Length */ - uint32_t reserved368 : 1; - uint16_t ho : 15; /* History Offset */ - uint32_t cv; /* Check Value */ - uint32_t eobs : 15; /* End-of-block Symbol */ - uint32_t reserved431: 1; - uint8_t eobl : 4; /* End-of-block Length */ - uint32_t reserved436 : 12; - uint32_t reserved448 : 4; - uint16_t cdhtl : 12; /* Compressed-Dynamic-Huffman Table - Length */ - uint8_t reserved464[6]; - uint8_t cdht[288]; /* Compressed-Dynamic-Huffman Table */ - uint8_t reserved[24]; - uint8_t ribm2[8]; /* Reserved for IBM use */ - uint8_t csb[1152]; /* Continuation-State Buffer */ -}; - -#define DFLTCC_SIZEOF_GDHT_V0 384 -#define DFLTCC_SIZEOF_CMPR_XPND_V0 1536 -static_assert(offsetof(struct dfltcc_param_v0, csb) == DFLTCC_SIZEOF_GDHT_V0, gdht_v0); -static_assert(sizeof(struct dfltcc_param_v0) == DFLTCC_SIZEOF_CMPR_XPND_V0, cmpr_xpnd_v0); - -static inline z_const char *oesc_msg(char *buf, int oesc) { - if (oesc == 0x00) - return NULL; /* Successful completion */ - else { - sprintf(buf, "Operation-Ending-Supplemental Code is 0x%.2X", oesc); - return buf; - } -} - -/* - C wrapper for the DEFLATE CONVERSION CALL instruction. - */ -typedef enum { - DFLTCC_CC_OK = 0, - DFLTCC_CC_OP1_TOO_SHORT = 1, - DFLTCC_CC_OP2_TOO_SHORT = 2, - DFLTCC_CC_OP2_CORRUPT = 2, - DFLTCC_CC_AGAIN = 3, -} dfltcc_cc; - -#define DFLTCC_QAF 0 -#define DFLTCC_GDHT 1 -#define DFLTCC_CMPR 2 -#define DFLTCC_XPND 4 -#define HBT_CIRCULAR (1 << 7) -#define DFLTCC_FN_MASK ((1 << 7) - 1) -#define HB_BITS 15 -#define HB_SIZE (1 << HB_BITS) - -static inline dfltcc_cc dfltcc(int fn, void *param, - unsigned char **op1, size_t *len1, - z_const unsigned char **op2, size_t *len2, void *hist) { - unsigned char *t2 = op1 ? *op1 : NULL; -#ifdef Z_MEMORY_SANITIZER - unsigned char *orig_t2 = t2; -#endif - size_t t3 = len1 ? *len1 : 0; - z_const unsigned char *t4 = op2 ? *op2 : NULL; - size_t t5 = len2 ? *len2 : 0; - Z_REGISTER int r0 __asm__("r0") = fn; - Z_REGISTER void *r1 __asm__("r1") = param; - Z_REGISTER unsigned char *r2 __asm__("r2") = t2; - Z_REGISTER size_t r3 __asm__("r3") = t3; - Z_REGISTER z_const unsigned char *r4 __asm__("r4") = t4; - Z_REGISTER size_t r5 __asm__("r5") = t5; - int cc; - - __asm__ volatile( -#ifdef HAVE_SYS_SDT_H - STAP_PROBE_ASM(zlib, dfltcc_entry, STAP_PROBE_ASM_TEMPLATE(5)) -#endif - ".insn rrf,0xb9390000,%[r2],%[r4],%[hist],0\n" -#ifdef HAVE_SYS_SDT_H - STAP_PROBE_ASM(zlib, dfltcc_exit, STAP_PROBE_ASM_TEMPLATE(5)) -#endif - "ipm %[cc]\n" - : [r2] "+r" (r2) - , [r3] "+r" (r3) - , [r4] "+r" (r4) - , [r5] "+r" (r5) - , [cc] "=r" (cc) - : [r0] "r" (r0) - , [r1] "r" (r1) - , [hist] "r" (hist) -#ifdef HAVE_SYS_SDT_H - , STAP_PROBE_ASM_OPERANDS(5, r2, r3, r4, r5, hist) -#endif - : "cc", "memory"); - t2 = r2; t3 = r3; t4 = r4; t5 = r5; - -#ifdef Z_MEMORY_SANITIZER - switch (fn & DFLTCC_FN_MASK) { - case DFLTCC_QAF: - __msan_unpoison(param, DFLTCC_SIZEOF_QAF); - break; - case DFLTCC_GDHT: - __msan_unpoison(param, DFLTCC_SIZEOF_GDHT_V0); - break; - case DFLTCC_CMPR: - __msan_unpoison(param, DFLTCC_SIZEOF_CMPR_XPND_V0); - __msan_unpoison(orig_t2, t2 - orig_t2 + (((struct dfltcc_param_v0 *)param)->sbb == 0 ? 0 : 1)); - break; - case DFLTCC_XPND: - __msan_unpoison(param, DFLTCC_SIZEOF_CMPR_XPND_V0); - __msan_unpoison(orig_t2, t2 - orig_t2); - break; - } -#endif - - if (op1) - *op1 = t2; - if (len1) - *len1 = t3; - if (op2) - *op2 = t4; - if (len2) - *len2 = t5; - return (cc >> 28) & 3; -} - -/* - Extension of inflate_state and deflate_state. Must be doubleword-aligned. -*/ -struct dfltcc_state { - struct dfltcc_param_v0 param; /* Parameter block. */ - struct dfltcc_qaf_param af; /* Available functions. */ - uint16_t level_mask; /* Levels on which to use DFLTCC */ - uint32_t block_size; /* New block each X bytes */ - size_t block_threshold; /* New block after total_in > X */ - uint32_t dht_threshold; /* New block only if avail_in >= X */ - char msg[64]; /* Buffer for strm->msg */ -}; - -#define ALIGN_UP(p, size) (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1)) - -#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((char *)(state) + ALIGN_UP(sizeof(*state), 8))) diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_inflate.h b/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_inflate.h deleted file mode 100644 index fc8a000f7..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_inflate.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef DFLTCC_INFLATE_H -#define DFLTCC_INFLATE_H - -#include "dfltcc_common.h" - -int Z_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm); -typedef enum { - DFLTCC_INFLATE_CONTINUE, - DFLTCC_INFLATE_BREAK, - DFLTCC_INFLATE_SOFTWARE, -} dfltcc_inflate_action; -dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret); -int Z_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm); -int Z_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm); - -#define INFLATE_RESET_KEEP_HOOK(strm) \ - dfltcc_reset((strm), sizeof(struct inflate_state)) - -#define INFLATE_PRIME_HOOK(strm, bits, value) \ - do { if (dfltcc_inflate_disable((strm))) return Z_STREAM_ERROR; } while (0) - -#define INFLATE_TYPEDO_HOOK(strm, flush) \ - if (dfltcc_can_inflate((strm))) { \ - dfltcc_inflate_action action; \ -\ - RESTORE(); \ - action = dfltcc_inflate((strm), (flush), &ret); \ - LOAD(); \ - if (action == DFLTCC_INFLATE_CONTINUE) \ - break; \ - else if (action == DFLTCC_INFLATE_BREAK) \ - goto inf_leave; \ - } - -#define INFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_inflate((strm))) - -#define INFLATE_NEED_UPDATEWINDOW(strm) (!dfltcc_can_inflate((strm))) - -#define INFLATE_MARK_HOOK(strm) \ - do { \ - if (dfltcc_was_inflate_used((strm))) return -(1L << 16); \ - } while (0) - -#define INFLATE_SYNC_POINT_HOOK(strm) \ - do { \ - if (dfltcc_was_inflate_used((strm))) return Z_STREAM_ERROR; \ - } while (0) - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/actions-runner.Dockerfile b/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/actions-runner.Dockerfile deleted file mode 100644 index a55a74df4..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/actions-runner.Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -# Self-Hosted IBM Z Github Actions Runner. - -# Temporary image: amd64 dependencies. -FROM amd64/ubuntu:20.04 as ld-prefix -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get -y install ca-certificates libicu66 libssl1.1 - -# Main image. -FROM s390x/ubuntu:20.04 - -# Packages for zlib-ng testing. -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get -y install \ - clang-11 \ - cmake \ - curl \ - gcc \ - git \ - jq \ - llvm-11-tools \ - ninja-build \ - python-is-python3 \ - python3 \ - python3-pip - -# amd64 dependencies. -COPY --from=ld-prefix / /usr/x86_64-linux-gnu/ -RUN ln -fs ../lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /usr/x86_64-linux-gnu/lib64/ -RUN ln -fs /etc/resolv.conf /usr/x86_64-linux-gnu/etc/ -ENV QEMU_LD_PREFIX=/usr/x86_64-linux-gnu - -# amd64 Github Actions Runner. -RUN useradd -m actions-runner -USER actions-runner -WORKDIR /home/actions-runner -RUN curl -L https://github.com/actions/runner/releases/download/v2.283.2/actions-runner-linux-x64-2.283.2.tar.gz | tar -xz -VOLUME /home/actions-runner - -# Scripts. -COPY fs/ / -ENTRYPOINT ["/usr/bin/entrypoint"] -CMD ["/usr/bin/actions-runner"] diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/actions-runner.service b/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/actions-runner.service deleted file mode 100644 index 1d3129ff5..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/actions-runner.service +++ /dev/null @@ -1,23 +0,0 @@ -[Unit] -Description=Self-Hosted IBM Z Github Actions Runner -Wants=qemu-user-static -After=qemu-user-static -StartLimitIntervalSec=0 - -[Service] -Type=simple -Restart=always -ExecStart=/usr/bin/docker run \ - --env-file=/etc/actions-runner \ - --init \ - --interactive \ - --name=actions-runner \ - --rm \ - --volume=actions-runner:/home/actions-runner \ - iiilinuxibmcom/actions-runner -ExecStop=/bin/sh -c "docker exec actions-runner kill -INT -- -1" -ExecStop=/bin/sh -c "docker wait actions-runner" -ExecStop=/bin/sh -c "docker rm actions-runner" - -[Install] -WantedBy=multi-user.target diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/qemu-user-static.service b/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/qemu-user-static.service deleted file mode 100644 index 301f3edd9..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/qemu-user-static.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Support for transparent execution of non-native binaries with QEMU user emulation - -[Service] -Type=oneshot -# The source code for iiilinuxibmcom/qemu-user-static is at https://github.com/iii-i/qemu-user-static/tree/v6.1.0-1 -# TODO: replace it with multiarch/qemu-user-static once version >6.1 is available -ExecStart=/usr/bin/docker run --rm --interactive --privileged iiilinuxibmcom/qemu-user-static --reset -p yes - -[Install] -WantedBy=multi-user.target diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/INDEX.md b/internal-complibs/zlib-ng-2.0.7/arch/x86/INDEX.md deleted file mode 100644 index 8bf6d08e5..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/INDEX.md +++ /dev/null @@ -1,8 +0,0 @@ -Contents --------- - -|Name|Description| -|:-|:-| -|deflate_quick.c|SSE4 optimized deflate strategy for use as level 1| -|crc_folding.c|SSE4 + PCLMULQDQ optimized CRC folding implementation| -|slide_sse2.c|SSE2 optimized slide_hash| diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/Makefile.in b/internal-complibs/zlib-ng-2.0.7/arch/x86/Makefile.in deleted file mode 100644 index 13c736c63..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/Makefile.in +++ /dev/null @@ -1,108 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler -# For conditions of distribution and use, see copyright notice in zlib.h - -CC= -CFLAGS= -SFLAGS= -INCLUDES= -SUFFIX= - -AVX2FLAG=-mavx2 -SSE2FLAG=-msse2 -SSSE3FLAG=-mssse3 -SSE4FLAG=-msse4 -PCLMULFLAG=-mpclmul -NOLTOFLAG= - -SRCDIR=. -SRCTOP=../.. -TOPDIR=$(SRCTOP) - -all: \ - x86.o x86.lo \ - adler32_avx.o adler32.lo \ - adler32_ssse3.o adler32_ssse3.lo \ - chunkset_avx.o chunkset_avx.lo \ - chunkset_sse.o chunkset_sse.lo \ - compare258_avx.o compare258_avx.lo \ - compare258_sse.o compare258_sse.lo \ - insert_string_sse.o insert_string_sse.lo \ - crc_folding.o crc_folding.lo \ - slide_avx.o slide_avx.lo \ - slide_sse.o slide_sse.lo - -x86.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/x86.c - -x86.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/x86.c - -chunkset_avx.o: - $(CC) $(CFLAGS) $(AVX2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_avx.c - -chunkset_avx.lo: - $(CC) $(SFLAGS) $(AVX2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_avx.c - -chunkset_sse.o: - $(CC) $(CFLAGS) $(SSE2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_sse.c - -chunkset_sse.lo: - $(CC) $(SFLAGS) $(SSE2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_sse.c - -compare258_avx.o: - $(CC) $(CFLAGS) $(AVX2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/compare258_avx.c - -compare258_avx.lo: - $(CC) $(SFLAGS) $(AVX2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/compare258_avx.c - -compare258_sse.o: - $(CC) $(CFLAGS) $(SSE4FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/compare258_sse.c - -compare258_sse.lo: - $(CC) $(SFLAGS) $(SSE4FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/compare258_sse.c - -insert_string_sse.o: - $(CC) $(CFLAGS) $(SSE4FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_sse.c - -insert_string_sse.lo: - $(CC) $(SFLAGS) $(SSE4FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_sse.c - -crc_folding.o: - $(CC) $(CFLAGS) $(PCLMULFLAG) $(SSE4FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc_folding.c - -crc_folding.lo: - $(CC) $(SFLAGS) $(PCLMULFLAG) $(SSE4FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/crc_folding.c - -slide_avx.o: - $(CC) $(CFLAGS) $(AVX2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_avx.c - -slide_avx.lo: - $(CC) $(SFLAGS) $(AVX2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/slide_avx.c - -slide_sse.o: - $(CC) $(CFLAGS) $(SSE2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_sse.c - -slide_sse.lo: - $(CC) $(SFLAGS) $(SSE2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/slide_sse.c - -adler32_avx.o: $(SRCDIR)/adler32_avx.c - $(CC) $(CFLAGS) $(AVX2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_avx.c - -adler32_avx.lo: $(SRCDIR)/adler32_avx.c - $(CC) $(SFLAGS) $(AVX2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_avx.c - -adler32_ssse3.o: $(SRCDIR)/adler32_ssse3.c - $(CC) $(CFLAGS) $(SSSE3FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_ssse3.c - -adler32_ssse3.lo: $(SRCDIR)/adler32_ssse3.c - $(CC) $(SFLAGS) $(SSSE3FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_ssse3.c - -mostlyclean: clean -clean: - rm -f *.o *.lo *~ - rm -rf objs - rm -f *.gcda *.gcno *.gcov - -distclean: - rm -f Makefile diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/adler32_avx.c b/internal-complibs/zlib-ng-2.0.7/arch/x86/adler32_avx.c deleted file mode 100644 index 106324654..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/adler32_avx.c +++ /dev/null @@ -1,117 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2011 Mark Adler - * Authors: - * Brian Bockelman - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "../../zbuild.h" -#include "../../zutil.h" - -#include "../../adler32_p.h" - -#include - -#ifdef X86_AVX2_ADLER32 - -Z_INTERNAL uint32_t adler32_avx2(uint32_t adler, const unsigned char *buf, size_t len) { - uint32_t sum2; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (UNLIKELY(len == 1)) - return adler32_len_1(adler, buf, sum2); - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (UNLIKELY(buf == NULL)) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (UNLIKELY(len < 16)) - return adler32_len_16(adler, buf, len, sum2); - - uint32_t ALIGNED_(32) s1[8], s2[8]; - - memset(s1, 0, sizeof(s1)); s1[7] = adler; // TODO: would a masked load be faster? - memset(s2, 0, sizeof(s2)); s2[7] = sum2; - - char ALIGNED_(32) dot1[32] = \ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - __m256i dot1v = _mm256_load_si256((__m256i*)dot1); - char ALIGNED_(32) dot2[32] = \ - {32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, - 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - __m256i dot2v = _mm256_load_si256((__m256i*)dot2); - short ALIGNED_(32) dot3[16] = \ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - __m256i dot3v = _mm256_load_si256((__m256i*)dot3); - - // We will need to multiply by - char ALIGNED_(32) shift[16] = {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - __m128i shiftv = _mm_load_si128((__m128i*)shift); - - while (len >= 32) { - __m256i vs1 = _mm256_load_si256((__m256i*)s1); - __m256i vs2 = _mm256_load_si256((__m256i*)s2); - __m256i vs1_0 = vs1; - - int k = (len < NMAX ? (int)len : NMAX); - k -= k % 32; - len -= k; - - while (k >= 32) { - /* - vs1 = adler + sum(c[i]) - vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] ) - */ - __m256i vbuf = _mm256_loadu_si256((__m256i*)buf); - buf += 32; - k -= 32; - - __m256i v_short_sum1 = _mm256_maddubs_epi16(vbuf, dot1v); // multiply-add, resulting in 8 shorts. - __m256i vsum1 = _mm256_madd_epi16(v_short_sum1, dot3v); // sum 8 shorts to 4 int32_t; - __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v); - vs1 = _mm256_add_epi32(vsum1, vs1); - __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); - vs1_0 = _mm256_sll_epi32(vs1_0, shiftv); - vsum2 = _mm256_add_epi32(vsum2, vs2); - vs2 = _mm256_add_epi32(vsum2, vs1_0); - vs1_0 = vs1; - } - - // At this point, we have partial sums stored in vs1 and vs2. There are AVX512 instructions that - // would allow us to sum these quickly (VP4DPWSSD). For now, just unpack and move on. - uint32_t ALIGNED_(32) s1_unpack[8]; - uint32_t ALIGNED_(32) s2_unpack[8]; - - _mm256_store_si256((__m256i*)s1_unpack, vs1); - _mm256_store_si256((__m256i*)s2_unpack, vs2); - - adler = (s1_unpack[0] % BASE) + (s1_unpack[1] % BASE) + (s1_unpack[2] % BASE) + (s1_unpack[3] % BASE) + - (s1_unpack[4] % BASE) + (s1_unpack[5] % BASE) + (s1_unpack[6] % BASE) + (s1_unpack[7] % BASE); - adler %= BASE; - s1[7] = adler; - - sum2 = (s2_unpack[0] % BASE) + (s2_unpack[1] % BASE) + (s2_unpack[2] % BASE) + (s2_unpack[3] % BASE) + - (s2_unpack[4] % BASE) + (s2_unpack[5] % BASE) + (s2_unpack[6] % BASE) + (s2_unpack[7] % BASE); - sum2 %= BASE; - s2[7] = sum2; - } - - while (len) { - len--; - adler += *buf++; - sum2 += adler; - } - adler %= BASE; - sum2 %= BASE; - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/adler32_ssse3.c b/internal-complibs/zlib-ng-2.0.7/arch/x86/adler32_ssse3.c deleted file mode 100644 index 101df4fe4..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/adler32_ssse3.c +++ /dev/null @@ -1,118 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2011 Mark Adler - * Authors: - * Brian Bockelman - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "../../zbuild.h" -#include "../../zutil.h" - -#include "../../adler32_p.h" - -#ifdef X86_SSSE3_ADLER32 - -#include - -Z_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const unsigned char *buf, size_t len) { - uint32_t sum2; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (UNLIKELY(len == 1)) - return adler32_len_1(adler, buf, sum2); - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (UNLIKELY(buf == NULL)) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (UNLIKELY(len < 16)) - return adler32_len_16(adler, buf, len, sum2); - - uint32_t ALIGNED_(16) s1[4], s2[4]; - - s1[0] = s1[1] = s1[2] = 0; s1[3] = adler; - s2[0] = s2[1] = s2[2] = 0; s2[3] = sum2; - - char ALIGNED_(16) dot1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - __m128i dot1v = _mm_load_si128((__m128i*)dot1); - char ALIGNED_(16) dot2[16] = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - __m128i dot2v = _mm_load_si128((__m128i*)dot2); - short ALIGNED_(16) dot3[8] = {1, 1, 1, 1, 1, 1, 1, 1}; - __m128i dot3v = _mm_load_si128((__m128i*)dot3); - - // We will need to multiply by - //char ALIGNED_(16) shift[4] = {0, 0, 0, 4}; //{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}; - - char ALIGNED_(16) shift[16] = {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - __m128i shiftv = _mm_load_si128((__m128i*)shift); - - while (len >= 16) { - __m128i vs1 = _mm_load_si128((__m128i*)s1); - __m128i vs2 = _mm_load_si128((__m128i*)s2); - __m128i vs1_0 = vs1; - - int k = (len < NMAX ? (int)len : NMAX); - k -= k % 16; - len -= k; - - while (k >= 16) { - /* - vs1 = adler + sum(c[i]) - vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] ) - - NOTE: 256-bit equivalents are: - _mm256_maddubs_epi16 <- operates on 32 bytes to 16 shorts - _mm256_madd_epi16 <- Sums 16 shorts to 8 int32_t. - We could rewrite the below to use 256-bit instructions instead of 128-bit. - */ - __m128i vbuf = _mm_loadu_si128((__m128i*)buf); - buf += 16; - k -= 16; - - __m128i v_short_sum1 = _mm_maddubs_epi16(vbuf, dot1v); // multiply-add, resulting in 8 shorts. - __m128i vsum1 = _mm_madd_epi16(v_short_sum1, dot3v); // sum 8 shorts to 4 int32_t; - __m128i v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v); - vs1 = _mm_add_epi32(vsum1, vs1); - __m128i vsum2 = _mm_madd_epi16(v_short_sum2, dot3v); - vs1_0 = _mm_sll_epi32(vs1_0, shiftv); - vsum2 = _mm_add_epi32(vsum2, vs2); - vs2 = _mm_add_epi32(vsum2, vs1_0); - vs1_0 = vs1; - } - - // At this point, we have partial sums stored in vs1 and vs2. There are AVX512 instructions that - // would allow us to sum these quickly (VP4DPWSSD). For now, just unpack and move on. - - uint32_t ALIGNED_(16) s1_unpack[4]; - uint32_t ALIGNED_(16) s2_unpack[4]; - - _mm_store_si128((__m128i*)s1_unpack, vs1); - _mm_store_si128((__m128i*)s2_unpack, vs2); - - adler = (s1_unpack[0] % BASE) + (s1_unpack[1] % BASE) + (s1_unpack[2] % BASE) + (s1_unpack[3] % BASE); - adler %= BASE; - s1[3] = adler; - - sum2 = (s2_unpack[0] % BASE) + (s2_unpack[1] % BASE) + (s2_unpack[2] % BASE) + (s2_unpack[3] % BASE); - sum2 %= BASE; - s2[3] = sum2; - } - - while (len) { - len--; - adler += *buf++; - sum2 += adler; - } - adler %= BASE; - sum2 %= BASE; - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/chunkset_avx.c b/internal-complibs/zlib-ng-2.0.7/arch/x86/chunkset_avx.c deleted file mode 100644 index 398d192ad..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/chunkset_avx.c +++ /dev/null @@ -1,53 +0,0 @@ -/* chunkset_avx.c -- AVX inline functions to copy small data chunks. - * For conditions of distribution and use, see copyright notice in zlib.h - */ -#include "zbuild.h" -#include "zutil.h" - -#ifdef X86_AVX_CHUNKSET -#include - -typedef __m256i chunk_t; - -#define CHUNK_SIZE 32 - -#define HAVE_CHUNKMEMSET_2 -#define HAVE_CHUNKMEMSET_4 -#define HAVE_CHUNKMEMSET_8 - -static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { - int16_t tmp; - memcpy(&tmp, from, sizeof(tmp)); - *chunk = _mm256_set1_epi16(tmp); -} - -static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { - int32_t tmp; - memcpy(&tmp, from, sizeof(tmp)); - *chunk = _mm256_set1_epi32(tmp); -} - -static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { - int64_t tmp; - memcpy(&tmp, from, sizeof(tmp)); - *chunk = _mm256_set1_epi64x(tmp); -} - -static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { - *chunk = _mm256_loadu_si256((__m256i *)s); -} - -static inline void storechunk(uint8_t *out, chunk_t *chunk) { - _mm256_storeu_si256((__m256i *)out, *chunk); -} - -#define CHUNKSIZE chunksize_avx -#define CHUNKCOPY chunkcopy_avx -#define CHUNKCOPY_SAFE chunkcopy_safe_avx -#define CHUNKUNROLL chunkunroll_avx -#define CHUNKMEMSET chunkmemset_avx -#define CHUNKMEMSET_SAFE chunkmemset_safe_avx - -#include "chunkset_tpl.h" - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/compare258_sse.c b/internal-complibs/zlib-ng-2.0.7/arch/x86/compare258_sse.c deleted file mode 100644 index 17534c051..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/compare258_sse.c +++ /dev/null @@ -1,74 +0,0 @@ -/* compare258_sse.c -- SSE4.2 version of compare258 - * - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * Authors: - * Wajdi Feghali - * Jim Guilford - * Vinodh Gopal - * Erdinc Ozturk - * Jim Kukunas - * - * Portions are Copyright (C) 2016 12Sided Technology, LLC. - * Author: - * Phil Vachon - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "../../zbuild.h" -#include "../../zutil.h" - -#ifdef X86_SSE42_CMP_STR - -#include -#ifdef _MSC_VER -# include -#endif - -/* UNALIGNED_OK, SSE4.2 intrinsic comparison */ -static inline uint32_t compare256_unaligned_sse4_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - #define mode _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_EACH | _SIDD_NEGATIVE_POLARITY - __m128i xmm_src0, xmm_src1; - uint32_t ret; - - xmm_src0 = _mm_loadu_si128((__m128i *)src0); - xmm_src1 = _mm_loadu_si128((__m128i *)src1); - ret = (uint32_t)_mm_cmpestri(xmm_src0, 16, xmm_src1, 16, mode); - if (_mm_cmpestrc(xmm_src0, 16, xmm_src1, 16, mode)) { - return len + ret; - } - src0 += 16, src1 += 16, len += 16; - - xmm_src0 = _mm_loadu_si128((__m128i *)src0); - xmm_src1 = _mm_loadu_si128((__m128i *)src1); - ret = (uint32_t)_mm_cmpestri(xmm_src0, 16, xmm_src1, 16, mode); - if (_mm_cmpestrc(xmm_src0, 16, xmm_src1, 16, mode)) { - return len + ret; - } - src0 += 16, src1 += 16, len += 16; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_unaligned_sse4_static(const unsigned char *src0, const unsigned char *src1) { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return (*src0 == *src1); - - return compare256_unaligned_sse4_static(src0+2, src1+2) + 2; -} - -Z_INTERNAL uint32_t compare258_unaligned_sse4(const unsigned char *src0, const unsigned char *src1) { - return compare258_unaligned_sse4_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_unaligned_sse4 -#define COMPARE256 compare256_unaligned_sse4_static -#define COMPARE258 compare258_unaligned_sse4_static - -#include "match_tpl.h" - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/crc_folding.h b/internal-complibs/zlib-ng-2.0.7/arch/x86/crc_folding.h deleted file mode 100644 index 0d3c24b29..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/crc_folding.h +++ /dev/null @@ -1,19 +0,0 @@ -/* crc_folding.h - * - * Compute the CRC32 using a parallelized folding approach with the PCLMULQDQ - * instruction. - * - * Copyright (C) 2013 Intel Corporation Jim Kukunas - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef CRC_FOLDING_H_ -#define CRC_FOLDING_H_ - -#include "../../deflate.h" - -Z_INTERNAL void crc_fold_init(deflate_state *const); -Z_INTERNAL uint32_t crc_fold_512to32(deflate_state *const); -Z_INTERNAL void crc_fold_copy(deflate_state *const, unsigned char *, const unsigned char *, long); - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/insert_string_sse.c b/internal-complibs/zlib-ng-2.0.7/arch/x86/insert_string_sse.c deleted file mode 100644 index d0c316b19..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/insert_string_sse.c +++ /dev/null @@ -1,46 +0,0 @@ -/* insert_string_sse -- insert_string variant using SSE4.2's CRC instructions - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - */ - -#include "../../zbuild.h" -#include -#ifdef _MSC_VER -# include -#endif -#include "../../deflate.h" - -#ifdef X86_SSE42_CRC_INTRIN -# ifdef _MSC_VER -# define UPDATE_HASH(s, h, val)\ - h = _mm_crc32_u32(h, val) -# else -# define UPDATE_HASH(s, h, val)\ - h = __builtin_ia32_crc32si(h, val) -# endif -#else -# ifdef _MSC_VER -# define UPDATE_HASH(s, h, val) {\ - __asm mov edx, h\ - __asm mov eax, val\ - __asm crc32 eax, edx\ - __asm mov val, eax\ - } -# else -# define UPDATE_HASH(s, h, val) \ - __asm__ __volatile__ (\ - "crc32 %1,%0\n\t"\ - : "+r" (h)\ - : "r" (val)\ - ); -# endif -#endif - -#define INSERT_STRING insert_string_sse4 -#define QUICK_INSERT_STRING quick_insert_string_sse4 - -#ifdef X86_SSE42_CRC_HASH -# include "../../insert_string_tpl.h" -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/slide_avx.c b/internal-complibs/zlib-ng-2.0.7/arch/x86/slide_avx.c deleted file mode 100644 index be9a9b7ea..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/slide_avx.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * AVX2 optimized hash slide, based on Intel's slide_sse implementation - * - * Copyright (C) 2017 Intel Corporation - * Authors: - * Arjan van de Ven - * Jim Kukunas - * Mika T. Lindqvist - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ -#include "../../zbuild.h" -#include "../../deflate.h" - -#include - -Z_INTERNAL void slide_hash_avx2(deflate_state *s) { - Pos *p; - unsigned n; - uint16_t wsize = (uint16_t)s->w_size; - const __m256i ymm_wsize = _mm256_set1_epi16((short)wsize); - - n = HASH_SIZE; - p = &s->head[n] - 16; - do { - __m256i value, result; - - value = _mm256_loadu_si256((__m256i *)p); - result= _mm256_subs_epu16(value, ymm_wsize); - _mm256_storeu_si256((__m256i *)p, result); - p -= 16; - n -= 16; - } while (n > 0); - - n = wsize; - p = &s->prev[n] - 16; - do { - __m256i value, result; - - value = _mm256_loadu_si256((__m256i *)p); - result= _mm256_subs_epu16(value, ymm_wsize); - _mm256_storeu_si256((__m256i *)p, result); - - p -= 16; - n -= 16; - } while (n > 0); -} diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/slide_sse.c b/internal-complibs/zlib-ng-2.0.7/arch/x86/slide_sse.c deleted file mode 100644 index abf447475..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/slide_sse.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SSE optimized hash slide - * - * Copyright (C) 2017 Intel Corporation - * Authors: - * Arjan van de Ven - * Jim Kukunas - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ -#include "../../zbuild.h" -#include "../../deflate.h" - -#include - -Z_INTERNAL void slide_hash_sse2(deflate_state *s) { - Pos *p; - unsigned n; - uint16_t wsize = (uint16_t)s->w_size; - const __m128i xmm_wsize = _mm_set1_epi16((short)wsize); - - n = HASH_SIZE; - p = &s->head[n] - 8; - do { - __m128i value, result; - - value = _mm_loadu_si128((__m128i *)p); - result= _mm_subs_epu16(value, xmm_wsize); - _mm_storeu_si128((__m128i *)p, result); - p -= 8; - n -= 8; - } while (n > 0); - - n = wsize; - p = &s->prev[n] - 8; - do { - __m128i value, result; - - value = _mm_loadu_si128((__m128i *)p); - result= _mm_subs_epu16(value, xmm_wsize); - _mm_storeu_si128((__m128i *)p, result); - - p -= 8; - n -= 8; - } while (n > 0); -} diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/x86.c b/internal-complibs/zlib-ng-2.0.7/arch/x86/x86.c deleted file mode 100644 index e782cb8ee..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/x86.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * x86 feature check - * - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * Author: - * Jim Kukunas - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "../../zutil.h" - -#ifdef _MSC_VER -# include -#else -// Newer versions of GCC and clang come with cpuid.h -# include -#endif - -Z_INTERNAL int x86_cpu_has_avx2; -Z_INTERNAL int x86_cpu_has_sse2; -Z_INTERNAL int x86_cpu_has_ssse3; -Z_INTERNAL int x86_cpu_has_sse42; -Z_INTERNAL int x86_cpu_has_pclmulqdq; -Z_INTERNAL int x86_cpu_has_tzcnt; - -static void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) { -#ifdef _MSC_VER - unsigned int registers[4]; - __cpuid((int *)registers, info); - - *eax = registers[0]; - *ebx = registers[1]; - *ecx = registers[2]; - *edx = registers[3]; -#else - __cpuid(info, *eax, *ebx, *ecx, *edx); -#endif -} - -static void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) { -#ifdef _MSC_VER - unsigned int registers[4]; - __cpuidex((int *)registers, info, subinfo); - - *eax = registers[0]; - *ebx = registers[1]; - *ecx = registers[2]; - *edx = registers[3]; -#else - __cpuid_count(info, subinfo, *eax, *ebx, *ecx, *edx); -#endif -} - -void Z_INTERNAL x86_check_features(void) { - unsigned eax, ebx, ecx, edx; - unsigned maxbasic; - - cpuid(0, &maxbasic, &ebx, &ecx, &edx); - - cpuid(1 /*CPU_PROCINFO_AND_FEATUREBITS*/, &eax, &ebx, &ecx, &edx); - - x86_cpu_has_sse2 = edx & 0x4000000; - x86_cpu_has_ssse3 = ecx & 0x200; - x86_cpu_has_sse42 = ecx & 0x100000; - x86_cpu_has_pclmulqdq = ecx & 0x2; - - if (maxbasic >= 7) { - cpuidex(7, 0, &eax, &ebx, &ecx, &edx); - - // check BMI1 bit - // Reference: https://software.intel.com/sites/default/files/article/405250/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family.pdf - x86_cpu_has_tzcnt = ebx & 0x8; - // check AVX2 bit - x86_cpu_has_avx2 = ebx & 0x20; - } else { - x86_cpu_has_tzcnt = 0; - x86_cpu_has_avx2 = 0; - } -} diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/x86.h b/internal-complibs/zlib-ng-2.0.7/arch/x86/x86.h deleted file mode 100644 index 8471e155c..000000000 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/x86.h +++ /dev/null @@ -1,18 +0,0 @@ -/* cpu.h -- check for CPU features -* Copyright (C) 2013 Intel Corporation Jim Kukunas -* For conditions of distribution and use, see copyright notice in zlib.h -*/ - -#ifndef CPU_H_ -#define CPU_H_ - -extern int x86_cpu_has_avx2; -extern int x86_cpu_has_sse2; -extern int x86_cpu_has_ssse3; -extern int x86_cpu_has_sse42; -extern int x86_cpu_has_pclmulqdq; -extern int x86_cpu_has_tzcnt; - -void Z_INTERNAL x86_check_features(void); - -#endif /* CPU_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/detect-install-dirs.cmake b/internal-complibs/zlib-ng-2.0.7/cmake/detect-install-dirs.cmake deleted file mode 100644 index ddf1adb8c..000000000 --- a/internal-complibs/zlib-ng-2.0.7/cmake/detect-install-dirs.cmake +++ /dev/null @@ -1,55 +0,0 @@ -# detect-install-dirs.cmake -- Detect install directory parameters -# Copyright (C) 2021 Hans Kristian Rosbach -# Licensed under the Zlib license, see LICENSE.md for details - -# Determine installation directory for executables -if (DEFINED BIN_INSTALL_DIR) - set(BIN_INSTALL_DIR "${BIN_INSTALL_DIR}" CACHE PATH "Installation directory for executables" FORCE) -elseif (DEFINED INSTALL_BIN_DIR) - set(BIN_INSTALL_DIR "${INSTALL_BIN_DIR}" CACHE PATH "Installation directory for executables" FORCE) -elseif (DEFINED CMAKE_INSTALL_FULL_BINDIR) - set(BIN_INSTALL_DIR "${CMAKE_INSTALL_FULL_BINDIR}" CACHE PATH "Installation directory for executables" FORCE) -elseif (DEFINED CMAKE_INSTALL_BINDIR) - set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" CACHE PATH "Installation directory for executables" FORCE) -else() - set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") -endif() - -# Determine installation directory for libraries -if (DEFINED LIB_INSTALL_DIR) - set(LIB_INSTALL_DIR "${LIB_INSTALL_DIR}" CACHE PATH "Installation directory for libraries" FORCE) -elseif (DEFINED INSTALL_LIB_DIR) - set(LIB_INSTALL_DIR "${INSTALL_LIB_DIR}" CACHE PATH "Installation directory for libraries" FORCE) -elseif (DEFINED CMAKE_INSTALL_FULL_LIBDIR) - set(LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE PATH "Installation directory for libraries" FORCE) -elseif (DEFINED CMAKE_INSTALL_LIBDIR) - set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation directory for libraries" FORCE) -else() - set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") -endif() - -# Determine installation directory for include files -if (DEFINED INC_INSTALL_DIR) - set(INC_INSTALL_DIR "${INC_INSTALL_DIR}" CACHE PATH "Installation directory for headers" FORCE) -elseif (DEFINED INSTALL_INC_DIR) - set(INC_INSTALL_DIR "${INSTALL_INC_DIR}" CACHE PATH "Installation directory for headers" FORCE) -elseif (DEFINED CMAKE_INSTALL_FULL_INCLUDEDIR) - set(INC_INSTALL_DIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}" CACHE PATH "Installation directory for headers" FORCE) -elseif (DEFINED CMAKE_INSTALL_INCLUDEDIR) - set(INC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH "Installation directory for headers" FORCE) -else() - set(INC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") -endif() - -# Determine installation directory for pkgconfig files -if (DEFINED PKGCONFIG_INSTALL_DIR) - set(PKGCONFIG_INSTALL_DIR "${PKGCONFIG_INSTALL_DIR}" CACHE PATH "Installation directory for pkgconfig (.pc) files" FORCE) -elseif (DEFINED INSTALL_PKGCONFIG_DIR) - set(PKGCONFIG_INSTALL_DIR "${INSTALL_PKGCONFIG_DIR}" CACHE PATH "Installation directory for pkgconfig (.pc) files" FORCE) -elseif (DEFINED CMAKE_INSTALL_FULL_PKGCONFIGDIR) - set(PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_FULL_PKGCONFIGDIR}" CACHE PATH "Installation directory for pkgconfig (.pc) files" FORCE) -elseif (DEFINED CMAKE_INSTALL_PKGCONFIGDIR) - set(PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/${CMAKE_INSTALL_PKGCONFIGDIR}" CACHE PATH "Installation directory for pkgconfig (.pc) files" FORCE) -else() - set(PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") -endif() diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/test-tools.cmake b/internal-complibs/zlib-ng-2.0.7/cmake/test-tools.cmake deleted file mode 100644 index 4afe07c2c..000000000 --- a/internal-complibs/zlib-ng-2.0.7/cmake/test-tools.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# test-tools.cmake -- Tests targeting tool coverage - -# Test --help and invalid parameters for our tools -set(TEST_COMMAND ${MINIGZIP_COMMAND} "--help") -add_test(NAME minigzip-help - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${TEST_COMMAND}" - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) - -set(TEST_COMMAND ${MINIGZIP_COMMAND} "--invalid") -add_test(NAME minigzip-invalid - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${TEST_COMMAND}" - -DSUCCESS_EXIT=64 - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) - -set(TEST_COMMAND ${MINIDEFLATE_COMMAND} "--help") -add_test(NAME minideflate-help - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${TEST_COMMAND}" - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) - -set(TEST_COMMAND ${MINIDEFLATE_COMMAND} "--invalid") -add_test(NAME minideflate-invalid - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${TEST_COMMAND}" - -DSUCCESS_EXIT=64 - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) - -set(TEST_COMMAND ${SWITCHLEVELS_COMMAND} "--help") -add_test(NAME switchlevels-help - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${TEST_COMMAND}" - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) diff --git a/internal-complibs/zlib-ng-2.0.7/compare258.c b/internal-complibs/zlib-ng-2.0.7/compare258.c deleted file mode 100644 index bc41638ae..000000000 --- a/internal-complibs/zlib-ng-2.0.7/compare258.c +++ /dev/null @@ -1,186 +0,0 @@ -/* compare258.c -- aligned and unaligned versions of compare258 - * Copyright (C) 2020 Nathan Moinvaziri - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil.h" - -#include "fallback_builtins.h" - -/* ALIGNED, byte comparison */ -static inline uint32_t compare256_c_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_c_static(const unsigned char *src0, const unsigned char *src1) { - if (*src0 != *src1) - return 0; - src0 += 1, src1 += 1; - if (*src0 != *src1) - return 1; - src0 += 1, src1 += 1; - - return compare256_c_static(src0, src1) + 2; -} - -Z_INTERNAL uint32_t compare258_c(const unsigned char *src0, const unsigned char *src1) { - return compare258_c_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_c -#define COMPARE256 compare256_c_static -#define COMPARE258 compare258_c_static - -#include "match_tpl.h" - -#ifdef UNALIGNED_OK -/* UNALIGNED_OK, 16-bit integer comparison */ -static inline uint32_t compare256_unaligned_16_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return len + (*src0 == *src1); - src0 += 2, src1 += 2, len += 2; - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return len + (*src0 == *src1); - src0 += 2, src1 += 2, len += 2; - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return len + (*src0 == *src1); - src0 += 2, src1 += 2, len += 2; - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return len + (*src0 == *src1); - src0 += 2, src1 += 2, len += 2; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_unaligned_16_static(const unsigned char *src0, const unsigned char *src1) { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return (*src0 == *src1); - - return compare256_unaligned_16_static(src0+2, src1+2) + 2; -} - -Z_INTERNAL uint32_t compare258_unaligned_16(const unsigned char *src0, const unsigned char *src1) { - return compare258_unaligned_16_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_unaligned_16 -#define COMPARE256 compare256_unaligned_16_static -#define COMPARE258 compare258_unaligned_16_static - -#include "match_tpl.h" - -#ifdef HAVE_BUILTIN_CTZ -/* UNALIGNED_OK, 32-bit integer comparison */ -static inline uint32_t compare256_unaligned_32_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - uint32_t sv = *(uint32_t *)src0; - uint32_t mv = *(uint32_t *)src1; - uint32_t diff = sv ^ mv; - - if (diff) { - uint32_t match_byte = __builtin_ctz(diff) / 8; - return len + match_byte; - } - - src0 += 4, src1 += 4, len += 4; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_unaligned_32_static(const unsigned char *src0, const unsigned char *src1) { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return (*src0 == *src1); - - return compare256_unaligned_32_static(src0+2, src1+2) + 2; -} - -Z_INTERNAL uint32_t compare258_unaligned_32(const unsigned char *src0, const unsigned char *src1) { - return compare258_unaligned_32_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_unaligned_32 -#define COMPARE256 compare256_unaligned_32_static -#define COMPARE258 compare258_unaligned_32_static - -#include "match_tpl.h" - -#endif - -#if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) -/* UNALIGNED64_OK, 64-bit integer comparison */ -static inline uint32_t compare256_unaligned_64_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - uint64_t sv = *(uint64_t *)src0; - uint64_t mv = *(uint64_t *)src1; - uint64_t diff = sv ^ mv; - - if (diff) { - uint64_t match_byte = __builtin_ctzll(diff) / 8; - return len + (uint32_t)match_byte; - } - - src0 += 8, src1 += 8, len += 8; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_unaligned_64_static(const unsigned char *src0, const unsigned char *src1) { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return (*src0 == *src1); - - return compare256_unaligned_64_static(src0+2, src1+2) + 2; -} - -Z_INTERNAL uint32_t compare258_unaligned_64(const unsigned char *src0, const unsigned char *src1) { - return compare258_unaligned_64_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_unaligned_64 -#define COMPARE256 compare256_unaligned_64_static -#define COMPARE258 compare258_unaligned_64_static - -#include "match_tpl.h" - -#endif - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/crc32.c b/internal-complibs/zlib-ng-2.0.7/crc32.c deleted file mode 100644 index 4b488e617..000000000 --- a/internal-complibs/zlib-ng-2.0.7/crc32.c +++ /dev/null @@ -1,202 +0,0 @@ -/* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016, 2018 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. - */ - -#include "zbuild.h" -#include "zendian.h" -#include -#include "deflate.h" -#include "functable.h" -#include "crc32_tbl.h" - -/* ========================================================================= - * This function can be used by asm versions of crc32() - */ -const uint32_t * Z_EXPORT PREFIX(get_crc_table)(void) { - return (const uint32_t *)crc_table; -} - -#ifdef ZLIB_COMPAT -unsigned long Z_EXPORT PREFIX(crc32_z)(unsigned long crc, const unsigned char *buf, size_t len) { - if (buf == NULL) return 0; - - return (unsigned long)functable.crc32((uint32_t)crc, buf, len); -} -#else -uint32_t Z_EXPORT PREFIX(crc32_z)(uint32_t crc, const unsigned char *buf, size_t len) { - if (buf == NULL) return 0; - - return functable.crc32(crc, buf, len); -} -#endif -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 -#define DO4 DO1; DO1; DO1; DO1 - -/* ========================================================================= */ -Z_INTERNAL uint32_t crc32_generic(uint32_t crc, const unsigned char *buf, uint64_t len) { - crc = crc ^ 0xffffffff; - -#ifdef UNROLL_MORE - while (len >= 8) { - DO8; - len -= 8; - } -#else - while (len >= 4) { - DO4; - len -= 4; - } -#endif - - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffff; -} - -#ifdef ZLIB_COMPAT -unsigned long Z_EXPORT PREFIX(crc32)(unsigned long crc, const unsigned char *buf, unsigned int len) { - return (unsigned long)PREFIX(crc32_z)((uint32_t)crc, buf, len); -} -#else -uint32_t Z_EXPORT PREFIX(crc32)(uint32_t crc, const unsigned char *buf, uint32_t len) { - return PREFIX(crc32_z)(crc, buf, len); -} -#endif - -/* - This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit - integer pointer type. This violates the strict aliasing rule, where a - compiler can assume, for optimization purposes, that two pointers to - fundamentally different types won't ever point to the same memory. This can - manifest as a problem only if one of the pointers is written to. This code - only reads from those pointers. So long as this code remains isolated in - this compilation unit, there won't be a problem. For this reason, this code - should not be copied and pasted into a compilation unit in which other code - writes to the buffer that is passed to these routines. - */ - -/* ========================================================================= */ -#if BYTE_ORDER == LITTLE_ENDIAN -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 - -/* ========================================================================= */ -Z_INTERNAL uint32_t crc32_little(uint32_t crc, const unsigned char *buf, uint64_t len) { - Z_REGISTER uint32_t c; - Z_REGISTER const uint32_t *buf4; - - c = crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } - - buf4 = (const uint32_t *)(const void *)buf; - -#ifdef UNROLL_MORE - while (len >= 32) { - DOLIT32; - len -= 32; - } -#endif - - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char *)buf4; - - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return c; -} -#endif /* BYTE_ORDER == LITTLE_ENDIAN */ - -/* ========================================================================= */ -#if BYTE_ORDER == BIG_ENDIAN -#define DOBIG4 c ^= *buf4++; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 - -/* ========================================================================= */ -Z_INTERNAL uint32_t crc32_big(uint32_t crc, const unsigned char *buf, uint64_t len) { - Z_REGISTER uint32_t c; - Z_REGISTER const uint32_t *buf4; - - c = ZSWAP32(crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; - } - - buf4 = (const uint32_t *)(const void *)buf; - -#ifdef UNROLL_MORE - while (len >= 32) { - DOBIG32; - len -= 32; - } -#endif - - while (len >= 4) { - DOBIG4; - len -= 4; - } - buf = (const unsigned char *)buf4; - - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return ZSWAP32(c); -} -#endif /* BYTE_ORDER == BIG_ENDIAN */ - -#ifdef X86_PCLMULQDQ_CRC -#include "arch/x86/x86.h" -#include "arch/x86/crc_folding.h" - -Z_INTERNAL void crc_finalize(deflate_state *const s) { - if (x86_cpu_has_pclmulqdq) - s->strm->adler = crc_fold_512to32(s); -} -#endif - -Z_INTERNAL void crc_reset(deflate_state *const s) { -#ifdef X86_PCLMULQDQ_CRC - x86_check_features(); - if (x86_cpu_has_pclmulqdq) { - crc_fold_init(s); - return; - } -#endif - s->strm->adler = PREFIX(crc32)(0L, NULL, 0); -} - -Z_INTERNAL void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned long size) { -#ifdef X86_PCLMULQDQ_CRC - if (x86_cpu_has_pclmulqdq) { - crc_fold_copy(strm->state, dst, strm->next_in, size); - return; - } -#endif - memcpy(dst, strm->next_in, size); - strm->adler = PREFIX(crc32)(strm->adler, dst, size); -} diff --git a/internal-complibs/zlib-ng-2.0.7/crc32_comb.c b/internal-complibs/zlib-ng-2.0.7/crc32_comb.c deleted file mode 100644 index 91ddf4f98..000000000 --- a/internal-complibs/zlib-ng-2.0.7/crc32_comb.c +++ /dev/null @@ -1,111 +0,0 @@ -/* crc32_comb.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016, 2018 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. - */ - -#include "zbuild.h" -#include -#include "deflate.h" -#include "crc32_p.h" -#include "crc32_comb_tbl.h" - - -/* Local functions for crc concatenation */ -static uint32_t crc32_combine_(uint32_t crc1, uint32_t crc2, z_off64_t len2); -static void crc32_combine_gen_(uint32_t op[GF2_DIM], z_off64_t len2); - -/* ========================================================================= */ -static uint32_t crc32_combine_(uint32_t crc1, uint32_t crc2, z_off64_t len2) { - int n; - - if (len2 > 0) - /* operator for 2^n zeros repeats every GF2_DIM n values */ - for (n = 0; len2; n = (n + 1) % GF2_DIM, len2 >>= 1) - if (len2 & 1) - crc1 = gf2_matrix_times(crc_comb[n], crc1); - return crc1 ^ crc2; -} - -/* ========================================================================= */ -#ifdef ZLIB_COMPAT -unsigned long Z_EXPORT PREFIX(crc32_combine)(unsigned long crc1, unsigned long crc2, z_off_t len2) { - return (unsigned long)crc32_combine_((uint32_t)crc1, (uint32_t)crc2, len2); -} - -unsigned long Z_EXPORT PREFIX4(crc32_combine)(unsigned long crc1, unsigned long crc2, z_off64_t len2) { - return (unsigned long)crc32_combine_((uint32_t)crc1, (uint32_t)crc2, len2); -} -#else -uint32_t Z_EXPORT PREFIX4(crc32_combine)(uint32_t crc1, uint32_t crc2, z_off64_t len2) { - return crc32_combine_(crc1, crc2, len2); -} -#endif - -/* ========================================================================= */ - -static void crc32_combine_gen_(uint32_t op[GF2_DIM], z_off64_t len2) { - uint32_t row; - int j; - unsigned i; - - /* if len2 is zero or negative, return the identity matrix */ - if (len2 <= 0) { - row = 1; - for (j = 0; j < GF2_DIM; j++) { - op[j] = row; - row <<= 1; - } - return; - } - - /* at least one bit in len2 is set -- find it, and copy the operator - corresponding to that position into op */ - i = 0; - for (;;) { - if (len2 & 1) { - for (j = 0; j < GF2_DIM; j++) - op[j] = crc_comb[i][j]; - break; - } - len2 >>= 1; - i = (i + 1) % GF2_DIM; - } - - /* for each remaining bit set in len2 (if any), multiply op by the operator - corresponding to that position */ - for (;;) { - len2 >>= 1; - i = (i + 1) % GF2_DIM; - if (len2 == 0) - break; - if (len2 & 1) - for (j = 0; j < GF2_DIM; j++) - op[j] = gf2_matrix_times(crc_comb[i], op[j]); - } -} - -/* ========================================================================= */ - -#ifdef ZLIB_COMPAT -void Z_EXPORT PREFIX(crc32_combine_gen)(uint32_t *op, z_off_t len2) { - crc32_combine_gen_(op, len2); -} -void Z_EXPORT PREFIX4(crc32_combine_gen)(uint32_t *op, z_off64_t len2) { - crc32_combine_gen_(op, len2); -} -#else -void Z_EXPORT PREFIX4(crc32_combine_gen)(uint32_t op[GF2_DIM], z_off64_t len2) { - crc32_combine_gen_(op, len2); -} -#endif - -/* ========================================================================= */ -uint32_t Z_EXPORT PREFIX(crc32_combine_op)(uint32_t crc1, uint32_t crc2, const uint32_t *op) { - return gf2_matrix_times(op, crc1) ^ crc2; -} diff --git a/internal-complibs/zlib-ng-2.0.7/crc32_comb_tbl._h b/internal-complibs/zlib-ng-2.0.7/crc32_comb_tbl._h deleted file mode 100644 index 43818c3e0..000000000 --- a/internal-complibs/zlib-ng-2.0.7/crc32_comb_tbl._h +++ /dev/null @@ -1,300 +0,0 @@ -#ifndef CRC32_COMB_TBL_H_ -#define CRC32_COMB_TBL_H_ - -/* crc32_comb_tbl.h -- zero operators table for CRC combine - * Generated automatically by makecrct.c - */ - -static const uint32_t crc_comb[32][32] = -{ - { - 0x77073096, 0xee0e612c, 0x076dc419, 0x0edb8832, 0x1db71064, - 0x3b6e20c8, 0x76dc4190, 0xedb88320, 0x00000001, 0x00000002, - 0x00000004, 0x00000008, 0x00000010, 0x00000020, 0x00000040, - 0x00000080, 0x00000100, 0x00000200, 0x00000400, 0x00000800, - 0x00001000, 0x00002000, 0x00004000, 0x00008000, 0x00010000, - 0x00020000, 0x00040000, 0x00080000, 0x00100000, 0x00200000, - 0x00400000, 0x00800000 - }, - { - 0x191b3141, 0x32366282, 0x646cc504, 0xc8d98a08, 0x4ac21251, - 0x958424a2, 0xf0794f05, 0x3b83984b, 0x77073096, 0xee0e612c, - 0x076dc419, 0x0edb8832, 0x1db71064, 0x3b6e20c8, 0x76dc4190, - 0xedb88320, 0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x00000100, - 0x00000200, 0x00000400, 0x00000800, 0x00001000, 0x00002000, - 0x00004000, 0x00008000 - }, - { - 0xb8bc6765, 0xaa09c88b, 0x8f629757, 0xc5b428ef, 0x5019579f, - 0xa032af3e, 0x9b14583d, 0xed59b63b, 0x01c26a37, 0x0384d46e, - 0x0709a8dc, 0x0e1351b8, 0x1c26a370, 0x384d46e0, 0x709a8dc0, - 0xe1351b80, 0x191b3141, 0x32366282, 0x646cc504, 0xc8d98a08, - 0x4ac21251, 0x958424a2, 0xf0794f05, 0x3b83984b, 0x77073096, - 0xee0e612c, 0x076dc419, 0x0edb8832, 0x1db71064, 0x3b6e20c8, - 0x76dc4190, 0xedb88320 - }, - { - 0xccaa009e, 0x4225077d, 0x844a0efa, 0xd3e51bb5, 0x7cbb312b, - 0xf9766256, 0x299dc2ed, 0x533b85da, 0xa6770bb4, 0x979f1129, - 0xf44f2413, 0x33ef4e67, 0x67de9cce, 0xcfbd399c, 0x440b7579, - 0x8816eaf2, 0xcb5cd3a5, 0x4dc8a10b, 0x9b914216, 0xec53826d, - 0x03d6029b, 0x07ac0536, 0x0f580a6c, 0x1eb014d8, 0x3d6029b0, - 0x7ac05360, 0xf580a6c0, 0x30704bc1, 0x60e09782, 0xc1c12f04, - 0x58f35849, 0xb1e6b092 - }, - { - 0xae689191, 0x87a02563, 0xd4314c87, 0x73139f4f, 0xe6273e9e, - 0x173f7b7d, 0x2e7ef6fa, 0x5cfdedf4, 0xb9fbdbe8, 0xa886b191, - 0x8a7c6563, 0xcf89cc87, 0x44629f4f, 0x88c53e9e, 0xcafb7b7d, - 0x4e87f0bb, 0x9d0fe176, 0xe16ec4ad, 0x19ac8f1b, 0x33591e36, - 0x66b23c6c, 0xcd6478d8, 0x41b9f7f1, 0x8373efe2, 0xdd96d985, - 0x605cb54b, 0xc0b96a96, 0x5a03d36d, 0xb407a6da, 0xb37e4bf5, - 0xbd8d91ab, 0xa06a2517 - }, - { - 0xf1da05aa, 0x38c50d15, 0x718a1a2a, 0xe3143454, 0x1d596ee9, - 0x3ab2ddd2, 0x7565bba4, 0xeacb7748, 0x0ee7e8d1, 0x1dcfd1a2, - 0x3b9fa344, 0x773f4688, 0xee7e8d10, 0x078c1c61, 0x0f1838c2, - 0x1e307184, 0x3c60e308, 0x78c1c610, 0xf1838c20, 0x38761e01, - 0x70ec3c02, 0xe1d87804, 0x18c1f649, 0x3183ec92, 0x6307d924, - 0xc60fb248, 0x576e62d1, 0xaedcc5a2, 0x86c88d05, 0xd6e01c4b, - 0x76b13ed7, 0xed627dae - }, - { - 0x8f352d95, 0xc51b5d6b, 0x5147bc97, 0xa28f792e, 0x9e6ff41d, - 0xe7aeee7b, 0x142cdab7, 0x2859b56e, 0x50b36adc, 0xa166d5b8, - 0x99bcad31, 0xe8085c23, 0x0b61be07, 0x16c37c0e, 0x2d86f81c, - 0x5b0df038, 0xb61be070, 0xb746c6a1, 0xb5fc8b03, 0xb0881047, - 0xba6126cf, 0xafb34bdf, 0x841791ff, 0xd35e25bf, 0x7dcd4d3f, - 0xfb9a9a7e, 0x2c4432bd, 0x5888657a, 0xb110caf4, 0xb95093a9, - 0xa9d02113, 0x88d14467 - }, - { - 0x33fff533, 0x67ffea66, 0xcfffd4cc, 0x448eafd9, 0x891d5fb2, - 0xc94bb925, 0x49e6740b, 0x93cce816, 0xfce8d66d, 0x22a0aa9b, - 0x45415536, 0x8a82aa6c, 0xce745299, 0x4799a373, 0x8f3346e6, - 0xc5178b8d, 0x515e115b, 0xa2bc22b6, 0x9e09432d, 0xe763801b, - 0x15b60677, 0x2b6c0cee, 0x56d819dc, 0xadb033b8, 0x80116131, - 0xdb53c423, 0x6dd68e07, 0xdbad1c0e, 0x6c2b3e5d, 0xd8567cba, - 0x6bddff35, 0xd7bbfe6a - }, - { - 0xce3371cb, 0x4717e5d7, 0x8e2fcbae, 0xc72e911d, 0x552c247b, - 0xaa5848f6, 0x8fc197ad, 0xc4f2291b, 0x52955477, 0xa52aa8ee, - 0x9124579d, 0xf939a97b, 0x290254b7, 0x5204a96e, 0xa40952dc, - 0x9363a3f9, 0xfdb641b3, 0x201d8527, 0x403b0a4e, 0x8076149c, - 0xdb9d2f79, 0x6c4b58b3, 0xd896b166, 0x6a5c648d, 0xd4b8c91a, - 0x72009475, 0xe40128ea, 0x13735795, 0x26e6af2a, 0x4dcd5e54, - 0x9b9abca8, 0xec447f11 - }, - { - 0x1072db28, 0x20e5b650, 0x41cb6ca0, 0x8396d940, 0xdc5cb4c1, - 0x63c86fc3, 0xc790df86, 0x5450b94d, 0xa8a1729a, 0x8a33e375, - 0xcf16c0ab, 0x455c8717, 0x8ab90e2e, 0xce031a1d, 0x4777327b, - 0x8eee64f6, 0xc6adcfad, 0x562a991b, 0xac553236, 0x83db622d, - 0xdcc7c21b, 0x62fe8277, 0xc5fd04ee, 0x508b0f9d, 0xa1161f3a, - 0x995d3835, 0xe9cb762b, 0x08e7ea17, 0x11cfd42e, 0x239fa85c, - 0x473f50b8, 0x8e7ea170 - }, - { - 0xf891f16f, 0x2a52e49f, 0x54a5c93e, 0xa94b927c, 0x89e622b9, - 0xc8bd4333, 0x4a0b8027, 0x9417004e, 0xf35f06dd, 0x3dcf0bfb, - 0x7b9e17f6, 0xf73c2fec, 0x35095999, 0x6a12b332, 0xd4256664, - 0x733bca89, 0xe6779512, 0x179e2c65, 0x2f3c58ca, 0x5e78b194, - 0xbcf16328, 0xa293c011, 0x9e568663, 0xe7dc0a87, 0x14c9134f, - 0x2992269e, 0x53244d3c, 0xa6489a78, 0x97e032b1, 0xf4b16323, - 0x3213c007, 0x6427800e - }, - { - 0x88b6ba63, 0xca1c7287, 0x4f49e34f, 0x9e93c69e, 0xe6568b7d, - 0x17dc10bb, 0x2fb82176, 0x5f7042ec, 0xbee085d8, 0xa6b00df1, - 0x96111da3, 0xf7533d07, 0x35d77c4f, 0x6baef89e, 0xd75df13c, - 0x75cae439, 0xeb95c872, 0x0c5a96a5, 0x18b52d4a, 0x316a5a94, - 0x62d4b528, 0xc5a96a50, 0x5023d2e1, 0xa047a5c2, 0x9bfe4dc5, - 0xec8d9dcb, 0x026a3dd7, 0x04d47bae, 0x09a8f75c, 0x1351eeb8, - 0x26a3dd70, 0x4d47bae0 - }, - { - 0x5ad8a92c, 0xb5b15258, 0xb013a2f1, 0xbb5643a3, 0xaddd8107, - 0x80ca044f, 0xdae50edf, 0x6ebb1bff, 0xdd7637fe, 0x619d69bd, - 0xc33ad37a, 0x5d04a0b5, 0xba09416a, 0xaf638495, 0x85b60f6b, - 0xd01d1897, 0x7b4b376f, 0xf6966ede, 0x365ddbfd, 0x6cbbb7fa, - 0xd9776ff4, 0x699fd9a9, 0xd33fb352, 0x7d0e60e5, 0xfa1cc1ca, - 0x2f4885d5, 0x5e910baa, 0xbd221754, 0xa13528e9, 0x991b5793, - 0xe947a967, 0x09fe548f - }, - { - 0xb566f6e2, 0xb1bceb85, 0xb808d14b, 0xab60a4d7, 0x8db04fef, - 0xc011999f, 0x5b52357f, 0xb6a46afe, 0xb639d3bd, 0xb702a13b, - 0xb5744437, 0xb1998e2f, 0xb8421a1f, 0xabf5327f, 0x8c9b62bf, - 0xc247c33f, 0x5ffe803f, 0xbffd007e, 0xa48b06bd, 0x92670b3b, - 0xffbf1037, 0x240f262f, 0x481e4c5e, 0x903c98bc, 0xfb083739, - 0x2d616833, 0x5ac2d066, 0xb585a0cc, 0xb07a47d9, 0xbb8589f3, - 0xac7a15a7, 0x83852d0f - }, - { - 0x9d9129bf, 0xe053553f, 0x1bd7ac3f, 0x37af587e, 0x6f5eb0fc, - 0xdebd61f8, 0x660bc5b1, 0xcc178b62, 0x435e1085, 0x86bc210a, - 0xd6094455, 0x77638eeb, 0xeec71dd6, 0x06ff3ded, 0x0dfe7bda, - 0x1bfcf7b4, 0x37f9ef68, 0x6ff3ded0, 0xdfe7bda0, 0x64be7d01, - 0xc97cfa02, 0x4988f245, 0x9311e48a, 0xfd52cf55, 0x21d498eb, - 0x43a931d6, 0x875263ac, 0xd5d5c119, 0x70da8473, 0xe1b508e6, - 0x181b178d, 0x30362f1a - }, - { - 0x2ee43a2c, 0x5dc87458, 0xbb90e8b0, 0xac50d721, 0x83d0a803, - 0xdcd05647, 0x62d1aacf, 0xc5a3559e, 0x5037ad7d, 0xa06f5afa, - 0x9bafb3b5, 0xec2e612b, 0x032dc417, 0x065b882e, 0x0cb7105c, - 0x196e20b8, 0x32dc4170, 0x65b882e0, 0xcb7105c0, 0x4d930dc1, - 0x9b261b82, 0xed3d3145, 0x010b64cb, 0x0216c996, 0x042d932c, - 0x085b2658, 0x10b64cb0, 0x216c9960, 0x42d932c0, 0x85b26580, - 0xd015cd41, 0x7b5a9cc3 - }, - { - 0x1b4511ee, 0x368a23dc, 0x6d1447b8, 0xda288f70, 0x6f2018a1, - 0xde403142, 0x67f164c5, 0xcfe2c98a, 0x44b49555, 0x89692aaa, - 0xc9a35315, 0x4837a06b, 0x906f40d6, 0xfbaf87ed, 0x2c2e099b, - 0x585c1336, 0xb0b8266c, 0xba014a99, 0xaf739373, 0x859620a7, - 0xd05d470f, 0x7bcb885f, 0xf79710be, 0x345f273d, 0x68be4e7a, - 0xd17c9cf4, 0x79883fa9, 0xf3107f52, 0x3d51f8e5, 0x7aa3f1ca, - 0xf547e394, 0x31fec169 - }, - { - 0xbce15202, 0xa2b3a245, 0x9e1642cb, 0xe75d83d7, 0x15ca01ef, - 0x2b9403de, 0x572807bc, 0xae500f78, 0x87d118b1, 0xd4d33723, - 0x72d76807, 0xe5aed00e, 0x102ca65d, 0x20594cba, 0x40b29974, - 0x816532e8, 0xd9bb6391, 0x6807c163, 0xd00f82c6, 0x7b6e03cd, - 0xf6dc079a, 0x36c90975, 0x6d9212ea, 0xdb2425d4, 0x6d394de9, - 0xda729bd2, 0x6f9431e5, 0xdf2863ca, 0x6521c1d5, 0xca4383aa, - 0x4ff60115, 0x9fec022a - }, - { - 0xff08e5ef, 0x2560cd9f, 0x4ac19b3e, 0x9583367c, 0xf0776ab9, - 0x3b9fd333, 0x773fa666, 0xee7f4ccc, 0x078f9fd9, 0x0f1f3fb2, - 0x1e3e7f64, 0x3c7cfec8, 0x78f9fd90, 0xf1f3fb20, 0x3896f001, - 0x712de002, 0xe25bc004, 0x1fc68649, 0x3f8d0c92, 0x7f1a1924, - 0xfe343248, 0x271962d1, 0x4e32c5a2, 0x9c658b44, 0xe3ba10c9, - 0x1c0527d3, 0x380a4fa6, 0x70149f4c, 0xe0293e98, 0x1b237b71, - 0x3646f6e2, 0x6c8dedc4 - }, - { - 0x6f76172e, 0xdeec2e5c, 0x66a95af9, 0xcd52b5f2, 0x41d46da5, - 0x83a8db4a, 0xdc20b0d5, 0x633067eb, 0xc660cfd6, 0x57b099ed, - 0xaf6133da, 0x85b361f5, 0xd017c5ab, 0x7b5e8d17, 0xf6bd1a2e, - 0x360b321d, 0x6c16643a, 0xd82cc874, 0x6b2896a9, 0xd6512d52, - 0x77d35ce5, 0xefa6b9ca, 0x043c75d5, 0x0878ebaa, 0x10f1d754, - 0x21e3aea8, 0x43c75d50, 0x878ebaa0, 0xd46c7301, 0x73a9e043, - 0xe753c086, 0x15d6874d - }, - { - 0x56f5cab9, 0xadeb9572, 0x80a62ca5, 0xda3d5f0b, 0x6f0bb857, - 0xde1770ae, 0x675fe71d, 0xcebfce3a, 0x460e9a35, 0x8c1d346a, - 0xc34b6e95, 0x5de7db6b, 0xbbcfb6d6, 0xacee6bed, 0x82add19b, - 0xde2aa577, 0x67244caf, 0xce48995e, 0x47e034fd, 0x8fc069fa, - 0xc4f1d5b5, 0x5292ad2b, 0xa5255a56, 0x913bb2ed, 0xf906639b, - 0x297dc177, 0x52fb82ee, 0xa5f705dc, 0x909f0df9, 0xfa4f1db3, - 0x2fef3d27, 0x5fde7a4e - }, - { - 0x385993ac, 0x70b32758, 0xe1664eb0, 0x19bd9b21, 0x337b3642, - 0x66f66c84, 0xcdecd908, 0x40a8b451, 0x815168a2, 0xd9d3d705, - 0x68d6a84b, 0xd1ad5096, 0x782ba76d, 0xf0574eda, 0x3bdf9bf5, - 0x77bf37ea, 0xef7e6fd4, 0x058dd9e9, 0x0b1bb3d2, 0x163767a4, - 0x2c6ecf48, 0x58dd9e90, 0xb1bb3d20, 0xb8077c01, 0xab7ffe43, - 0x8d8efac7, 0xc06cf3cf, 0x5ba8e1df, 0xb751c3be, 0xb5d2813d, - 0xb0d4043b, 0xbad90e37 - }, - { - 0xb4247b20, 0xb339f001, 0xbd02e643, 0xa174cac7, 0x999893cf, - 0xe84021df, 0x0bf145ff, 0x17e28bfe, 0x2fc517fc, 0x5f8a2ff8, - 0xbf145ff0, 0xa559b9a1, 0x91c27503, 0xf8f5ec47, 0x2a9adecf, - 0x5535bd9e, 0xaa6b7b3c, 0x8fa7f039, 0xc43ee633, 0x530cca27, - 0xa619944e, 0x97422edd, 0xf5f55bfb, 0x309bb1b7, 0x6137636e, - 0xc26ec6dc, 0x5fac8bf9, 0xbf5917f2, 0xa5c329a5, 0x90f7550b, - 0xfa9fac57, 0x2e4e5eef - }, - { - 0x695186a7, 0xd2a30d4e, 0x7e371cdd, 0xfc6e39ba, 0x23ad7535, - 0x475aea6a, 0x8eb5d4d4, 0xc61aafe9, 0x57445993, 0xae88b326, - 0x8660600d, 0xd7b1c65b, 0x74128af7, 0xe82515ee, 0x0b3b2d9d, - 0x16765b3a, 0x2cecb674, 0x59d96ce8, 0xb3b2d9d0, 0xbc14b5e1, - 0xa3586d83, 0x9dc1dd47, 0xe0f2bccf, 0x1a947fdf, 0x3528ffbe, - 0x6a51ff7c, 0xd4a3fef8, 0x7236fbb1, 0xe46df762, 0x13aae885, - 0x2755d10a, 0x4eaba214 - }, - { - 0x66bc001e, 0xcd78003c, 0x41810639, 0x83020c72, 0xdd751ea5, - 0x619b3b0b, 0xc3367616, 0x5d1dea6d, 0xba3bd4da, 0xaf06aff5, - 0x857c59ab, 0xd189b517, 0x78626c6f, 0xf0c4d8de, 0x3af8b7fd, - 0x75f16ffa, 0xebe2dff4, 0x0cb4b9a9, 0x19697352, 0x32d2e6a4, - 0x65a5cd48, 0xcb4b9a90, 0x4de63361, 0x9bcc66c2, 0xece9cbc5, - 0x02a291cb, 0x05452396, 0x0a8a472c, 0x15148e58, 0x2a291cb0, - 0x54523960, 0xa8a472c0 - }, - { - 0xb58b27b3, 0xb0674927, 0xbbbf940f, 0xac0e2e5f, 0x836d5aff, - 0xddabb3bf, 0x6026613f, 0xc04cc27e, 0x5be882bd, 0xb7d1057a, - 0xb4d30cb5, 0xb2d71f2b, 0xbedf3817, 0xa6cf766f, 0x96efea9f, - 0xf6aed37f, 0x362ca0bf, 0x6c59417e, 0xd8b282fc, 0x6a1403b9, - 0xd4280772, 0x732108a5, 0xe642114a, 0x17f524d5, 0x2fea49aa, - 0x5fd49354, 0xbfa926a8, 0xa4234b11, 0x93379063, 0xfd1e2687, - 0x214d4b4f, 0x429a969e - }, - { - 0xfe273162, 0x273f6485, 0x4e7ec90a, 0x9cfd9214, 0xe28a2269, - 0x1e654293, 0x3cca8526, 0x79950a4c, 0xf32a1498, 0x3d252f71, - 0x7a4a5ee2, 0xf494bdc4, 0x32587dc9, 0x64b0fb92, 0xc961f724, - 0x49b2e809, 0x9365d012, 0xfdbaa665, 0x20044a8b, 0x40089516, - 0x80112a2c, 0xdb535219, 0x6dd7a273, 0xdbaf44e6, 0x6c2f8f8d, - 0xd85f1f1a, 0x6bcf3875, 0xd79e70ea, 0x744de795, 0xe89bcf2a, - 0x0a469815, 0x148d302a - }, - { - 0xd3c98813, 0x7ce21667, 0xf9c42cce, 0x28f95fdd, 0x51f2bfba, - 0xa3e57f74, 0x9cbbf8a9, 0xe206f713, 0x1f7ce867, 0x3ef9d0ce, - 0x7df3a19c, 0xfbe74338, 0x2cbf8031, 0x597f0062, 0xb2fe00c4, - 0xbe8d07c9, 0xa66b09d3, 0x97a715e7, 0xf43f2d8f, 0x330f5d5f, - 0x661ebabe, 0xcc3d757c, 0x430becb9, 0x8617d972, 0xd75eb4a5, - 0x75cc6f0b, 0xeb98de16, 0x0c40ba6d, 0x188174da, 0x3102e9b4, - 0x6205d368, 0xc40ba6d0 - }, - { - 0xf7d6deb4, 0x34dcbb29, 0x69b97652, 0xd372eca4, 0x7d94df09, - 0xfb29be12, 0x2d227a65, 0x5a44f4ca, 0xb489e994, 0xb262d569, - 0xbfb4ac93, 0xa4185f67, 0x9341b88f, 0xfdf2775f, 0x2095e8ff, - 0x412bd1fe, 0x8257a3fc, 0xdfde41b9, 0x64cd8533, 0xc99b0a66, - 0x4847128d, 0x908e251a, 0xfa6d4c75, 0x2fab9eab, 0x5f573d56, - 0xbeae7aac, 0xa62df319, 0x972ae073, 0xf524c6a7, 0x31388b0f, - 0x6271161e, 0xc4e22c3c - }, - { - 0xedb88320, 0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x00000100, - 0x00000200, 0x00000400, 0x00000800, 0x00001000, 0x00002000, - 0x00004000, 0x00008000, 0x00010000, 0x00020000, 0x00040000, - 0x00080000, 0x00100000, 0x00200000, 0x00400000, 0x00800000, - 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, - 0x20000000, 0x40000000 - }, - { - 0x76dc4190, 0xedb88320, 0x00000001, 0x00000002, 0x00000004, - 0x00000008, 0x00000010, 0x00000020, 0x00000040, 0x00000080, - 0x00000100, 0x00000200, 0x00000400, 0x00000800, 0x00001000, - 0x00002000, 0x00004000, 0x00008000, 0x00010000, 0x00020000, - 0x00040000, 0x00080000, 0x00100000, 0x00200000, 0x00400000, - 0x00800000, 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000 - }, - { - 0x1db71064, 0x3b6e20c8, 0x76dc4190, 0xedb88320, 0x00000001, - 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020, - 0x00000040, 0x00000080, 0x00000100, 0x00000200, 0x00000400, - 0x00000800, 0x00001000, 0x00002000, 0x00004000, 0x00008000, - 0x00010000, 0x00020000, 0x00040000, 0x00080000, 0x00100000, - 0x00200000, 0x00400000, 0x00800000, 0x01000000, 0x02000000, - 0x04000000, 0x08000000 - } -}; - -#endif /* CRC32_COMB_TBL_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/crc32_comb_tbl.h b/internal-complibs/zlib-ng-2.0.7/crc32_comb_tbl.h deleted file mode 100644 index 43818c3e0..000000000 --- a/internal-complibs/zlib-ng-2.0.7/crc32_comb_tbl.h +++ /dev/null @@ -1,300 +0,0 @@ -#ifndef CRC32_COMB_TBL_H_ -#define CRC32_COMB_TBL_H_ - -/* crc32_comb_tbl.h -- zero operators table for CRC combine - * Generated automatically by makecrct.c - */ - -static const uint32_t crc_comb[32][32] = -{ - { - 0x77073096, 0xee0e612c, 0x076dc419, 0x0edb8832, 0x1db71064, - 0x3b6e20c8, 0x76dc4190, 0xedb88320, 0x00000001, 0x00000002, - 0x00000004, 0x00000008, 0x00000010, 0x00000020, 0x00000040, - 0x00000080, 0x00000100, 0x00000200, 0x00000400, 0x00000800, - 0x00001000, 0x00002000, 0x00004000, 0x00008000, 0x00010000, - 0x00020000, 0x00040000, 0x00080000, 0x00100000, 0x00200000, - 0x00400000, 0x00800000 - }, - { - 0x191b3141, 0x32366282, 0x646cc504, 0xc8d98a08, 0x4ac21251, - 0x958424a2, 0xf0794f05, 0x3b83984b, 0x77073096, 0xee0e612c, - 0x076dc419, 0x0edb8832, 0x1db71064, 0x3b6e20c8, 0x76dc4190, - 0xedb88320, 0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x00000100, - 0x00000200, 0x00000400, 0x00000800, 0x00001000, 0x00002000, - 0x00004000, 0x00008000 - }, - { - 0xb8bc6765, 0xaa09c88b, 0x8f629757, 0xc5b428ef, 0x5019579f, - 0xa032af3e, 0x9b14583d, 0xed59b63b, 0x01c26a37, 0x0384d46e, - 0x0709a8dc, 0x0e1351b8, 0x1c26a370, 0x384d46e0, 0x709a8dc0, - 0xe1351b80, 0x191b3141, 0x32366282, 0x646cc504, 0xc8d98a08, - 0x4ac21251, 0x958424a2, 0xf0794f05, 0x3b83984b, 0x77073096, - 0xee0e612c, 0x076dc419, 0x0edb8832, 0x1db71064, 0x3b6e20c8, - 0x76dc4190, 0xedb88320 - }, - { - 0xccaa009e, 0x4225077d, 0x844a0efa, 0xd3e51bb5, 0x7cbb312b, - 0xf9766256, 0x299dc2ed, 0x533b85da, 0xa6770bb4, 0x979f1129, - 0xf44f2413, 0x33ef4e67, 0x67de9cce, 0xcfbd399c, 0x440b7579, - 0x8816eaf2, 0xcb5cd3a5, 0x4dc8a10b, 0x9b914216, 0xec53826d, - 0x03d6029b, 0x07ac0536, 0x0f580a6c, 0x1eb014d8, 0x3d6029b0, - 0x7ac05360, 0xf580a6c0, 0x30704bc1, 0x60e09782, 0xc1c12f04, - 0x58f35849, 0xb1e6b092 - }, - { - 0xae689191, 0x87a02563, 0xd4314c87, 0x73139f4f, 0xe6273e9e, - 0x173f7b7d, 0x2e7ef6fa, 0x5cfdedf4, 0xb9fbdbe8, 0xa886b191, - 0x8a7c6563, 0xcf89cc87, 0x44629f4f, 0x88c53e9e, 0xcafb7b7d, - 0x4e87f0bb, 0x9d0fe176, 0xe16ec4ad, 0x19ac8f1b, 0x33591e36, - 0x66b23c6c, 0xcd6478d8, 0x41b9f7f1, 0x8373efe2, 0xdd96d985, - 0x605cb54b, 0xc0b96a96, 0x5a03d36d, 0xb407a6da, 0xb37e4bf5, - 0xbd8d91ab, 0xa06a2517 - }, - { - 0xf1da05aa, 0x38c50d15, 0x718a1a2a, 0xe3143454, 0x1d596ee9, - 0x3ab2ddd2, 0x7565bba4, 0xeacb7748, 0x0ee7e8d1, 0x1dcfd1a2, - 0x3b9fa344, 0x773f4688, 0xee7e8d10, 0x078c1c61, 0x0f1838c2, - 0x1e307184, 0x3c60e308, 0x78c1c610, 0xf1838c20, 0x38761e01, - 0x70ec3c02, 0xe1d87804, 0x18c1f649, 0x3183ec92, 0x6307d924, - 0xc60fb248, 0x576e62d1, 0xaedcc5a2, 0x86c88d05, 0xd6e01c4b, - 0x76b13ed7, 0xed627dae - }, - { - 0x8f352d95, 0xc51b5d6b, 0x5147bc97, 0xa28f792e, 0x9e6ff41d, - 0xe7aeee7b, 0x142cdab7, 0x2859b56e, 0x50b36adc, 0xa166d5b8, - 0x99bcad31, 0xe8085c23, 0x0b61be07, 0x16c37c0e, 0x2d86f81c, - 0x5b0df038, 0xb61be070, 0xb746c6a1, 0xb5fc8b03, 0xb0881047, - 0xba6126cf, 0xafb34bdf, 0x841791ff, 0xd35e25bf, 0x7dcd4d3f, - 0xfb9a9a7e, 0x2c4432bd, 0x5888657a, 0xb110caf4, 0xb95093a9, - 0xa9d02113, 0x88d14467 - }, - { - 0x33fff533, 0x67ffea66, 0xcfffd4cc, 0x448eafd9, 0x891d5fb2, - 0xc94bb925, 0x49e6740b, 0x93cce816, 0xfce8d66d, 0x22a0aa9b, - 0x45415536, 0x8a82aa6c, 0xce745299, 0x4799a373, 0x8f3346e6, - 0xc5178b8d, 0x515e115b, 0xa2bc22b6, 0x9e09432d, 0xe763801b, - 0x15b60677, 0x2b6c0cee, 0x56d819dc, 0xadb033b8, 0x80116131, - 0xdb53c423, 0x6dd68e07, 0xdbad1c0e, 0x6c2b3e5d, 0xd8567cba, - 0x6bddff35, 0xd7bbfe6a - }, - { - 0xce3371cb, 0x4717e5d7, 0x8e2fcbae, 0xc72e911d, 0x552c247b, - 0xaa5848f6, 0x8fc197ad, 0xc4f2291b, 0x52955477, 0xa52aa8ee, - 0x9124579d, 0xf939a97b, 0x290254b7, 0x5204a96e, 0xa40952dc, - 0x9363a3f9, 0xfdb641b3, 0x201d8527, 0x403b0a4e, 0x8076149c, - 0xdb9d2f79, 0x6c4b58b3, 0xd896b166, 0x6a5c648d, 0xd4b8c91a, - 0x72009475, 0xe40128ea, 0x13735795, 0x26e6af2a, 0x4dcd5e54, - 0x9b9abca8, 0xec447f11 - }, - { - 0x1072db28, 0x20e5b650, 0x41cb6ca0, 0x8396d940, 0xdc5cb4c1, - 0x63c86fc3, 0xc790df86, 0x5450b94d, 0xa8a1729a, 0x8a33e375, - 0xcf16c0ab, 0x455c8717, 0x8ab90e2e, 0xce031a1d, 0x4777327b, - 0x8eee64f6, 0xc6adcfad, 0x562a991b, 0xac553236, 0x83db622d, - 0xdcc7c21b, 0x62fe8277, 0xc5fd04ee, 0x508b0f9d, 0xa1161f3a, - 0x995d3835, 0xe9cb762b, 0x08e7ea17, 0x11cfd42e, 0x239fa85c, - 0x473f50b8, 0x8e7ea170 - }, - { - 0xf891f16f, 0x2a52e49f, 0x54a5c93e, 0xa94b927c, 0x89e622b9, - 0xc8bd4333, 0x4a0b8027, 0x9417004e, 0xf35f06dd, 0x3dcf0bfb, - 0x7b9e17f6, 0xf73c2fec, 0x35095999, 0x6a12b332, 0xd4256664, - 0x733bca89, 0xe6779512, 0x179e2c65, 0x2f3c58ca, 0x5e78b194, - 0xbcf16328, 0xa293c011, 0x9e568663, 0xe7dc0a87, 0x14c9134f, - 0x2992269e, 0x53244d3c, 0xa6489a78, 0x97e032b1, 0xf4b16323, - 0x3213c007, 0x6427800e - }, - { - 0x88b6ba63, 0xca1c7287, 0x4f49e34f, 0x9e93c69e, 0xe6568b7d, - 0x17dc10bb, 0x2fb82176, 0x5f7042ec, 0xbee085d8, 0xa6b00df1, - 0x96111da3, 0xf7533d07, 0x35d77c4f, 0x6baef89e, 0xd75df13c, - 0x75cae439, 0xeb95c872, 0x0c5a96a5, 0x18b52d4a, 0x316a5a94, - 0x62d4b528, 0xc5a96a50, 0x5023d2e1, 0xa047a5c2, 0x9bfe4dc5, - 0xec8d9dcb, 0x026a3dd7, 0x04d47bae, 0x09a8f75c, 0x1351eeb8, - 0x26a3dd70, 0x4d47bae0 - }, - { - 0x5ad8a92c, 0xb5b15258, 0xb013a2f1, 0xbb5643a3, 0xaddd8107, - 0x80ca044f, 0xdae50edf, 0x6ebb1bff, 0xdd7637fe, 0x619d69bd, - 0xc33ad37a, 0x5d04a0b5, 0xba09416a, 0xaf638495, 0x85b60f6b, - 0xd01d1897, 0x7b4b376f, 0xf6966ede, 0x365ddbfd, 0x6cbbb7fa, - 0xd9776ff4, 0x699fd9a9, 0xd33fb352, 0x7d0e60e5, 0xfa1cc1ca, - 0x2f4885d5, 0x5e910baa, 0xbd221754, 0xa13528e9, 0x991b5793, - 0xe947a967, 0x09fe548f - }, - { - 0xb566f6e2, 0xb1bceb85, 0xb808d14b, 0xab60a4d7, 0x8db04fef, - 0xc011999f, 0x5b52357f, 0xb6a46afe, 0xb639d3bd, 0xb702a13b, - 0xb5744437, 0xb1998e2f, 0xb8421a1f, 0xabf5327f, 0x8c9b62bf, - 0xc247c33f, 0x5ffe803f, 0xbffd007e, 0xa48b06bd, 0x92670b3b, - 0xffbf1037, 0x240f262f, 0x481e4c5e, 0x903c98bc, 0xfb083739, - 0x2d616833, 0x5ac2d066, 0xb585a0cc, 0xb07a47d9, 0xbb8589f3, - 0xac7a15a7, 0x83852d0f - }, - { - 0x9d9129bf, 0xe053553f, 0x1bd7ac3f, 0x37af587e, 0x6f5eb0fc, - 0xdebd61f8, 0x660bc5b1, 0xcc178b62, 0x435e1085, 0x86bc210a, - 0xd6094455, 0x77638eeb, 0xeec71dd6, 0x06ff3ded, 0x0dfe7bda, - 0x1bfcf7b4, 0x37f9ef68, 0x6ff3ded0, 0xdfe7bda0, 0x64be7d01, - 0xc97cfa02, 0x4988f245, 0x9311e48a, 0xfd52cf55, 0x21d498eb, - 0x43a931d6, 0x875263ac, 0xd5d5c119, 0x70da8473, 0xe1b508e6, - 0x181b178d, 0x30362f1a - }, - { - 0x2ee43a2c, 0x5dc87458, 0xbb90e8b0, 0xac50d721, 0x83d0a803, - 0xdcd05647, 0x62d1aacf, 0xc5a3559e, 0x5037ad7d, 0xa06f5afa, - 0x9bafb3b5, 0xec2e612b, 0x032dc417, 0x065b882e, 0x0cb7105c, - 0x196e20b8, 0x32dc4170, 0x65b882e0, 0xcb7105c0, 0x4d930dc1, - 0x9b261b82, 0xed3d3145, 0x010b64cb, 0x0216c996, 0x042d932c, - 0x085b2658, 0x10b64cb0, 0x216c9960, 0x42d932c0, 0x85b26580, - 0xd015cd41, 0x7b5a9cc3 - }, - { - 0x1b4511ee, 0x368a23dc, 0x6d1447b8, 0xda288f70, 0x6f2018a1, - 0xde403142, 0x67f164c5, 0xcfe2c98a, 0x44b49555, 0x89692aaa, - 0xc9a35315, 0x4837a06b, 0x906f40d6, 0xfbaf87ed, 0x2c2e099b, - 0x585c1336, 0xb0b8266c, 0xba014a99, 0xaf739373, 0x859620a7, - 0xd05d470f, 0x7bcb885f, 0xf79710be, 0x345f273d, 0x68be4e7a, - 0xd17c9cf4, 0x79883fa9, 0xf3107f52, 0x3d51f8e5, 0x7aa3f1ca, - 0xf547e394, 0x31fec169 - }, - { - 0xbce15202, 0xa2b3a245, 0x9e1642cb, 0xe75d83d7, 0x15ca01ef, - 0x2b9403de, 0x572807bc, 0xae500f78, 0x87d118b1, 0xd4d33723, - 0x72d76807, 0xe5aed00e, 0x102ca65d, 0x20594cba, 0x40b29974, - 0x816532e8, 0xd9bb6391, 0x6807c163, 0xd00f82c6, 0x7b6e03cd, - 0xf6dc079a, 0x36c90975, 0x6d9212ea, 0xdb2425d4, 0x6d394de9, - 0xda729bd2, 0x6f9431e5, 0xdf2863ca, 0x6521c1d5, 0xca4383aa, - 0x4ff60115, 0x9fec022a - }, - { - 0xff08e5ef, 0x2560cd9f, 0x4ac19b3e, 0x9583367c, 0xf0776ab9, - 0x3b9fd333, 0x773fa666, 0xee7f4ccc, 0x078f9fd9, 0x0f1f3fb2, - 0x1e3e7f64, 0x3c7cfec8, 0x78f9fd90, 0xf1f3fb20, 0x3896f001, - 0x712de002, 0xe25bc004, 0x1fc68649, 0x3f8d0c92, 0x7f1a1924, - 0xfe343248, 0x271962d1, 0x4e32c5a2, 0x9c658b44, 0xe3ba10c9, - 0x1c0527d3, 0x380a4fa6, 0x70149f4c, 0xe0293e98, 0x1b237b71, - 0x3646f6e2, 0x6c8dedc4 - }, - { - 0x6f76172e, 0xdeec2e5c, 0x66a95af9, 0xcd52b5f2, 0x41d46da5, - 0x83a8db4a, 0xdc20b0d5, 0x633067eb, 0xc660cfd6, 0x57b099ed, - 0xaf6133da, 0x85b361f5, 0xd017c5ab, 0x7b5e8d17, 0xf6bd1a2e, - 0x360b321d, 0x6c16643a, 0xd82cc874, 0x6b2896a9, 0xd6512d52, - 0x77d35ce5, 0xefa6b9ca, 0x043c75d5, 0x0878ebaa, 0x10f1d754, - 0x21e3aea8, 0x43c75d50, 0x878ebaa0, 0xd46c7301, 0x73a9e043, - 0xe753c086, 0x15d6874d - }, - { - 0x56f5cab9, 0xadeb9572, 0x80a62ca5, 0xda3d5f0b, 0x6f0bb857, - 0xde1770ae, 0x675fe71d, 0xcebfce3a, 0x460e9a35, 0x8c1d346a, - 0xc34b6e95, 0x5de7db6b, 0xbbcfb6d6, 0xacee6bed, 0x82add19b, - 0xde2aa577, 0x67244caf, 0xce48995e, 0x47e034fd, 0x8fc069fa, - 0xc4f1d5b5, 0x5292ad2b, 0xa5255a56, 0x913bb2ed, 0xf906639b, - 0x297dc177, 0x52fb82ee, 0xa5f705dc, 0x909f0df9, 0xfa4f1db3, - 0x2fef3d27, 0x5fde7a4e - }, - { - 0x385993ac, 0x70b32758, 0xe1664eb0, 0x19bd9b21, 0x337b3642, - 0x66f66c84, 0xcdecd908, 0x40a8b451, 0x815168a2, 0xd9d3d705, - 0x68d6a84b, 0xd1ad5096, 0x782ba76d, 0xf0574eda, 0x3bdf9bf5, - 0x77bf37ea, 0xef7e6fd4, 0x058dd9e9, 0x0b1bb3d2, 0x163767a4, - 0x2c6ecf48, 0x58dd9e90, 0xb1bb3d20, 0xb8077c01, 0xab7ffe43, - 0x8d8efac7, 0xc06cf3cf, 0x5ba8e1df, 0xb751c3be, 0xb5d2813d, - 0xb0d4043b, 0xbad90e37 - }, - { - 0xb4247b20, 0xb339f001, 0xbd02e643, 0xa174cac7, 0x999893cf, - 0xe84021df, 0x0bf145ff, 0x17e28bfe, 0x2fc517fc, 0x5f8a2ff8, - 0xbf145ff0, 0xa559b9a1, 0x91c27503, 0xf8f5ec47, 0x2a9adecf, - 0x5535bd9e, 0xaa6b7b3c, 0x8fa7f039, 0xc43ee633, 0x530cca27, - 0xa619944e, 0x97422edd, 0xf5f55bfb, 0x309bb1b7, 0x6137636e, - 0xc26ec6dc, 0x5fac8bf9, 0xbf5917f2, 0xa5c329a5, 0x90f7550b, - 0xfa9fac57, 0x2e4e5eef - }, - { - 0x695186a7, 0xd2a30d4e, 0x7e371cdd, 0xfc6e39ba, 0x23ad7535, - 0x475aea6a, 0x8eb5d4d4, 0xc61aafe9, 0x57445993, 0xae88b326, - 0x8660600d, 0xd7b1c65b, 0x74128af7, 0xe82515ee, 0x0b3b2d9d, - 0x16765b3a, 0x2cecb674, 0x59d96ce8, 0xb3b2d9d0, 0xbc14b5e1, - 0xa3586d83, 0x9dc1dd47, 0xe0f2bccf, 0x1a947fdf, 0x3528ffbe, - 0x6a51ff7c, 0xd4a3fef8, 0x7236fbb1, 0xe46df762, 0x13aae885, - 0x2755d10a, 0x4eaba214 - }, - { - 0x66bc001e, 0xcd78003c, 0x41810639, 0x83020c72, 0xdd751ea5, - 0x619b3b0b, 0xc3367616, 0x5d1dea6d, 0xba3bd4da, 0xaf06aff5, - 0x857c59ab, 0xd189b517, 0x78626c6f, 0xf0c4d8de, 0x3af8b7fd, - 0x75f16ffa, 0xebe2dff4, 0x0cb4b9a9, 0x19697352, 0x32d2e6a4, - 0x65a5cd48, 0xcb4b9a90, 0x4de63361, 0x9bcc66c2, 0xece9cbc5, - 0x02a291cb, 0x05452396, 0x0a8a472c, 0x15148e58, 0x2a291cb0, - 0x54523960, 0xa8a472c0 - }, - { - 0xb58b27b3, 0xb0674927, 0xbbbf940f, 0xac0e2e5f, 0x836d5aff, - 0xddabb3bf, 0x6026613f, 0xc04cc27e, 0x5be882bd, 0xb7d1057a, - 0xb4d30cb5, 0xb2d71f2b, 0xbedf3817, 0xa6cf766f, 0x96efea9f, - 0xf6aed37f, 0x362ca0bf, 0x6c59417e, 0xd8b282fc, 0x6a1403b9, - 0xd4280772, 0x732108a5, 0xe642114a, 0x17f524d5, 0x2fea49aa, - 0x5fd49354, 0xbfa926a8, 0xa4234b11, 0x93379063, 0xfd1e2687, - 0x214d4b4f, 0x429a969e - }, - { - 0xfe273162, 0x273f6485, 0x4e7ec90a, 0x9cfd9214, 0xe28a2269, - 0x1e654293, 0x3cca8526, 0x79950a4c, 0xf32a1498, 0x3d252f71, - 0x7a4a5ee2, 0xf494bdc4, 0x32587dc9, 0x64b0fb92, 0xc961f724, - 0x49b2e809, 0x9365d012, 0xfdbaa665, 0x20044a8b, 0x40089516, - 0x80112a2c, 0xdb535219, 0x6dd7a273, 0xdbaf44e6, 0x6c2f8f8d, - 0xd85f1f1a, 0x6bcf3875, 0xd79e70ea, 0x744de795, 0xe89bcf2a, - 0x0a469815, 0x148d302a - }, - { - 0xd3c98813, 0x7ce21667, 0xf9c42cce, 0x28f95fdd, 0x51f2bfba, - 0xa3e57f74, 0x9cbbf8a9, 0xe206f713, 0x1f7ce867, 0x3ef9d0ce, - 0x7df3a19c, 0xfbe74338, 0x2cbf8031, 0x597f0062, 0xb2fe00c4, - 0xbe8d07c9, 0xa66b09d3, 0x97a715e7, 0xf43f2d8f, 0x330f5d5f, - 0x661ebabe, 0xcc3d757c, 0x430becb9, 0x8617d972, 0xd75eb4a5, - 0x75cc6f0b, 0xeb98de16, 0x0c40ba6d, 0x188174da, 0x3102e9b4, - 0x6205d368, 0xc40ba6d0 - }, - { - 0xf7d6deb4, 0x34dcbb29, 0x69b97652, 0xd372eca4, 0x7d94df09, - 0xfb29be12, 0x2d227a65, 0x5a44f4ca, 0xb489e994, 0xb262d569, - 0xbfb4ac93, 0xa4185f67, 0x9341b88f, 0xfdf2775f, 0x2095e8ff, - 0x412bd1fe, 0x8257a3fc, 0xdfde41b9, 0x64cd8533, 0xc99b0a66, - 0x4847128d, 0x908e251a, 0xfa6d4c75, 0x2fab9eab, 0x5f573d56, - 0xbeae7aac, 0xa62df319, 0x972ae073, 0xf524c6a7, 0x31388b0f, - 0x6271161e, 0xc4e22c3c - }, - { - 0xedb88320, 0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x00000100, - 0x00000200, 0x00000400, 0x00000800, 0x00001000, 0x00002000, - 0x00004000, 0x00008000, 0x00010000, 0x00020000, 0x00040000, - 0x00080000, 0x00100000, 0x00200000, 0x00400000, 0x00800000, - 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, - 0x20000000, 0x40000000 - }, - { - 0x76dc4190, 0xedb88320, 0x00000001, 0x00000002, 0x00000004, - 0x00000008, 0x00000010, 0x00000020, 0x00000040, 0x00000080, - 0x00000100, 0x00000200, 0x00000400, 0x00000800, 0x00001000, - 0x00002000, 0x00004000, 0x00008000, 0x00010000, 0x00020000, - 0x00040000, 0x00080000, 0x00100000, 0x00200000, 0x00400000, - 0x00800000, 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000 - }, - { - 0x1db71064, 0x3b6e20c8, 0x76dc4190, 0xedb88320, 0x00000001, - 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020, - 0x00000040, 0x00000080, 0x00000100, 0x00000200, 0x00000400, - 0x00000800, 0x00001000, 0x00002000, 0x00004000, 0x00008000, - 0x00010000, 0x00020000, 0x00040000, 0x00080000, 0x00100000, - 0x00200000, 0x00400000, 0x00800000, 0x01000000, 0x02000000, - 0x04000000, 0x08000000 - } -}; - -#endif /* CRC32_COMB_TBL_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/crc32_p.h b/internal-complibs/zlib-ng-2.0.7/crc32_p.h deleted file mode 100644 index 47b4b3751..000000000 --- a/internal-complibs/zlib-ng-2.0.7/crc32_p.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef CRC32_P_H_ -#define CRC32_P_H_ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ - - -static inline uint32_t gf2_matrix_times(const uint32_t *mat, uint32_t vec) { - uint32_t sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; -} - - -#endif /* CRC32_P_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/crc32_tbl._h b/internal-complibs/zlib-ng-2.0.7/crc32_tbl._h deleted file mode 100644 index ee2030c6c..000000000 --- a/internal-complibs/zlib-ng-2.0.7/crc32_tbl._h +++ /dev/null @@ -1,444 +0,0 @@ -#ifndef CRC32_TBL_H_ -#define CRC32_TBL_H_ - -/* crc32_tbl.h -- tables for rapid CRC calculation - * Generated automatically by makecrct.c - */ - -static const uint32_t crc_table[8][256] = -{ - { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, - 0x2d02ef8d - }, - { - 0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, 0x646cc504, - 0x7d77f445, 0x565aa786, 0x4f4196c7, 0xc8d98a08, 0xd1c2bb49, - 0xfaefe88a, 0xe3f4d9cb, 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, - 0x87981ccf, 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, - 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, 0x821b9859, - 0x9b00a918, 0xb02dfadb, 0xa936cb9a, 0xe6775d5d, 0xff6c6c1c, - 0xd4413fdf, 0xcd5a0e9e, 0x958424a2, 0x8c9f15e3, 0xa7b24620, - 0xbea97761, 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, - 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, 0x39316bae, - 0x202a5aef, 0x0b07092c, 0x121c386d, 0xdf4636f3, 0xc65d07b2, - 0xed705471, 0xf46b6530, 0xbb2af3f7, 0xa231c2b6, 0x891c9175, - 0x9007a034, 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, - 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, 0xf0794f05, - 0xe9627e44, 0xc24f2d87, 0xdb541cc6, 0x94158a01, 0x8d0ebb40, - 0xa623e883, 0xbf38d9c2, 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, - 0x138d96ce, 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, - 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, 0xded79850, - 0xc7cca911, 0xece1fad2, 0xf5facb93, 0x7262d75c, 0x6b79e61d, - 0x4054b5de, 0x594f849f, 0x160e1258, 0x0f152319, 0x243870da, - 0x3d23419b, 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, - 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, 0xad24e1af, - 0xb43fd0ee, 0x9f12832d, 0x8609b26c, 0xc94824ab, 0xd05315ea, - 0xfb7e4629, 0xe2657768, 0x2f3f79f6, 0x362448b7, 0x1d091b74, - 0x04122a35, 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, - 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, 0x838a36fa, - 0x9a9107bb, 0xb1bc5478, 0xa8a76539, 0x3b83984b, 0x2298a90a, - 0x09b5fac9, 0x10aecb88, 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, - 0x74c20e8c, 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, - 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, 0x71418a1a, - 0x685abb5b, 0x4377e898, 0x5a6cd9d9, 0x152d4f1e, 0x0c367e5f, - 0x271b2d9c, 0x3e001cdd, 0xb9980012, 0xa0833153, 0x8bae6290, - 0x92b553d1, 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, - 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, 0xca6b79ed, - 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, 0x66de36e1, 0x7fc507a0, - 0x54e85463, 0x4df36522, 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, - 0x299fa026, 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, - 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, 0x2c1c24b0, - 0x350715f1, 0x1e2a4632, 0x07317773, 0x4870e1b4, 0x516bd0f5, - 0x7a468336, 0x635db277, 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, - 0xe0d7848d, 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, - 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, 0x674f9842, - 0x7e54a903, 0x5579fac0, 0x4c62cb81, 0x8138c51f, 0x9823f45e, - 0xb30ea79d, 0xaa1596dc, 0xe554001b, 0xfc4f315a, 0xd7626299, - 0xce7953d8, 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, - 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, 0x5e7ef3ec, - 0x4765c2ad, 0x6c48916e, 0x7553a02f, 0x3a1236e8, 0x230907a9, - 0x0824546a, 0x113f652b, 0x96a779e4, 0x8fbc48a5, 0xa4911b66, - 0xbd8a2a27, 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, - 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, 0x70d024b9, - 0x69cb15f8, 0x42e6463b, 0x5bfd777a, 0xdc656bb5, 0xc57e5af4, - 0xee530937, 0xf7483876, 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, - 0x9324fd72 - }, - { - 0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, 0x0709a8dc, - 0x06cbc2eb, 0x048d7cb2, 0x054f1685, 0x0e1351b8, 0x0fd13b8f, - 0x0d9785d6, 0x0c55efe1, 0x091af964, 0x08d89353, 0x0a9e2d0a, - 0x0b5c473d, 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, - 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, 0x1235f2c8, - 0x13f798ff, 0x11b126a6, 0x10734c91, 0x153c5a14, 0x14fe3023, - 0x16b88e7a, 0x177ae44d, 0x384d46e0, 0x398f2cd7, 0x3bc9928e, - 0x3a0bf8b9, 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, - 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, 0x3157bf84, - 0x3095d5b3, 0x32d36bea, 0x331101dd, 0x246be590, 0x25a98fa7, - 0x27ef31fe, 0x262d5bc9, 0x23624d4c, 0x22a0277b, 0x20e69922, - 0x2124f315, 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, - 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, 0x709a8dc0, - 0x7158e7f7, 0x731e59ae, 0x72dc3399, 0x7793251c, 0x76514f2b, - 0x7417f172, 0x75d59b45, 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, - 0x7ccf6221, 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, - 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, 0x6bb5866c, - 0x6a77ec5b, 0x68315202, 0x69f33835, 0x62af7f08, 0x636d153f, - 0x612bab66, 0x60e9c151, 0x65a6d7d4, 0x6464bde3, 0x662203ba, - 0x67e0698d, 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, - 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, 0x46c49a98, - 0x4706f0af, 0x45404ef6, 0x448224c1, 0x41cd3244, 0x400f5873, - 0x4249e62a, 0x438b8c1d, 0x54f16850, 0x55330267, 0x5775bc3e, - 0x56b7d609, 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, - 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, 0x5deb9134, - 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, 0xe1351b80, 0xe0f771b7, - 0xe2b1cfee, 0xe373a5d9, 0xe63cb35c, 0xe7fed96b, 0xe5b86732, - 0xe47a0d05, 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, - 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, 0xfd13b8f0, - 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, 0xfa1a102c, 0xfbd87a1b, - 0xf99ec442, 0xf85cae75, 0xf300e948, 0xf2c2837f, 0xf0843d26, - 0xf1465711, 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, - 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, 0xde71f5bc, - 0xdfb39f8b, 0xddf521d2, 0xdc374be5, 0xd76b0cd8, 0xd6a966ef, - 0xd4efd8b6, 0xd52db281, 0xd062a404, 0xd1a0ce33, 0xd3e6706a, - 0xd2241a5d, 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, - 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, 0xcb4dafa8, - 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, 0xcc440774, 0xcd866d43, - 0xcfc0d31a, 0xce02b92d, 0x91af9640, 0x906dfc77, 0x922b422e, - 0x93e92819, 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, - 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, 0x98b56f24, - 0x99770513, 0x9b31bb4a, 0x9af3d17d, 0x8d893530, 0x8c4b5f07, - 0x8e0de15e, 0x8fcf8b69, 0x8a809dec, 0x8b42f7db, 0x89044982, - 0x88c623b5, 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, - 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, 0xa9e2d0a0, - 0xa820ba97, 0xaa6604ce, 0xaba46ef9, 0xaeeb787c, 0xaf29124b, - 0xad6fac12, 0xacadc625, 0xa7f18118, 0xa633eb2f, 0xa4755576, - 0xa5b73f41, 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, - 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, 0xb2cddb0c, - 0xb30fb13b, 0xb1490f62, 0xb08b6555, 0xbbd72268, 0xba15485f, - 0xb853f606, 0xb9919c31, 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, - 0xbe9834ed - }, - { - 0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, 0x8f629757, - 0x37def032, 0x256b5fdc, 0x9dd738b9, 0xc5b428ef, 0x7d084f8a, - 0x6fbde064, 0xd7018701, 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, - 0x58631056, 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, - 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, 0x95ad7f70, - 0x2d111815, 0x3fa4b7fb, 0x8718d09e, 0x1acfe827, 0xa2738f42, - 0xb0c620ac, 0x087a47c9, 0xa032af3e, 0x188ec85b, 0x0a3b67b5, - 0xb28700d0, 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, - 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, 0xeae41086, - 0x525877e3, 0x40edd80d, 0xf851bf68, 0xf02bf8a1, 0x48979fc4, - 0x5a22302a, 0xe29e574f, 0x7f496ff6, 0xc7f50893, 0xd540a77d, - 0x6dfcc018, 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, - 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, 0x9b14583d, - 0x23a83f58, 0x311d90b6, 0x89a1f7d3, 0x1476cf6a, 0xaccaa80f, - 0xbe7f07e1, 0x06c36084, 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, - 0x4c15df3c, 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, - 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, 0x446f98f5, - 0xfcd3ff90, 0xee66507e, 0x56da371b, 0x0eb9274d, 0xb6054028, - 0xa4b0efc6, 0x1c0c88a3, 0x81dbb01a, 0x3967d77f, 0x2bd27891, - 0x936e1ff4, 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, - 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, 0xfe92dfec, - 0x462eb889, 0x549b1767, 0xec277002, 0x71f048bb, 0xc94c2fde, - 0xdbf98030, 0x6345e755, 0x6b3fa09c, 0xd383c7f9, 0xc1366817, - 0x798a0f72, 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, - 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, 0x21e91f24, - 0x99557841, 0x8be0d7af, 0x335cb0ca, 0xed59b63b, 0x55e5d15e, - 0x47507eb0, 0xffec19d5, 0x623b216c, 0xda874609, 0xc832e9e7, - 0x708e8e82, 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, - 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, 0xbd40e1a4, - 0x05fc86c1, 0x1749292f, 0xaff54e4a, 0x322276f3, 0x8a9e1196, - 0x982bbe78, 0x2097d91d, 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, - 0x6a4166a5, 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, - 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, 0xc2098e52, - 0x7ab5e937, 0x680046d9, 0xd0bc21bc, 0x88df31ea, 0x3063568f, - 0x22d6f961, 0x9a6a9e04, 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, - 0x15080953, 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, - 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, 0xd8c66675, - 0x607a0110, 0x72cfaefe, 0xca73c99b, 0x57a4f122, 0xef189647, - 0xfdad39a9, 0x45115ecc, 0x764dee06, 0xcef18963, 0xdc44268d, - 0x64f841e8, 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, - 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, 0x3c9b51be, - 0x842736db, 0x96929935, 0x2e2efe50, 0x2654b999, 0x9ee8defc, - 0x8c5d7112, 0x34e11677, 0xa9362ece, 0x118a49ab, 0x033fe645, - 0xbb838120, 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, - 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, 0xd67f4138, - 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, 0x591dd66f, 0xe1a1b10a, - 0xf3141ee4, 0x4ba87981, 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, - 0x017ec639, 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, - 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, 0x090481f0, - 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, 0x43d23e48, 0xfb6e592d, - 0xe9dbf6c3, 0x516791a6, 0xccb0a91f, 0x740cce7a, 0x66b96194, - 0xde0506f1 - }, - { - 0x00000000, 0x96300777, 0x2c610eee, 0xba510999, 0x19c46d07, - 0x8ff46a70, 0x35a563e9, 0xa395649e, 0x3288db0e, 0xa4b8dc79, - 0x1ee9d5e0, 0x88d9d297, 0x2b4cb609, 0xbd7cb17e, 0x072db8e7, - 0x911dbf90, 0x6410b71d, 0xf220b06a, 0x4871b9f3, 0xde41be84, - 0x7dd4da1a, 0xebe4dd6d, 0x51b5d4f4, 0xc785d383, 0x56986c13, - 0xc0a86b64, 0x7af962fd, 0xecc9658a, 0x4f5c0114, 0xd96c0663, - 0x633d0ffa, 0xf50d088d, 0xc8206e3b, 0x5e10694c, 0xe44160d5, - 0x727167a2, 0xd1e4033c, 0x47d4044b, 0xfd850dd2, 0x6bb50aa5, - 0xfaa8b535, 0x6c98b242, 0xd6c9bbdb, 0x40f9bcac, 0xe36cd832, - 0x755cdf45, 0xcf0dd6dc, 0x593dd1ab, 0xac30d926, 0x3a00de51, - 0x8051d7c8, 0x1661d0bf, 0xb5f4b421, 0x23c4b356, 0x9995bacf, - 0x0fa5bdb8, 0x9eb80228, 0x0888055f, 0xb2d90cc6, 0x24e90bb1, - 0x877c6f2f, 0x114c6858, 0xab1d61c1, 0x3d2d66b6, 0x9041dc76, - 0x0671db01, 0xbc20d298, 0x2a10d5ef, 0x8985b171, 0x1fb5b606, - 0xa5e4bf9f, 0x33d4b8e8, 0xa2c90778, 0x34f9000f, 0x8ea80996, - 0x18980ee1, 0xbb0d6a7f, 0x2d3d6d08, 0x976c6491, 0x015c63e6, - 0xf4516b6b, 0x62616c1c, 0xd8306585, 0x4e0062f2, 0xed95066c, - 0x7ba5011b, 0xc1f40882, 0x57c40ff5, 0xc6d9b065, 0x50e9b712, - 0xeab8be8b, 0x7c88b9fc, 0xdf1ddd62, 0x492dda15, 0xf37cd38c, - 0x654cd4fb, 0x5861b24d, 0xce51b53a, 0x7400bca3, 0xe230bbd4, - 0x41a5df4a, 0xd795d83d, 0x6dc4d1a4, 0xfbf4d6d3, 0x6ae96943, - 0xfcd96e34, 0x468867ad, 0xd0b860da, 0x732d0444, 0xe51d0333, - 0x5f4c0aaa, 0xc97c0ddd, 0x3c710550, 0xaa410227, 0x10100bbe, - 0x86200cc9, 0x25b56857, 0xb3856f20, 0x09d466b9, 0x9fe461ce, - 0x0ef9de5e, 0x98c9d929, 0x2298d0b0, 0xb4a8d7c7, 0x173db359, - 0x810db42e, 0x3b5cbdb7, 0xad6cbac0, 0x2083b8ed, 0xb6b3bf9a, - 0x0ce2b603, 0x9ad2b174, 0x3947d5ea, 0xaf77d29d, 0x1526db04, - 0x8316dc73, 0x120b63e3, 0x843b6494, 0x3e6a6d0d, 0xa85a6a7a, - 0x0bcf0ee4, 0x9dff0993, 0x27ae000a, 0xb19e077d, 0x44930ff0, - 0xd2a30887, 0x68f2011e, 0xfec20669, 0x5d5762f7, 0xcb676580, - 0x71366c19, 0xe7066b6e, 0x761bd4fe, 0xe02bd389, 0x5a7ada10, - 0xcc4add67, 0x6fdfb9f9, 0xf9efbe8e, 0x43beb717, 0xd58eb060, - 0xe8a3d6d6, 0x7e93d1a1, 0xc4c2d838, 0x52f2df4f, 0xf167bbd1, - 0x6757bca6, 0xdd06b53f, 0x4b36b248, 0xda2b0dd8, 0x4c1b0aaf, - 0xf64a0336, 0x607a0441, 0xc3ef60df, 0x55df67a8, 0xef8e6e31, - 0x79be6946, 0x8cb361cb, 0x1a8366bc, 0xa0d26f25, 0x36e26852, - 0x95770ccc, 0x03470bbb, 0xb9160222, 0x2f260555, 0xbe3bbac5, - 0x280bbdb2, 0x925ab42b, 0x046ab35c, 0xa7ffd7c2, 0x31cfd0b5, - 0x8b9ed92c, 0x1daede5b, 0xb0c2649b, 0x26f263ec, 0x9ca36a75, - 0x0a936d02, 0xa906099c, 0x3f360eeb, 0x85670772, 0x13570005, - 0x824abf95, 0x147ab8e2, 0xae2bb17b, 0x381bb60c, 0x9b8ed292, - 0x0dbed5e5, 0xb7efdc7c, 0x21dfdb0b, 0xd4d2d386, 0x42e2d4f1, - 0xf8b3dd68, 0x6e83da1f, 0xcd16be81, 0x5b26b9f6, 0xe177b06f, - 0x7747b718, 0xe65a0888, 0x706a0fff, 0xca3b0666, 0x5c0b0111, - 0xff9e658f, 0x69ae62f8, 0xd3ff6b61, 0x45cf6c16, 0x78e20aa0, - 0xeed20dd7, 0x5483044e, 0xc2b30339, 0x612667a7, 0xf71660d0, - 0x4d476949, 0xdb776e3e, 0x4a6ad1ae, 0xdc5ad6d9, 0x660bdf40, - 0xf03bd837, 0x53aebca9, 0xc59ebbde, 0x7fcfb247, 0xe9ffb530, - 0x1cf2bdbd, 0x8ac2baca, 0x3093b353, 0xa6a3b424, 0x0536d0ba, - 0x9306d7cd, 0x2957de54, 0xbf67d923, 0x2e7a66b3, 0xb84a61c4, - 0x021b685d, 0x942b6f2a, 0x37be0bb4, 0xa18e0cc3, 0x1bdf055a, - 0x8def022d - }, - { - 0x00000000, 0x41311b19, 0x82623632, 0xc3532d2b, 0x04c56c64, - 0x45f4777d, 0x86a75a56, 0xc796414f, 0x088ad9c8, 0x49bbc2d1, - 0x8ae8effa, 0xcbd9f4e3, 0x0c4fb5ac, 0x4d7eaeb5, 0x8e2d839e, - 0xcf1c9887, 0x5112c24a, 0x1023d953, 0xd370f478, 0x9241ef61, - 0x55d7ae2e, 0x14e6b537, 0xd7b5981c, 0x96848305, 0x59981b82, - 0x18a9009b, 0xdbfa2db0, 0x9acb36a9, 0x5d5d77e6, 0x1c6c6cff, - 0xdf3f41d4, 0x9e0e5acd, 0xa2248495, 0xe3159f8c, 0x2046b2a7, - 0x6177a9be, 0xa6e1e8f1, 0xe7d0f3e8, 0x2483dec3, 0x65b2c5da, - 0xaaae5d5d, 0xeb9f4644, 0x28cc6b6f, 0x69fd7076, 0xae6b3139, - 0xef5a2a20, 0x2c09070b, 0x6d381c12, 0xf33646df, 0xb2075dc6, - 0x715470ed, 0x30656bf4, 0xf7f32abb, 0xb6c231a2, 0x75911c89, - 0x34a00790, 0xfbbc9f17, 0xba8d840e, 0x79dea925, 0x38efb23c, - 0xff79f373, 0xbe48e86a, 0x7d1bc541, 0x3c2ade58, 0x054f79f0, - 0x447e62e9, 0x872d4fc2, 0xc61c54db, 0x018a1594, 0x40bb0e8d, - 0x83e823a6, 0xc2d938bf, 0x0dc5a038, 0x4cf4bb21, 0x8fa7960a, - 0xce968d13, 0x0900cc5c, 0x4831d745, 0x8b62fa6e, 0xca53e177, - 0x545dbbba, 0x156ca0a3, 0xd63f8d88, 0x970e9691, 0x5098d7de, - 0x11a9ccc7, 0xd2fae1ec, 0x93cbfaf5, 0x5cd76272, 0x1de6796b, - 0xdeb55440, 0x9f844f59, 0x58120e16, 0x1923150f, 0xda703824, - 0x9b41233d, 0xa76bfd65, 0xe65ae67c, 0x2509cb57, 0x6438d04e, - 0xa3ae9101, 0xe29f8a18, 0x21cca733, 0x60fdbc2a, 0xafe124ad, - 0xeed03fb4, 0x2d83129f, 0x6cb20986, 0xab2448c9, 0xea1553d0, - 0x29467efb, 0x687765e2, 0xf6793f2f, 0xb7482436, 0x741b091d, - 0x352a1204, 0xf2bc534b, 0xb38d4852, 0x70de6579, 0x31ef7e60, - 0xfef3e6e7, 0xbfc2fdfe, 0x7c91d0d5, 0x3da0cbcc, 0xfa368a83, - 0xbb07919a, 0x7854bcb1, 0x3965a7a8, 0x4b98833b, 0x0aa99822, - 0xc9fab509, 0x88cbae10, 0x4f5def5f, 0x0e6cf446, 0xcd3fd96d, - 0x8c0ec274, 0x43125af3, 0x022341ea, 0xc1706cc1, 0x804177d8, - 0x47d73697, 0x06e62d8e, 0xc5b500a5, 0x84841bbc, 0x1a8a4171, - 0x5bbb5a68, 0x98e87743, 0xd9d96c5a, 0x1e4f2d15, 0x5f7e360c, - 0x9c2d1b27, 0xdd1c003e, 0x120098b9, 0x533183a0, 0x9062ae8b, - 0xd153b592, 0x16c5f4dd, 0x57f4efc4, 0x94a7c2ef, 0xd596d9f6, - 0xe9bc07ae, 0xa88d1cb7, 0x6bde319c, 0x2aef2a85, 0xed796bca, - 0xac4870d3, 0x6f1b5df8, 0x2e2a46e1, 0xe136de66, 0xa007c57f, - 0x6354e854, 0x2265f34d, 0xe5f3b202, 0xa4c2a91b, 0x67918430, - 0x26a09f29, 0xb8aec5e4, 0xf99fdefd, 0x3accf3d6, 0x7bfde8cf, - 0xbc6ba980, 0xfd5ab299, 0x3e099fb2, 0x7f3884ab, 0xb0241c2c, - 0xf1150735, 0x32462a1e, 0x73773107, 0xb4e17048, 0xf5d06b51, - 0x3683467a, 0x77b25d63, 0x4ed7facb, 0x0fe6e1d2, 0xccb5ccf9, - 0x8d84d7e0, 0x4a1296af, 0x0b238db6, 0xc870a09d, 0x8941bb84, - 0x465d2303, 0x076c381a, 0xc43f1531, 0x850e0e28, 0x42984f67, - 0x03a9547e, 0xc0fa7955, 0x81cb624c, 0x1fc53881, 0x5ef42398, - 0x9da70eb3, 0xdc9615aa, 0x1b0054e5, 0x5a314ffc, 0x996262d7, - 0xd85379ce, 0x174fe149, 0x567efa50, 0x952dd77b, 0xd41ccc62, - 0x138a8d2d, 0x52bb9634, 0x91e8bb1f, 0xd0d9a006, 0xecf37e5e, - 0xadc26547, 0x6e91486c, 0x2fa05375, 0xe836123a, 0xa9070923, - 0x6a542408, 0x2b653f11, 0xe479a796, 0xa548bc8f, 0x661b91a4, - 0x272a8abd, 0xe0bccbf2, 0xa18dd0eb, 0x62defdc0, 0x23efe6d9, - 0xbde1bc14, 0xfcd0a70d, 0x3f838a26, 0x7eb2913f, 0xb924d070, - 0xf815cb69, 0x3b46e642, 0x7a77fd5b, 0xb56b65dc, 0xf45a7ec5, - 0x370953ee, 0x763848f7, 0xb1ae09b8, 0xf09f12a1, 0x33cc3f8a, - 0x72fd2493 - }, - { - 0x00000000, 0x376ac201, 0x6ed48403, 0x59be4602, 0xdca80907, - 0xebc2cb06, 0xb27c8d04, 0x85164f05, 0xb851130e, 0x8f3bd10f, - 0xd685970d, 0xe1ef550c, 0x64f91a09, 0x5393d808, 0x0a2d9e0a, - 0x3d475c0b, 0x70a3261c, 0x47c9e41d, 0x1e77a21f, 0x291d601e, - 0xac0b2f1b, 0x9b61ed1a, 0xc2dfab18, 0xf5b56919, 0xc8f23512, - 0xff98f713, 0xa626b111, 0x914c7310, 0x145a3c15, 0x2330fe14, - 0x7a8eb816, 0x4de47a17, 0xe0464d38, 0xd72c8f39, 0x8e92c93b, - 0xb9f80b3a, 0x3cee443f, 0x0b84863e, 0x523ac03c, 0x6550023d, - 0x58175e36, 0x6f7d9c37, 0x36c3da35, 0x01a91834, 0x84bf5731, - 0xb3d59530, 0xea6bd332, 0xdd011133, 0x90e56b24, 0xa78fa925, - 0xfe31ef27, 0xc95b2d26, 0x4c4d6223, 0x7b27a022, 0x2299e620, - 0x15f32421, 0x28b4782a, 0x1fdeba2b, 0x4660fc29, 0x710a3e28, - 0xf41c712d, 0xc376b32c, 0x9ac8f52e, 0xada2372f, 0xc08d9a70, - 0xf7e75871, 0xae591e73, 0x9933dc72, 0x1c259377, 0x2b4f5176, - 0x72f11774, 0x459bd575, 0x78dc897e, 0x4fb64b7f, 0x16080d7d, - 0x2162cf7c, 0xa4748079, 0x931e4278, 0xcaa0047a, 0xfdcac67b, - 0xb02ebc6c, 0x87447e6d, 0xdefa386f, 0xe990fa6e, 0x6c86b56b, - 0x5bec776a, 0x02523168, 0x3538f369, 0x087faf62, 0x3f156d63, - 0x66ab2b61, 0x51c1e960, 0xd4d7a665, 0xe3bd6464, 0xba032266, - 0x8d69e067, 0x20cbd748, 0x17a11549, 0x4e1f534b, 0x7975914a, - 0xfc63de4f, 0xcb091c4e, 0x92b75a4c, 0xa5dd984d, 0x989ac446, - 0xaff00647, 0xf64e4045, 0xc1248244, 0x4432cd41, 0x73580f40, - 0x2ae64942, 0x1d8c8b43, 0x5068f154, 0x67023355, 0x3ebc7557, - 0x09d6b756, 0x8cc0f853, 0xbbaa3a52, 0xe2147c50, 0xd57ebe51, - 0xe839e25a, 0xdf53205b, 0x86ed6659, 0xb187a458, 0x3491eb5d, - 0x03fb295c, 0x5a456f5e, 0x6d2fad5f, 0x801b35e1, 0xb771f7e0, - 0xeecfb1e2, 0xd9a573e3, 0x5cb33ce6, 0x6bd9fee7, 0x3267b8e5, - 0x050d7ae4, 0x384a26ef, 0x0f20e4ee, 0x569ea2ec, 0x61f460ed, - 0xe4e22fe8, 0xd388ede9, 0x8a36abeb, 0xbd5c69ea, 0xf0b813fd, - 0xc7d2d1fc, 0x9e6c97fe, 0xa90655ff, 0x2c101afa, 0x1b7ad8fb, - 0x42c49ef9, 0x75ae5cf8, 0x48e900f3, 0x7f83c2f2, 0x263d84f0, - 0x115746f1, 0x944109f4, 0xa32bcbf5, 0xfa958df7, 0xcdff4ff6, - 0x605d78d9, 0x5737bad8, 0x0e89fcda, 0x39e33edb, 0xbcf571de, - 0x8b9fb3df, 0xd221f5dd, 0xe54b37dc, 0xd80c6bd7, 0xef66a9d6, - 0xb6d8efd4, 0x81b22dd5, 0x04a462d0, 0x33cea0d1, 0x6a70e6d3, - 0x5d1a24d2, 0x10fe5ec5, 0x27949cc4, 0x7e2adac6, 0x494018c7, - 0xcc5657c2, 0xfb3c95c3, 0xa282d3c1, 0x95e811c0, 0xa8af4dcb, - 0x9fc58fca, 0xc67bc9c8, 0xf1110bc9, 0x740744cc, 0x436d86cd, - 0x1ad3c0cf, 0x2db902ce, 0x4096af91, 0x77fc6d90, 0x2e422b92, - 0x1928e993, 0x9c3ea696, 0xab546497, 0xf2ea2295, 0xc580e094, - 0xf8c7bc9f, 0xcfad7e9e, 0x9613389c, 0xa179fa9d, 0x246fb598, - 0x13057799, 0x4abb319b, 0x7dd1f39a, 0x3035898d, 0x075f4b8c, - 0x5ee10d8e, 0x698bcf8f, 0xec9d808a, 0xdbf7428b, 0x82490489, - 0xb523c688, 0x88649a83, 0xbf0e5882, 0xe6b01e80, 0xd1dadc81, - 0x54cc9384, 0x63a65185, 0x3a181787, 0x0d72d586, 0xa0d0e2a9, - 0x97ba20a8, 0xce0466aa, 0xf96ea4ab, 0x7c78ebae, 0x4b1229af, - 0x12ac6fad, 0x25c6adac, 0x1881f1a7, 0x2feb33a6, 0x765575a4, - 0x413fb7a5, 0xc429f8a0, 0xf3433aa1, 0xaafd7ca3, 0x9d97bea2, - 0xd073c4b5, 0xe71906b4, 0xbea740b6, 0x89cd82b7, 0x0cdbcdb2, - 0x3bb10fb3, 0x620f49b1, 0x55658bb0, 0x6822d7bb, 0x5f4815ba, - 0x06f653b8, 0x319c91b9, 0xb48adebc, 0x83e01cbd, 0xda5e5abf, - 0xed3498be - }, - { - 0x00000000, 0x6567bcb8, 0x8bc809aa, 0xeeafb512, 0x5797628f, - 0x32f0de37, 0xdc5f6b25, 0xb938d79d, 0xef28b4c5, 0x8a4f087d, - 0x64e0bd6f, 0x018701d7, 0xb8bfd64a, 0xddd86af2, 0x3377dfe0, - 0x56106358, 0x9f571950, 0xfa30a5e8, 0x149f10fa, 0x71f8ac42, - 0xc8c07bdf, 0xada7c767, 0x43087275, 0x266fcecd, 0x707fad95, - 0x1518112d, 0xfbb7a43f, 0x9ed01887, 0x27e8cf1a, 0x428f73a2, - 0xac20c6b0, 0xc9477a08, 0x3eaf32a0, 0x5bc88e18, 0xb5673b0a, - 0xd00087b2, 0x6938502f, 0x0c5fec97, 0xe2f05985, 0x8797e53d, - 0xd1878665, 0xb4e03add, 0x5a4f8fcf, 0x3f283377, 0x8610e4ea, - 0xe3775852, 0x0dd8ed40, 0x68bf51f8, 0xa1f82bf0, 0xc49f9748, - 0x2a30225a, 0x4f579ee2, 0xf66f497f, 0x9308f5c7, 0x7da740d5, - 0x18c0fc6d, 0x4ed09f35, 0x2bb7238d, 0xc518969f, 0xa07f2a27, - 0x1947fdba, 0x7c204102, 0x928ff410, 0xf7e848a8, 0x3d58149b, - 0x583fa823, 0xb6901d31, 0xd3f7a189, 0x6acf7614, 0x0fa8caac, - 0xe1077fbe, 0x8460c306, 0xd270a05e, 0xb7171ce6, 0x59b8a9f4, - 0x3cdf154c, 0x85e7c2d1, 0xe0807e69, 0x0e2fcb7b, 0x6b4877c3, - 0xa20f0dcb, 0xc768b173, 0x29c70461, 0x4ca0b8d9, 0xf5986f44, - 0x90ffd3fc, 0x7e5066ee, 0x1b37da56, 0x4d27b90e, 0x284005b6, - 0xc6efb0a4, 0xa3880c1c, 0x1ab0db81, 0x7fd76739, 0x9178d22b, - 0xf41f6e93, 0x03f7263b, 0x66909a83, 0x883f2f91, 0xed589329, - 0x546044b4, 0x3107f80c, 0xdfa84d1e, 0xbacff1a6, 0xecdf92fe, - 0x89b82e46, 0x67179b54, 0x027027ec, 0xbb48f071, 0xde2f4cc9, - 0x3080f9db, 0x55e74563, 0x9ca03f6b, 0xf9c783d3, 0x176836c1, - 0x720f8a79, 0xcb375de4, 0xae50e15c, 0x40ff544e, 0x2598e8f6, - 0x73888bae, 0x16ef3716, 0xf8408204, 0x9d273ebc, 0x241fe921, - 0x41785599, 0xafd7e08b, 0xcab05c33, 0x3bb659ed, 0x5ed1e555, - 0xb07e5047, 0xd519ecff, 0x6c213b62, 0x094687da, 0xe7e932c8, - 0x828e8e70, 0xd49eed28, 0xb1f95190, 0x5f56e482, 0x3a31583a, - 0x83098fa7, 0xe66e331f, 0x08c1860d, 0x6da63ab5, 0xa4e140bd, - 0xc186fc05, 0x2f294917, 0x4a4ef5af, 0xf3762232, 0x96119e8a, - 0x78be2b98, 0x1dd99720, 0x4bc9f478, 0x2eae48c0, 0xc001fdd2, - 0xa566416a, 0x1c5e96f7, 0x79392a4f, 0x97969f5d, 0xf2f123e5, - 0x05196b4d, 0x607ed7f5, 0x8ed162e7, 0xebb6de5f, 0x528e09c2, - 0x37e9b57a, 0xd9460068, 0xbc21bcd0, 0xea31df88, 0x8f566330, - 0x61f9d622, 0x049e6a9a, 0xbda6bd07, 0xd8c101bf, 0x366eb4ad, - 0x53090815, 0x9a4e721d, 0xff29cea5, 0x11867bb7, 0x74e1c70f, - 0xcdd91092, 0xa8beac2a, 0x46111938, 0x2376a580, 0x7566c6d8, - 0x10017a60, 0xfeaecf72, 0x9bc973ca, 0x22f1a457, 0x479618ef, - 0xa939adfd, 0xcc5e1145, 0x06ee4d76, 0x6389f1ce, 0x8d2644dc, - 0xe841f864, 0x51792ff9, 0x341e9341, 0xdab12653, 0xbfd69aeb, - 0xe9c6f9b3, 0x8ca1450b, 0x620ef019, 0x07694ca1, 0xbe519b3c, - 0xdb362784, 0x35999296, 0x50fe2e2e, 0x99b95426, 0xfcdee89e, - 0x12715d8c, 0x7716e134, 0xce2e36a9, 0xab498a11, 0x45e63f03, - 0x208183bb, 0x7691e0e3, 0x13f65c5b, 0xfd59e949, 0x983e55f1, - 0x2106826c, 0x44613ed4, 0xaace8bc6, 0xcfa9377e, 0x38417fd6, - 0x5d26c36e, 0xb389767c, 0xd6eecac4, 0x6fd61d59, 0x0ab1a1e1, - 0xe41e14f3, 0x8179a84b, 0xd769cb13, 0xb20e77ab, 0x5ca1c2b9, - 0x39c67e01, 0x80fea99c, 0xe5991524, 0x0b36a036, 0x6e511c8e, - 0xa7166686, 0xc271da3e, 0x2cde6f2c, 0x49b9d394, 0xf0810409, - 0x95e6b8b1, 0x7b490da3, 0x1e2eb11b, 0x483ed243, 0x2d596efb, - 0xc3f6dbe9, 0xa6916751, 0x1fa9b0cc, 0x7ace0c74, 0x9461b966, - 0xf10605de - } -}; - -#endif /* CRC32_TBL_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/crc32_tbl.h b/internal-complibs/zlib-ng-2.0.7/crc32_tbl.h deleted file mode 100644 index ee2030c6c..000000000 --- a/internal-complibs/zlib-ng-2.0.7/crc32_tbl.h +++ /dev/null @@ -1,444 +0,0 @@ -#ifndef CRC32_TBL_H_ -#define CRC32_TBL_H_ - -/* crc32_tbl.h -- tables for rapid CRC calculation - * Generated automatically by makecrct.c - */ - -static const uint32_t crc_table[8][256] = -{ - { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, - 0x2d02ef8d - }, - { - 0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, 0x646cc504, - 0x7d77f445, 0x565aa786, 0x4f4196c7, 0xc8d98a08, 0xd1c2bb49, - 0xfaefe88a, 0xe3f4d9cb, 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, - 0x87981ccf, 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, - 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, 0x821b9859, - 0x9b00a918, 0xb02dfadb, 0xa936cb9a, 0xe6775d5d, 0xff6c6c1c, - 0xd4413fdf, 0xcd5a0e9e, 0x958424a2, 0x8c9f15e3, 0xa7b24620, - 0xbea97761, 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, - 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, 0x39316bae, - 0x202a5aef, 0x0b07092c, 0x121c386d, 0xdf4636f3, 0xc65d07b2, - 0xed705471, 0xf46b6530, 0xbb2af3f7, 0xa231c2b6, 0x891c9175, - 0x9007a034, 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, - 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, 0xf0794f05, - 0xe9627e44, 0xc24f2d87, 0xdb541cc6, 0x94158a01, 0x8d0ebb40, - 0xa623e883, 0xbf38d9c2, 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, - 0x138d96ce, 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, - 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, 0xded79850, - 0xc7cca911, 0xece1fad2, 0xf5facb93, 0x7262d75c, 0x6b79e61d, - 0x4054b5de, 0x594f849f, 0x160e1258, 0x0f152319, 0x243870da, - 0x3d23419b, 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, - 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, 0xad24e1af, - 0xb43fd0ee, 0x9f12832d, 0x8609b26c, 0xc94824ab, 0xd05315ea, - 0xfb7e4629, 0xe2657768, 0x2f3f79f6, 0x362448b7, 0x1d091b74, - 0x04122a35, 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, - 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, 0x838a36fa, - 0x9a9107bb, 0xb1bc5478, 0xa8a76539, 0x3b83984b, 0x2298a90a, - 0x09b5fac9, 0x10aecb88, 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, - 0x74c20e8c, 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, - 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, 0x71418a1a, - 0x685abb5b, 0x4377e898, 0x5a6cd9d9, 0x152d4f1e, 0x0c367e5f, - 0x271b2d9c, 0x3e001cdd, 0xb9980012, 0xa0833153, 0x8bae6290, - 0x92b553d1, 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, - 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, 0xca6b79ed, - 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, 0x66de36e1, 0x7fc507a0, - 0x54e85463, 0x4df36522, 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, - 0x299fa026, 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, - 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, 0x2c1c24b0, - 0x350715f1, 0x1e2a4632, 0x07317773, 0x4870e1b4, 0x516bd0f5, - 0x7a468336, 0x635db277, 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, - 0xe0d7848d, 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, - 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, 0x674f9842, - 0x7e54a903, 0x5579fac0, 0x4c62cb81, 0x8138c51f, 0x9823f45e, - 0xb30ea79d, 0xaa1596dc, 0xe554001b, 0xfc4f315a, 0xd7626299, - 0xce7953d8, 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, - 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, 0x5e7ef3ec, - 0x4765c2ad, 0x6c48916e, 0x7553a02f, 0x3a1236e8, 0x230907a9, - 0x0824546a, 0x113f652b, 0x96a779e4, 0x8fbc48a5, 0xa4911b66, - 0xbd8a2a27, 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, - 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, 0x70d024b9, - 0x69cb15f8, 0x42e6463b, 0x5bfd777a, 0xdc656bb5, 0xc57e5af4, - 0xee530937, 0xf7483876, 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, - 0x9324fd72 - }, - { - 0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, 0x0709a8dc, - 0x06cbc2eb, 0x048d7cb2, 0x054f1685, 0x0e1351b8, 0x0fd13b8f, - 0x0d9785d6, 0x0c55efe1, 0x091af964, 0x08d89353, 0x0a9e2d0a, - 0x0b5c473d, 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, - 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, 0x1235f2c8, - 0x13f798ff, 0x11b126a6, 0x10734c91, 0x153c5a14, 0x14fe3023, - 0x16b88e7a, 0x177ae44d, 0x384d46e0, 0x398f2cd7, 0x3bc9928e, - 0x3a0bf8b9, 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, - 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, 0x3157bf84, - 0x3095d5b3, 0x32d36bea, 0x331101dd, 0x246be590, 0x25a98fa7, - 0x27ef31fe, 0x262d5bc9, 0x23624d4c, 0x22a0277b, 0x20e69922, - 0x2124f315, 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, - 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, 0x709a8dc0, - 0x7158e7f7, 0x731e59ae, 0x72dc3399, 0x7793251c, 0x76514f2b, - 0x7417f172, 0x75d59b45, 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, - 0x7ccf6221, 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, - 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, 0x6bb5866c, - 0x6a77ec5b, 0x68315202, 0x69f33835, 0x62af7f08, 0x636d153f, - 0x612bab66, 0x60e9c151, 0x65a6d7d4, 0x6464bde3, 0x662203ba, - 0x67e0698d, 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, - 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, 0x46c49a98, - 0x4706f0af, 0x45404ef6, 0x448224c1, 0x41cd3244, 0x400f5873, - 0x4249e62a, 0x438b8c1d, 0x54f16850, 0x55330267, 0x5775bc3e, - 0x56b7d609, 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, - 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, 0x5deb9134, - 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, 0xe1351b80, 0xe0f771b7, - 0xe2b1cfee, 0xe373a5d9, 0xe63cb35c, 0xe7fed96b, 0xe5b86732, - 0xe47a0d05, 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, - 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, 0xfd13b8f0, - 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, 0xfa1a102c, 0xfbd87a1b, - 0xf99ec442, 0xf85cae75, 0xf300e948, 0xf2c2837f, 0xf0843d26, - 0xf1465711, 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, - 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, 0xde71f5bc, - 0xdfb39f8b, 0xddf521d2, 0xdc374be5, 0xd76b0cd8, 0xd6a966ef, - 0xd4efd8b6, 0xd52db281, 0xd062a404, 0xd1a0ce33, 0xd3e6706a, - 0xd2241a5d, 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, - 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, 0xcb4dafa8, - 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, 0xcc440774, 0xcd866d43, - 0xcfc0d31a, 0xce02b92d, 0x91af9640, 0x906dfc77, 0x922b422e, - 0x93e92819, 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, - 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, 0x98b56f24, - 0x99770513, 0x9b31bb4a, 0x9af3d17d, 0x8d893530, 0x8c4b5f07, - 0x8e0de15e, 0x8fcf8b69, 0x8a809dec, 0x8b42f7db, 0x89044982, - 0x88c623b5, 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, - 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, 0xa9e2d0a0, - 0xa820ba97, 0xaa6604ce, 0xaba46ef9, 0xaeeb787c, 0xaf29124b, - 0xad6fac12, 0xacadc625, 0xa7f18118, 0xa633eb2f, 0xa4755576, - 0xa5b73f41, 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, - 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, 0xb2cddb0c, - 0xb30fb13b, 0xb1490f62, 0xb08b6555, 0xbbd72268, 0xba15485f, - 0xb853f606, 0xb9919c31, 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, - 0xbe9834ed - }, - { - 0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, 0x8f629757, - 0x37def032, 0x256b5fdc, 0x9dd738b9, 0xc5b428ef, 0x7d084f8a, - 0x6fbde064, 0xd7018701, 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, - 0x58631056, 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, - 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, 0x95ad7f70, - 0x2d111815, 0x3fa4b7fb, 0x8718d09e, 0x1acfe827, 0xa2738f42, - 0xb0c620ac, 0x087a47c9, 0xa032af3e, 0x188ec85b, 0x0a3b67b5, - 0xb28700d0, 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, - 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, 0xeae41086, - 0x525877e3, 0x40edd80d, 0xf851bf68, 0xf02bf8a1, 0x48979fc4, - 0x5a22302a, 0xe29e574f, 0x7f496ff6, 0xc7f50893, 0xd540a77d, - 0x6dfcc018, 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, - 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, 0x9b14583d, - 0x23a83f58, 0x311d90b6, 0x89a1f7d3, 0x1476cf6a, 0xaccaa80f, - 0xbe7f07e1, 0x06c36084, 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, - 0x4c15df3c, 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, - 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, 0x446f98f5, - 0xfcd3ff90, 0xee66507e, 0x56da371b, 0x0eb9274d, 0xb6054028, - 0xa4b0efc6, 0x1c0c88a3, 0x81dbb01a, 0x3967d77f, 0x2bd27891, - 0x936e1ff4, 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, - 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, 0xfe92dfec, - 0x462eb889, 0x549b1767, 0xec277002, 0x71f048bb, 0xc94c2fde, - 0xdbf98030, 0x6345e755, 0x6b3fa09c, 0xd383c7f9, 0xc1366817, - 0x798a0f72, 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, - 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, 0x21e91f24, - 0x99557841, 0x8be0d7af, 0x335cb0ca, 0xed59b63b, 0x55e5d15e, - 0x47507eb0, 0xffec19d5, 0x623b216c, 0xda874609, 0xc832e9e7, - 0x708e8e82, 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, - 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, 0xbd40e1a4, - 0x05fc86c1, 0x1749292f, 0xaff54e4a, 0x322276f3, 0x8a9e1196, - 0x982bbe78, 0x2097d91d, 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, - 0x6a4166a5, 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, - 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, 0xc2098e52, - 0x7ab5e937, 0x680046d9, 0xd0bc21bc, 0x88df31ea, 0x3063568f, - 0x22d6f961, 0x9a6a9e04, 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, - 0x15080953, 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, - 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, 0xd8c66675, - 0x607a0110, 0x72cfaefe, 0xca73c99b, 0x57a4f122, 0xef189647, - 0xfdad39a9, 0x45115ecc, 0x764dee06, 0xcef18963, 0xdc44268d, - 0x64f841e8, 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, - 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, 0x3c9b51be, - 0x842736db, 0x96929935, 0x2e2efe50, 0x2654b999, 0x9ee8defc, - 0x8c5d7112, 0x34e11677, 0xa9362ece, 0x118a49ab, 0x033fe645, - 0xbb838120, 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, - 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, 0xd67f4138, - 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, 0x591dd66f, 0xe1a1b10a, - 0xf3141ee4, 0x4ba87981, 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, - 0x017ec639, 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, - 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, 0x090481f0, - 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, 0x43d23e48, 0xfb6e592d, - 0xe9dbf6c3, 0x516791a6, 0xccb0a91f, 0x740cce7a, 0x66b96194, - 0xde0506f1 - }, - { - 0x00000000, 0x96300777, 0x2c610eee, 0xba510999, 0x19c46d07, - 0x8ff46a70, 0x35a563e9, 0xa395649e, 0x3288db0e, 0xa4b8dc79, - 0x1ee9d5e0, 0x88d9d297, 0x2b4cb609, 0xbd7cb17e, 0x072db8e7, - 0x911dbf90, 0x6410b71d, 0xf220b06a, 0x4871b9f3, 0xde41be84, - 0x7dd4da1a, 0xebe4dd6d, 0x51b5d4f4, 0xc785d383, 0x56986c13, - 0xc0a86b64, 0x7af962fd, 0xecc9658a, 0x4f5c0114, 0xd96c0663, - 0x633d0ffa, 0xf50d088d, 0xc8206e3b, 0x5e10694c, 0xe44160d5, - 0x727167a2, 0xd1e4033c, 0x47d4044b, 0xfd850dd2, 0x6bb50aa5, - 0xfaa8b535, 0x6c98b242, 0xd6c9bbdb, 0x40f9bcac, 0xe36cd832, - 0x755cdf45, 0xcf0dd6dc, 0x593dd1ab, 0xac30d926, 0x3a00de51, - 0x8051d7c8, 0x1661d0bf, 0xb5f4b421, 0x23c4b356, 0x9995bacf, - 0x0fa5bdb8, 0x9eb80228, 0x0888055f, 0xb2d90cc6, 0x24e90bb1, - 0x877c6f2f, 0x114c6858, 0xab1d61c1, 0x3d2d66b6, 0x9041dc76, - 0x0671db01, 0xbc20d298, 0x2a10d5ef, 0x8985b171, 0x1fb5b606, - 0xa5e4bf9f, 0x33d4b8e8, 0xa2c90778, 0x34f9000f, 0x8ea80996, - 0x18980ee1, 0xbb0d6a7f, 0x2d3d6d08, 0x976c6491, 0x015c63e6, - 0xf4516b6b, 0x62616c1c, 0xd8306585, 0x4e0062f2, 0xed95066c, - 0x7ba5011b, 0xc1f40882, 0x57c40ff5, 0xc6d9b065, 0x50e9b712, - 0xeab8be8b, 0x7c88b9fc, 0xdf1ddd62, 0x492dda15, 0xf37cd38c, - 0x654cd4fb, 0x5861b24d, 0xce51b53a, 0x7400bca3, 0xe230bbd4, - 0x41a5df4a, 0xd795d83d, 0x6dc4d1a4, 0xfbf4d6d3, 0x6ae96943, - 0xfcd96e34, 0x468867ad, 0xd0b860da, 0x732d0444, 0xe51d0333, - 0x5f4c0aaa, 0xc97c0ddd, 0x3c710550, 0xaa410227, 0x10100bbe, - 0x86200cc9, 0x25b56857, 0xb3856f20, 0x09d466b9, 0x9fe461ce, - 0x0ef9de5e, 0x98c9d929, 0x2298d0b0, 0xb4a8d7c7, 0x173db359, - 0x810db42e, 0x3b5cbdb7, 0xad6cbac0, 0x2083b8ed, 0xb6b3bf9a, - 0x0ce2b603, 0x9ad2b174, 0x3947d5ea, 0xaf77d29d, 0x1526db04, - 0x8316dc73, 0x120b63e3, 0x843b6494, 0x3e6a6d0d, 0xa85a6a7a, - 0x0bcf0ee4, 0x9dff0993, 0x27ae000a, 0xb19e077d, 0x44930ff0, - 0xd2a30887, 0x68f2011e, 0xfec20669, 0x5d5762f7, 0xcb676580, - 0x71366c19, 0xe7066b6e, 0x761bd4fe, 0xe02bd389, 0x5a7ada10, - 0xcc4add67, 0x6fdfb9f9, 0xf9efbe8e, 0x43beb717, 0xd58eb060, - 0xe8a3d6d6, 0x7e93d1a1, 0xc4c2d838, 0x52f2df4f, 0xf167bbd1, - 0x6757bca6, 0xdd06b53f, 0x4b36b248, 0xda2b0dd8, 0x4c1b0aaf, - 0xf64a0336, 0x607a0441, 0xc3ef60df, 0x55df67a8, 0xef8e6e31, - 0x79be6946, 0x8cb361cb, 0x1a8366bc, 0xa0d26f25, 0x36e26852, - 0x95770ccc, 0x03470bbb, 0xb9160222, 0x2f260555, 0xbe3bbac5, - 0x280bbdb2, 0x925ab42b, 0x046ab35c, 0xa7ffd7c2, 0x31cfd0b5, - 0x8b9ed92c, 0x1daede5b, 0xb0c2649b, 0x26f263ec, 0x9ca36a75, - 0x0a936d02, 0xa906099c, 0x3f360eeb, 0x85670772, 0x13570005, - 0x824abf95, 0x147ab8e2, 0xae2bb17b, 0x381bb60c, 0x9b8ed292, - 0x0dbed5e5, 0xb7efdc7c, 0x21dfdb0b, 0xd4d2d386, 0x42e2d4f1, - 0xf8b3dd68, 0x6e83da1f, 0xcd16be81, 0x5b26b9f6, 0xe177b06f, - 0x7747b718, 0xe65a0888, 0x706a0fff, 0xca3b0666, 0x5c0b0111, - 0xff9e658f, 0x69ae62f8, 0xd3ff6b61, 0x45cf6c16, 0x78e20aa0, - 0xeed20dd7, 0x5483044e, 0xc2b30339, 0x612667a7, 0xf71660d0, - 0x4d476949, 0xdb776e3e, 0x4a6ad1ae, 0xdc5ad6d9, 0x660bdf40, - 0xf03bd837, 0x53aebca9, 0xc59ebbde, 0x7fcfb247, 0xe9ffb530, - 0x1cf2bdbd, 0x8ac2baca, 0x3093b353, 0xa6a3b424, 0x0536d0ba, - 0x9306d7cd, 0x2957de54, 0xbf67d923, 0x2e7a66b3, 0xb84a61c4, - 0x021b685d, 0x942b6f2a, 0x37be0bb4, 0xa18e0cc3, 0x1bdf055a, - 0x8def022d - }, - { - 0x00000000, 0x41311b19, 0x82623632, 0xc3532d2b, 0x04c56c64, - 0x45f4777d, 0x86a75a56, 0xc796414f, 0x088ad9c8, 0x49bbc2d1, - 0x8ae8effa, 0xcbd9f4e3, 0x0c4fb5ac, 0x4d7eaeb5, 0x8e2d839e, - 0xcf1c9887, 0x5112c24a, 0x1023d953, 0xd370f478, 0x9241ef61, - 0x55d7ae2e, 0x14e6b537, 0xd7b5981c, 0x96848305, 0x59981b82, - 0x18a9009b, 0xdbfa2db0, 0x9acb36a9, 0x5d5d77e6, 0x1c6c6cff, - 0xdf3f41d4, 0x9e0e5acd, 0xa2248495, 0xe3159f8c, 0x2046b2a7, - 0x6177a9be, 0xa6e1e8f1, 0xe7d0f3e8, 0x2483dec3, 0x65b2c5da, - 0xaaae5d5d, 0xeb9f4644, 0x28cc6b6f, 0x69fd7076, 0xae6b3139, - 0xef5a2a20, 0x2c09070b, 0x6d381c12, 0xf33646df, 0xb2075dc6, - 0x715470ed, 0x30656bf4, 0xf7f32abb, 0xb6c231a2, 0x75911c89, - 0x34a00790, 0xfbbc9f17, 0xba8d840e, 0x79dea925, 0x38efb23c, - 0xff79f373, 0xbe48e86a, 0x7d1bc541, 0x3c2ade58, 0x054f79f0, - 0x447e62e9, 0x872d4fc2, 0xc61c54db, 0x018a1594, 0x40bb0e8d, - 0x83e823a6, 0xc2d938bf, 0x0dc5a038, 0x4cf4bb21, 0x8fa7960a, - 0xce968d13, 0x0900cc5c, 0x4831d745, 0x8b62fa6e, 0xca53e177, - 0x545dbbba, 0x156ca0a3, 0xd63f8d88, 0x970e9691, 0x5098d7de, - 0x11a9ccc7, 0xd2fae1ec, 0x93cbfaf5, 0x5cd76272, 0x1de6796b, - 0xdeb55440, 0x9f844f59, 0x58120e16, 0x1923150f, 0xda703824, - 0x9b41233d, 0xa76bfd65, 0xe65ae67c, 0x2509cb57, 0x6438d04e, - 0xa3ae9101, 0xe29f8a18, 0x21cca733, 0x60fdbc2a, 0xafe124ad, - 0xeed03fb4, 0x2d83129f, 0x6cb20986, 0xab2448c9, 0xea1553d0, - 0x29467efb, 0x687765e2, 0xf6793f2f, 0xb7482436, 0x741b091d, - 0x352a1204, 0xf2bc534b, 0xb38d4852, 0x70de6579, 0x31ef7e60, - 0xfef3e6e7, 0xbfc2fdfe, 0x7c91d0d5, 0x3da0cbcc, 0xfa368a83, - 0xbb07919a, 0x7854bcb1, 0x3965a7a8, 0x4b98833b, 0x0aa99822, - 0xc9fab509, 0x88cbae10, 0x4f5def5f, 0x0e6cf446, 0xcd3fd96d, - 0x8c0ec274, 0x43125af3, 0x022341ea, 0xc1706cc1, 0x804177d8, - 0x47d73697, 0x06e62d8e, 0xc5b500a5, 0x84841bbc, 0x1a8a4171, - 0x5bbb5a68, 0x98e87743, 0xd9d96c5a, 0x1e4f2d15, 0x5f7e360c, - 0x9c2d1b27, 0xdd1c003e, 0x120098b9, 0x533183a0, 0x9062ae8b, - 0xd153b592, 0x16c5f4dd, 0x57f4efc4, 0x94a7c2ef, 0xd596d9f6, - 0xe9bc07ae, 0xa88d1cb7, 0x6bde319c, 0x2aef2a85, 0xed796bca, - 0xac4870d3, 0x6f1b5df8, 0x2e2a46e1, 0xe136de66, 0xa007c57f, - 0x6354e854, 0x2265f34d, 0xe5f3b202, 0xa4c2a91b, 0x67918430, - 0x26a09f29, 0xb8aec5e4, 0xf99fdefd, 0x3accf3d6, 0x7bfde8cf, - 0xbc6ba980, 0xfd5ab299, 0x3e099fb2, 0x7f3884ab, 0xb0241c2c, - 0xf1150735, 0x32462a1e, 0x73773107, 0xb4e17048, 0xf5d06b51, - 0x3683467a, 0x77b25d63, 0x4ed7facb, 0x0fe6e1d2, 0xccb5ccf9, - 0x8d84d7e0, 0x4a1296af, 0x0b238db6, 0xc870a09d, 0x8941bb84, - 0x465d2303, 0x076c381a, 0xc43f1531, 0x850e0e28, 0x42984f67, - 0x03a9547e, 0xc0fa7955, 0x81cb624c, 0x1fc53881, 0x5ef42398, - 0x9da70eb3, 0xdc9615aa, 0x1b0054e5, 0x5a314ffc, 0x996262d7, - 0xd85379ce, 0x174fe149, 0x567efa50, 0x952dd77b, 0xd41ccc62, - 0x138a8d2d, 0x52bb9634, 0x91e8bb1f, 0xd0d9a006, 0xecf37e5e, - 0xadc26547, 0x6e91486c, 0x2fa05375, 0xe836123a, 0xa9070923, - 0x6a542408, 0x2b653f11, 0xe479a796, 0xa548bc8f, 0x661b91a4, - 0x272a8abd, 0xe0bccbf2, 0xa18dd0eb, 0x62defdc0, 0x23efe6d9, - 0xbde1bc14, 0xfcd0a70d, 0x3f838a26, 0x7eb2913f, 0xb924d070, - 0xf815cb69, 0x3b46e642, 0x7a77fd5b, 0xb56b65dc, 0xf45a7ec5, - 0x370953ee, 0x763848f7, 0xb1ae09b8, 0xf09f12a1, 0x33cc3f8a, - 0x72fd2493 - }, - { - 0x00000000, 0x376ac201, 0x6ed48403, 0x59be4602, 0xdca80907, - 0xebc2cb06, 0xb27c8d04, 0x85164f05, 0xb851130e, 0x8f3bd10f, - 0xd685970d, 0xe1ef550c, 0x64f91a09, 0x5393d808, 0x0a2d9e0a, - 0x3d475c0b, 0x70a3261c, 0x47c9e41d, 0x1e77a21f, 0x291d601e, - 0xac0b2f1b, 0x9b61ed1a, 0xc2dfab18, 0xf5b56919, 0xc8f23512, - 0xff98f713, 0xa626b111, 0x914c7310, 0x145a3c15, 0x2330fe14, - 0x7a8eb816, 0x4de47a17, 0xe0464d38, 0xd72c8f39, 0x8e92c93b, - 0xb9f80b3a, 0x3cee443f, 0x0b84863e, 0x523ac03c, 0x6550023d, - 0x58175e36, 0x6f7d9c37, 0x36c3da35, 0x01a91834, 0x84bf5731, - 0xb3d59530, 0xea6bd332, 0xdd011133, 0x90e56b24, 0xa78fa925, - 0xfe31ef27, 0xc95b2d26, 0x4c4d6223, 0x7b27a022, 0x2299e620, - 0x15f32421, 0x28b4782a, 0x1fdeba2b, 0x4660fc29, 0x710a3e28, - 0xf41c712d, 0xc376b32c, 0x9ac8f52e, 0xada2372f, 0xc08d9a70, - 0xf7e75871, 0xae591e73, 0x9933dc72, 0x1c259377, 0x2b4f5176, - 0x72f11774, 0x459bd575, 0x78dc897e, 0x4fb64b7f, 0x16080d7d, - 0x2162cf7c, 0xa4748079, 0x931e4278, 0xcaa0047a, 0xfdcac67b, - 0xb02ebc6c, 0x87447e6d, 0xdefa386f, 0xe990fa6e, 0x6c86b56b, - 0x5bec776a, 0x02523168, 0x3538f369, 0x087faf62, 0x3f156d63, - 0x66ab2b61, 0x51c1e960, 0xd4d7a665, 0xe3bd6464, 0xba032266, - 0x8d69e067, 0x20cbd748, 0x17a11549, 0x4e1f534b, 0x7975914a, - 0xfc63de4f, 0xcb091c4e, 0x92b75a4c, 0xa5dd984d, 0x989ac446, - 0xaff00647, 0xf64e4045, 0xc1248244, 0x4432cd41, 0x73580f40, - 0x2ae64942, 0x1d8c8b43, 0x5068f154, 0x67023355, 0x3ebc7557, - 0x09d6b756, 0x8cc0f853, 0xbbaa3a52, 0xe2147c50, 0xd57ebe51, - 0xe839e25a, 0xdf53205b, 0x86ed6659, 0xb187a458, 0x3491eb5d, - 0x03fb295c, 0x5a456f5e, 0x6d2fad5f, 0x801b35e1, 0xb771f7e0, - 0xeecfb1e2, 0xd9a573e3, 0x5cb33ce6, 0x6bd9fee7, 0x3267b8e5, - 0x050d7ae4, 0x384a26ef, 0x0f20e4ee, 0x569ea2ec, 0x61f460ed, - 0xe4e22fe8, 0xd388ede9, 0x8a36abeb, 0xbd5c69ea, 0xf0b813fd, - 0xc7d2d1fc, 0x9e6c97fe, 0xa90655ff, 0x2c101afa, 0x1b7ad8fb, - 0x42c49ef9, 0x75ae5cf8, 0x48e900f3, 0x7f83c2f2, 0x263d84f0, - 0x115746f1, 0x944109f4, 0xa32bcbf5, 0xfa958df7, 0xcdff4ff6, - 0x605d78d9, 0x5737bad8, 0x0e89fcda, 0x39e33edb, 0xbcf571de, - 0x8b9fb3df, 0xd221f5dd, 0xe54b37dc, 0xd80c6bd7, 0xef66a9d6, - 0xb6d8efd4, 0x81b22dd5, 0x04a462d0, 0x33cea0d1, 0x6a70e6d3, - 0x5d1a24d2, 0x10fe5ec5, 0x27949cc4, 0x7e2adac6, 0x494018c7, - 0xcc5657c2, 0xfb3c95c3, 0xa282d3c1, 0x95e811c0, 0xa8af4dcb, - 0x9fc58fca, 0xc67bc9c8, 0xf1110bc9, 0x740744cc, 0x436d86cd, - 0x1ad3c0cf, 0x2db902ce, 0x4096af91, 0x77fc6d90, 0x2e422b92, - 0x1928e993, 0x9c3ea696, 0xab546497, 0xf2ea2295, 0xc580e094, - 0xf8c7bc9f, 0xcfad7e9e, 0x9613389c, 0xa179fa9d, 0x246fb598, - 0x13057799, 0x4abb319b, 0x7dd1f39a, 0x3035898d, 0x075f4b8c, - 0x5ee10d8e, 0x698bcf8f, 0xec9d808a, 0xdbf7428b, 0x82490489, - 0xb523c688, 0x88649a83, 0xbf0e5882, 0xe6b01e80, 0xd1dadc81, - 0x54cc9384, 0x63a65185, 0x3a181787, 0x0d72d586, 0xa0d0e2a9, - 0x97ba20a8, 0xce0466aa, 0xf96ea4ab, 0x7c78ebae, 0x4b1229af, - 0x12ac6fad, 0x25c6adac, 0x1881f1a7, 0x2feb33a6, 0x765575a4, - 0x413fb7a5, 0xc429f8a0, 0xf3433aa1, 0xaafd7ca3, 0x9d97bea2, - 0xd073c4b5, 0xe71906b4, 0xbea740b6, 0x89cd82b7, 0x0cdbcdb2, - 0x3bb10fb3, 0x620f49b1, 0x55658bb0, 0x6822d7bb, 0x5f4815ba, - 0x06f653b8, 0x319c91b9, 0xb48adebc, 0x83e01cbd, 0xda5e5abf, - 0xed3498be - }, - { - 0x00000000, 0x6567bcb8, 0x8bc809aa, 0xeeafb512, 0x5797628f, - 0x32f0de37, 0xdc5f6b25, 0xb938d79d, 0xef28b4c5, 0x8a4f087d, - 0x64e0bd6f, 0x018701d7, 0xb8bfd64a, 0xddd86af2, 0x3377dfe0, - 0x56106358, 0x9f571950, 0xfa30a5e8, 0x149f10fa, 0x71f8ac42, - 0xc8c07bdf, 0xada7c767, 0x43087275, 0x266fcecd, 0x707fad95, - 0x1518112d, 0xfbb7a43f, 0x9ed01887, 0x27e8cf1a, 0x428f73a2, - 0xac20c6b0, 0xc9477a08, 0x3eaf32a0, 0x5bc88e18, 0xb5673b0a, - 0xd00087b2, 0x6938502f, 0x0c5fec97, 0xe2f05985, 0x8797e53d, - 0xd1878665, 0xb4e03add, 0x5a4f8fcf, 0x3f283377, 0x8610e4ea, - 0xe3775852, 0x0dd8ed40, 0x68bf51f8, 0xa1f82bf0, 0xc49f9748, - 0x2a30225a, 0x4f579ee2, 0xf66f497f, 0x9308f5c7, 0x7da740d5, - 0x18c0fc6d, 0x4ed09f35, 0x2bb7238d, 0xc518969f, 0xa07f2a27, - 0x1947fdba, 0x7c204102, 0x928ff410, 0xf7e848a8, 0x3d58149b, - 0x583fa823, 0xb6901d31, 0xd3f7a189, 0x6acf7614, 0x0fa8caac, - 0xe1077fbe, 0x8460c306, 0xd270a05e, 0xb7171ce6, 0x59b8a9f4, - 0x3cdf154c, 0x85e7c2d1, 0xe0807e69, 0x0e2fcb7b, 0x6b4877c3, - 0xa20f0dcb, 0xc768b173, 0x29c70461, 0x4ca0b8d9, 0xf5986f44, - 0x90ffd3fc, 0x7e5066ee, 0x1b37da56, 0x4d27b90e, 0x284005b6, - 0xc6efb0a4, 0xa3880c1c, 0x1ab0db81, 0x7fd76739, 0x9178d22b, - 0xf41f6e93, 0x03f7263b, 0x66909a83, 0x883f2f91, 0xed589329, - 0x546044b4, 0x3107f80c, 0xdfa84d1e, 0xbacff1a6, 0xecdf92fe, - 0x89b82e46, 0x67179b54, 0x027027ec, 0xbb48f071, 0xde2f4cc9, - 0x3080f9db, 0x55e74563, 0x9ca03f6b, 0xf9c783d3, 0x176836c1, - 0x720f8a79, 0xcb375de4, 0xae50e15c, 0x40ff544e, 0x2598e8f6, - 0x73888bae, 0x16ef3716, 0xf8408204, 0x9d273ebc, 0x241fe921, - 0x41785599, 0xafd7e08b, 0xcab05c33, 0x3bb659ed, 0x5ed1e555, - 0xb07e5047, 0xd519ecff, 0x6c213b62, 0x094687da, 0xe7e932c8, - 0x828e8e70, 0xd49eed28, 0xb1f95190, 0x5f56e482, 0x3a31583a, - 0x83098fa7, 0xe66e331f, 0x08c1860d, 0x6da63ab5, 0xa4e140bd, - 0xc186fc05, 0x2f294917, 0x4a4ef5af, 0xf3762232, 0x96119e8a, - 0x78be2b98, 0x1dd99720, 0x4bc9f478, 0x2eae48c0, 0xc001fdd2, - 0xa566416a, 0x1c5e96f7, 0x79392a4f, 0x97969f5d, 0xf2f123e5, - 0x05196b4d, 0x607ed7f5, 0x8ed162e7, 0xebb6de5f, 0x528e09c2, - 0x37e9b57a, 0xd9460068, 0xbc21bcd0, 0xea31df88, 0x8f566330, - 0x61f9d622, 0x049e6a9a, 0xbda6bd07, 0xd8c101bf, 0x366eb4ad, - 0x53090815, 0x9a4e721d, 0xff29cea5, 0x11867bb7, 0x74e1c70f, - 0xcdd91092, 0xa8beac2a, 0x46111938, 0x2376a580, 0x7566c6d8, - 0x10017a60, 0xfeaecf72, 0x9bc973ca, 0x22f1a457, 0x479618ef, - 0xa939adfd, 0xcc5e1145, 0x06ee4d76, 0x6389f1ce, 0x8d2644dc, - 0xe841f864, 0x51792ff9, 0x341e9341, 0xdab12653, 0xbfd69aeb, - 0xe9c6f9b3, 0x8ca1450b, 0x620ef019, 0x07694ca1, 0xbe519b3c, - 0xdb362784, 0x35999296, 0x50fe2e2e, 0x99b95426, 0xfcdee89e, - 0x12715d8c, 0x7716e134, 0xce2e36a9, 0xab498a11, 0x45e63f03, - 0x208183bb, 0x7691e0e3, 0x13f65c5b, 0xfd59e949, 0x983e55f1, - 0x2106826c, 0x44613ed4, 0xaace8bc6, 0xcfa9377e, 0x38417fd6, - 0x5d26c36e, 0xb389767c, 0xd6eecac4, 0x6fd61d59, 0x0ab1a1e1, - 0xe41e14f3, 0x8179a84b, 0xd769cb13, 0xb20e77ab, 0x5ca1c2b9, - 0x39c67e01, 0x80fea99c, 0xe5991524, 0x0b36a036, 0x6e511c8e, - 0xa7166686, 0xc271da3e, 0x2cde6f2c, 0x49b9d394, 0xf0810409, - 0x95e6b8b1, 0x7b490da3, 0x1e2eb11b, 0x483ed243, 0x2d596efb, - 0xc3f6dbe9, 0xa6916751, 0x1fa9b0cc, 0x7ace0c74, 0x9461b966, - 0xf10605de - } -}; - -#endif /* CRC32_TBL_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/deflate_p.h b/internal-complibs/zlib-ng-2.0.7/deflate_p.h deleted file mode 100644 index 7cad8ab0b..000000000 --- a/internal-complibs/zlib-ng-2.0.7/deflate_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/* deflate_p.h -- Private inline functions and macros shared with more than - * one deflate method - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - */ - -#ifndef DEFLATE_P_H -#define DEFLATE_P_H - -/* Forward declare common non-inlined functions declared in deflate.c */ - -#ifdef ZLIB_DEBUG -void check_match(deflate_state *s, Pos start, Pos match, int length); -#else -#define check_match(s, start, match, length) -#endif -void flush_pending(PREFIX3(stream) *strm); - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ - -extern const unsigned char Z_INTERNAL zng_length_code[]; -extern const unsigned char Z_INTERNAL zng_dist_code[]; - -static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { - /* c is the unmatched char */ - s->sym_buf[s->sym_next++] = 0; - s->sym_buf[s->sym_next++] = 0; - s->sym_buf[s->sym_next++] = c; - s->dyn_ltree[c].Freq++; - Tracevv((stderr, "%c", c)); - Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal"); - return (s->sym_next == s->sym_end); -} - -static inline int zng_tr_tally_dist(deflate_state *s, uint32_t dist, uint32_t len) { - /* dist: distance of matched string */ - /* len: match length-MIN_MATCH */ - s->sym_buf[s->sym_next++] = (uint8_t)(dist); - s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); - s->sym_buf[s->sym_next++] = (uint8_t)len; - s->matches++; - dist--; - Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, - "zng_tr_tally: bad match"); - - s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; - s->dyn_dtree[d_code(dist)].Freq++; - return (s->sym_next == s->sym_end); -} - -/* =========================================================================== - * Flush the current block, with given end-of-file flag. - * IN assertion: strstart is set to the end of the current match. - */ -#define FLUSH_BLOCK_ONLY(s, last) { \ - zng_tr_flush_block(s, (s->block_start >= 0 ? \ - (char *)&s->window[(unsigned)s->block_start] : \ - NULL), \ - (uint32_t)((int)s->strstart - s->block_start), \ - (last)); \ - s->block_start = (int)s->strstart; \ - flush_pending(s->strm); \ -} - -/* Same but force premature exit if necessary. */ -#define FLUSH_BLOCK(s, last) { \ - FLUSH_BLOCK_ONLY(s, last); \ - if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ -} - -/* Maximum stored block length in deflate format (not including header). */ -#define MAX_STORED 65535 - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/fallback_builtins.h b/internal-complibs/zlib-ng-2.0.7/fallback_builtins.h deleted file mode 100644 index afa5870ab..000000000 --- a/internal-complibs/zlib-ng-2.0.7/fallback_builtins.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef X86_BUILTIN_CTZ_H -#define X86_BUILTIN_CTZ_H - -#if defined(_MSC_VER) && !defined(__clang__) -#if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64) || defined(_M_ARM) || defined(_M_ARM64) - -#include -#ifdef X86_FEATURES -# include "arch/x86/x86.h" -#endif - -/* This is not a general purpose replacement for __builtin_ctz. The function expects that value is != 0 - * Because of that assumption trailing_zero is not initialized and the return value of _BitScanForward is not checked - */ -static __forceinline unsigned long __builtin_ctz(uint32_t value) { -#ifdef X86_FEATURES -# ifndef X86_NOCHECK_TZCNT - if (x86_cpu_has_tzcnt) -# endif - return _tzcnt_u32(value); -#endif - unsigned long trailing_zero; - _BitScanForward(&trailing_zero, value); - return trailing_zero; -} -#define HAVE_BUILTIN_CTZ - -#ifdef _M_AMD64 -/* This is not a general purpose replacement for __builtin_ctzll. The function expects that value is != 0 - * Because of that assumption trailing_zero is not initialized and the return value of _BitScanForward64 is not checked - */ -static __forceinline unsigned long long __builtin_ctzll(uint64_t value) { -#ifdef X86_FEATURES -# ifndef X86_NOCHECK_TZCNT - if (x86_cpu_has_tzcnt) -# endif - return _tzcnt_u64(value); -#endif - unsigned long trailing_zero; - _BitScanForward64(&trailing_zero, value); - return trailing_zero; -} -#define HAVE_BUILTIN_CTZLL -#endif - -#endif -#endif -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/functable.c b/internal-complibs/zlib-ng-2.0.7/functable.c deleted file mode 100644 index 807f7aed4..000000000 --- a/internal-complibs/zlib-ng-2.0.7/functable.c +++ /dev/null @@ -1,466 +0,0 @@ -/* functable.c -- Choose relevant optimized functions at runtime - * Copyright (C) 2017 Hans Kristian Rosbach - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zendian.h" -#include "deflate.h" -#include "deflate_p.h" - -#include "functable.h" - -#ifdef X86_FEATURES -# include "fallback_builtins.h" -#endif - -/* insert_string */ -extern void insert_string_c(deflate_state *const s, const uint32_t str, uint32_t count); -#ifdef X86_SSE42_CRC_HASH -extern void insert_string_sse4(deflate_state *const s, const uint32_t str, uint32_t count); -#elif defined(ARM_ACLE_CRC_HASH) -extern void insert_string_acle(deflate_state *const s, const uint32_t str, uint32_t count); -#endif - -/* quick_insert_string */ -extern Pos quick_insert_string_c(deflate_state *const s, const uint32_t str); -#ifdef X86_SSE42_CRC_HASH -extern Pos quick_insert_string_sse4(deflate_state *const s, const uint32_t str); -#elif defined(ARM_ACLE_CRC_HASH) -extern Pos quick_insert_string_acle(deflate_state *const s, const uint32_t str); -#endif - -/* slide_hash */ -#ifdef X86_SSE2 -void slide_hash_sse2(deflate_state *s); -#elif defined(ARM_NEON_SLIDEHASH) -void slide_hash_neon(deflate_state *s); -#elif defined(POWER8_VSX_SLIDEHASH) -void slide_hash_power8(deflate_state *s); -#endif -#ifdef X86_AVX2 -void slide_hash_avx2(deflate_state *s); -#endif - -/* adler32 */ -extern uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len); -#ifdef ARM_NEON_ADLER32 -extern uint32_t adler32_neon(uint32_t adler, const unsigned char *buf, size_t len); -#endif -#ifdef X86_SSSE3_ADLER32 -extern uint32_t adler32_ssse3(uint32_t adler, const unsigned char *buf, size_t len); -#endif -#ifdef X86_AVX2_ADLER32 -extern uint32_t adler32_avx2(uint32_t adler, const unsigned char *buf, size_t len); -#endif -#ifdef POWER8_VSX_ADLER32 -extern uint32_t adler32_power8(uint32_t adler, const unsigned char* buf, size_t len); -#endif - -/* memory chunking */ -extern uint32_t chunksize_c(void); -extern uint8_t* chunkcopy_c(uint8_t *out, uint8_t const *from, unsigned len); -extern uint8_t* chunkcopy_safe_c(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); -extern uint8_t* chunkunroll_c(uint8_t *out, unsigned *dist, unsigned *len); -extern uint8_t* chunkmemset_c(uint8_t *out, unsigned dist, unsigned len); -extern uint8_t* chunkmemset_safe_c(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#ifdef X86_SSE2_CHUNKSET -extern uint32_t chunksize_sse2(void); -extern uint8_t* chunkcopy_sse2(uint8_t *out, uint8_t const *from, unsigned len); -extern uint8_t* chunkcopy_safe_sse2(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); -extern uint8_t* chunkunroll_sse2(uint8_t *out, unsigned *dist, unsigned *len); -extern uint8_t* chunkmemset_sse2(uint8_t *out, unsigned dist, unsigned len); -extern uint8_t* chunkmemset_safe_sse2(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif -#ifdef X86_AVX_CHUNKSET -extern uint32_t chunksize_avx(void); -extern uint8_t* chunkcopy_avx(uint8_t *out, uint8_t const *from, unsigned len); -extern uint8_t* chunkcopy_safe_avx(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); -extern uint8_t* chunkunroll_avx(uint8_t *out, unsigned *dist, unsigned *len); -extern uint8_t* chunkmemset_avx(uint8_t *out, unsigned dist, unsigned len); -extern uint8_t* chunkmemset_safe_avx(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif -#ifdef ARM_NEON_CHUNKSET -extern uint32_t chunksize_neon(void); -extern uint8_t* chunkcopy_neon(uint8_t *out, uint8_t const *from, unsigned len); -extern uint8_t* chunkcopy_safe_neon(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); -extern uint8_t* chunkunroll_neon(uint8_t *out, unsigned *dist, unsigned *len); -extern uint8_t* chunkmemset_neon(uint8_t *out, unsigned dist, unsigned len); -extern uint8_t* chunkmemset_safe_neon(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif - -/* CRC32 */ -Z_INTERNAL uint32_t crc32_generic(uint32_t, const unsigned char *, uint64_t); - -#ifdef ARM_ACLE_CRC_HASH -extern uint32_t crc32_acle(uint32_t, const unsigned char *, uint64_t); -#endif - -#if BYTE_ORDER == LITTLE_ENDIAN -extern uint32_t crc32_little(uint32_t, const unsigned char *, uint64_t); -#elif BYTE_ORDER == BIG_ENDIAN -extern uint32_t crc32_big(uint32_t, const unsigned char *, uint64_t); -#endif - -/* compare258 */ -extern uint32_t compare258_c(const unsigned char *src0, const unsigned char *src1); -#ifdef UNALIGNED_OK -extern uint32_t compare258_unaligned_16(const unsigned char *src0, const unsigned char *src1); -extern uint32_t compare258_unaligned_32(const unsigned char *src0, const unsigned char *src1); -#ifdef UNALIGNED64_OK -extern uint32_t compare258_unaligned_64(const unsigned char *src0, const unsigned char *src1); -#endif -#ifdef X86_SSE42_CMP_STR -extern uint32_t compare258_unaligned_sse4(const unsigned char *src0, const unsigned char *src1); -#endif -#if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) -extern uint32_t compare258_unaligned_avx2(const unsigned char *src0, const unsigned char *src1); -#endif -#endif - -/* longest_match */ -extern uint32_t longest_match_c(deflate_state *const s, Pos cur_match); -#ifdef UNALIGNED_OK -extern uint32_t longest_match_unaligned_16(deflate_state *const s, Pos cur_match); -extern uint32_t longest_match_unaligned_32(deflate_state *const s, Pos cur_match); -#ifdef UNALIGNED64_OK -extern uint32_t longest_match_unaligned_64(deflate_state *const s, Pos cur_match); -#endif -#ifdef X86_SSE42_CMP_STR -extern uint32_t longest_match_unaligned_sse4(deflate_state *const s, Pos cur_match); -#endif -#if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) -extern uint32_t longest_match_unaligned_avx2(deflate_state *const s, Pos cur_match); -#endif -#endif - -Z_INTERNAL Z_TLS struct functable_s functable; - -Z_INTERNAL void cpu_check_features(void) -{ - static int features_checked = 0; - if (features_checked) - return; -#if defined(X86_FEATURES) - x86_check_features(); -#elif defined(ARM_FEATURES) - arm_check_features(); -#elif defined(POWER_FEATURES) - power_check_features(); -#endif - features_checked = 1; -} - -/* stub functions */ -Z_INTERNAL void insert_string_stub(deflate_state *const s, const uint32_t str, uint32_t count) { - // Initialize default - - functable.insert_string = &insert_string_c; - cpu_check_features(); - -#ifdef X86_SSE42_CRC_HASH - if (x86_cpu_has_sse42) - functable.insert_string = &insert_string_sse4; -#elif defined(ARM_ACLE_CRC_HASH) - if (arm_cpu_has_crc32) - functable.insert_string = &insert_string_acle; -#endif - - functable.insert_string(s, str, count); -} - -Z_INTERNAL Pos quick_insert_string_stub(deflate_state *const s, const uint32_t str) { - functable.quick_insert_string = &quick_insert_string_c; - -#ifdef X86_SSE42_CRC_HASH - if (x86_cpu_has_sse42) - functable.quick_insert_string = &quick_insert_string_sse4; -#elif defined(ARM_ACLE_CRC_HASH) - if (arm_cpu_has_crc32) - functable.quick_insert_string = &quick_insert_string_acle; -#endif - - return functable.quick_insert_string(s, str); -} - -Z_INTERNAL void slide_hash_stub(deflate_state *s) { - - functable.slide_hash = &slide_hash_c; - cpu_check_features(); - -#ifdef X86_SSE2 -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.slide_hash = &slide_hash_sse2; -#elif defined(ARM_NEON_SLIDEHASH) -# ifndef ARM_NOCHECK_NEON - if (arm_cpu_has_neon) -# endif - functable.slide_hash = &slide_hash_neon; -#endif -#ifdef X86_AVX2 - if (x86_cpu_has_avx2) - functable.slide_hash = &slide_hash_avx2; -#endif -#ifdef POWER8_VSX_SLIDEHASH - if (power_cpu_has_arch_2_07) - functable.slide_hash = &slide_hash_power8; -#endif - - functable.slide_hash(s); -} - -Z_INTERNAL uint32_t adler32_stub(uint32_t adler, const unsigned char *buf, size_t len) { - // Initialize default - functable.adler32 = &adler32_c; - cpu_check_features(); - -#ifdef ARM_NEON_ADLER32 -# ifndef ARM_NOCHECK_NEON - if (arm_cpu_has_neon) -# endif - functable.adler32 = &adler32_neon; -#endif -#ifdef X86_SSSE3_ADLER32 - if (x86_cpu_has_ssse3) - functable.adler32 = &adler32_ssse3; -#endif -#ifdef X86_AVX2_ADLER32 - if (x86_cpu_has_avx2) - functable.adler32 = &adler32_avx2; -#endif -#ifdef POWER8_VSX_ADLER32 - if (power_cpu_has_arch_2_07) - functable.adler32 = &adler32_power8; -#endif - - return functable.adler32(adler, buf, len); -} - -Z_INTERNAL uint32_t chunksize_stub(void) { - // Initialize default - functable.chunksize = &chunksize_c; - cpu_check_features(); - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunksize = &chunksize_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunksize = &chunksize_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunksize = &chunksize_neon; -#endif - - return functable.chunksize(); -} - -Z_INTERNAL uint8_t* chunkcopy_stub(uint8_t *out, uint8_t const *from, unsigned len) { - // Initialize default - functable.chunkcopy = &chunkcopy_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunkcopy = &chunkcopy_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunkcopy = &chunkcopy_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunkcopy = &chunkcopy_neon; -#endif - - return functable.chunkcopy(out, from, len); -} - -Z_INTERNAL uint8_t* chunkcopy_safe_stub(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) { - // Initialize default - functable.chunkcopy_safe = &chunkcopy_safe_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunkcopy_safe = &chunkcopy_safe_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunkcopy_safe = &chunkcopy_safe_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunkcopy_safe = &chunkcopy_safe_neon; -#endif - - return functable.chunkcopy_safe(out, from, len, safe); -} - -Z_INTERNAL uint8_t* chunkunroll_stub(uint8_t *out, unsigned *dist, unsigned *len) { - // Initialize default - functable.chunkunroll = &chunkunroll_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunkunroll = &chunkunroll_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunkunroll = &chunkunroll_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunkunroll = &chunkunroll_neon; -#endif - - return functable.chunkunroll(out, dist, len); -} - -Z_INTERNAL uint8_t* chunkmemset_stub(uint8_t *out, unsigned dist, unsigned len) { - // Initialize default - functable.chunkmemset = &chunkmemset_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunkmemset = &chunkmemset_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunkmemset = &chunkmemset_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunkmemset = &chunkmemset_neon; -#endif - - return functable.chunkmemset(out, dist, len); -} - -Z_INTERNAL uint8_t* chunkmemset_safe_stub(uint8_t *out, unsigned dist, unsigned len, unsigned left) { - // Initialize default - functable.chunkmemset_safe = &chunkmemset_safe_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunkmemset_safe = &chunkmemset_safe_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunkmemset_safe = &chunkmemset_safe_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunkmemset_safe = &chunkmemset_safe_neon; -#endif - - return functable.chunkmemset_safe(out, dist, len, left); -} - -Z_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64_t len) { - int32_t use_byfour = sizeof(void *) == sizeof(ptrdiff_t); - - Assert(sizeof(uint64_t) >= sizeof(size_t), - "crc32_z takes size_t but internally we have a uint64_t len"); - /* return a function pointer for optimized arches here after a capability test */ - - functable.crc32 = &crc32_generic; - cpu_check_features(); - - if (use_byfour) { -#if BYTE_ORDER == LITTLE_ENDIAN - functable.crc32 = crc32_little; -# if defined(ARM_ACLE_CRC_HASH) - if (arm_cpu_has_crc32) - functable.crc32 = crc32_acle; -# endif -#elif BYTE_ORDER == BIG_ENDIAN - functable.crc32 = crc32_big; -#else -# error No endian defined -#endif - } - - return functable.crc32(crc, buf, len); -} - -Z_INTERNAL uint32_t compare258_stub(const unsigned char *src0, const unsigned char *src1) { - - functable.compare258 = &compare258_c; - -#ifdef UNALIGNED_OK -# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) - functable.compare258 = &compare258_unaligned_64; -# elif defined(HAVE_BUILTIN_CTZ) - functable.compare258 = &compare258_unaligned_32; -# else - functable.compare258 = &compare258_unaligned_16; -# endif -# ifdef X86_SSE42_CMP_STR - if (x86_cpu_has_sse42) - functable.compare258 = &compare258_unaligned_sse4; -# endif -# if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) - if (x86_cpu_has_avx2) - functable.compare258 = &compare258_unaligned_avx2; -# endif -#endif - - return functable.compare258(src0, src1); -} - -Z_INTERNAL uint32_t longest_match_stub(deflate_state *const s, Pos cur_match) { - - functable.longest_match = &longest_match_c; - -#ifdef UNALIGNED_OK -# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) - functable.longest_match = &longest_match_unaligned_64; -# elif defined(HAVE_BUILTIN_CTZ) - functable.longest_match = &longest_match_unaligned_32; -# else - functable.longest_match = &longest_match_unaligned_16; -# endif -# ifdef X86_SSE42_CMP_STR - if (x86_cpu_has_sse42) - functable.longest_match = &longest_match_unaligned_sse4; -# endif -# if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) - if (x86_cpu_has_avx2) - functable.longest_match = &longest_match_unaligned_avx2; -# endif -#endif - - return functable.longest_match(s, cur_match); -} - -/* functable init */ -Z_INTERNAL Z_TLS struct functable_s functable = { - insert_string_stub, - quick_insert_string_stub, - adler32_stub, - crc32_stub, - slide_hash_stub, - compare258_stub, - longest_match_stub, - chunksize_stub, - chunkcopy_stub, - chunkcopy_safe_stub, - chunkunroll_stub, - chunkmemset_stub, - chunkmemset_safe_stub -}; diff --git a/internal-complibs/zlib-ng-2.0.7/functable.h b/internal-complibs/zlib-ng-2.0.7/functable.h deleted file mode 100644 index 276c284a0..000000000 --- a/internal-complibs/zlib-ng-2.0.7/functable.h +++ /dev/null @@ -1,29 +0,0 @@ -/* functable.h -- Struct containing function pointers to optimized functions - * Copyright (C) 2017 Hans Kristian Rosbach - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef FUNCTABLE_H_ -#define FUNCTABLE_H_ - -#include "deflate.h" - -struct functable_s { - void (* insert_string) (deflate_state *const s, const uint32_t str, uint32_t count); - Pos (* quick_insert_string)(deflate_state *const s, const uint32_t str); - uint32_t (* adler32) (uint32_t adler, const unsigned char *buf, size_t len); - uint32_t (* crc32) (uint32_t crc, const unsigned char *buf, uint64_t len); - void (* slide_hash) (deflate_state *s); - uint32_t (* compare258) (const unsigned char *src0, const unsigned char *src1); - uint32_t (* longest_match) (deflate_state *const s, Pos cur_match); - uint32_t (* chunksize) (void); - uint8_t* (* chunkcopy) (uint8_t *out, uint8_t const *from, unsigned len); - uint8_t* (* chunkcopy_safe) (uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); - uint8_t* (* chunkunroll) (uint8_t *out, unsigned *dist, unsigned *len); - uint8_t* (* chunkmemset) (uint8_t *out, unsigned dist, unsigned len); - uint8_t* (* chunkmemset_safe) (uint8_t *out, unsigned dist, unsigned len, unsigned left); -}; - -Z_INTERNAL extern Z_TLS struct functable_s functable; - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/inffast.h b/internal-complibs/zlib-ng-2.0.7/inffast.h deleted file mode 100644 index 179a65da6..000000000 --- a/internal-complibs/zlib-ng-2.0.7/inffast.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef INFFAST_H_ -#define INFFAST_H_ -/* inffast.h -- header to use inffast.c - * Copyright (C) 1995-2003, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start); - -#define INFLATE_FAST_MIN_HAVE 8 -#define INFLATE_FAST_MIN_LEFT 258 - -#endif /* INFFAST_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/inffixed_tbl._h b/internal-complibs/zlib-ng-2.0.7/inffixed_tbl._h deleted file mode 100644 index 7292fa06e..000000000 --- a/internal-complibs/zlib-ng-2.0.7/inffixed_tbl._h +++ /dev/null @@ -1,94 +0,0 @@ -/* inffixed_tbl.h -- table for decoding fixed codes - * Generated automatically by makefixed(). - */ - -/* WARNING: this file should *not* be used by applications. - * It is part of the implementation of this library and is - * subject to change. Applications should only use zlib.h. - */ - -static const code lenfix[512] = { - {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, - {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, - {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, - {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, - {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, - {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, - {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, - {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, - {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, - {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, - {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, - {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, - {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, - {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, - {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, - {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, - {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, - {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, - {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, - {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, - {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, - {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, - {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, - {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, - {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, - {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, - {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, - {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, - {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, - {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, - {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, - {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, - {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, - {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, - {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, - {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, - {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, - {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, - {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, - {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, - {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, - {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, - {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, - {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, - {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, - {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, - {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, - {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, - {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, - {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, - {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, - {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, - {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, - {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, - {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, - {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, - {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, - {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, - {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, - {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, - {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, - {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, - {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, - {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, - {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, - {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, - {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, - {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, - {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, - {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, - {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, - {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, - {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, - {0,9,255} -}; - -static const code distfix[32] = { - {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, - {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, - {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, - {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, - {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, - {22,5,193},{64,5,0} -}; diff --git a/internal-complibs/zlib-ng-2.0.7/inflate_p.h b/internal-complibs/zlib-ng-2.0.7/inflate_p.h deleted file mode 100644 index 76fe2dccb..000000000 --- a/internal-complibs/zlib-ng-2.0.7/inflate_p.h +++ /dev/null @@ -1,101 +0,0 @@ -/* inflate_p.h -- Private inline functions and macros shared with more than one deflate method - * - */ - -#ifndef INFLATE_P_H -#define INFLATE_P_H - -/* - * Macros shared by inflate() and inflateBack() - */ - -/* check function to use adler32() for zlib or crc32() for gzip */ -#ifdef GUNZIP -# define UPDATE(check, buf, len) \ - (state->flags ? PREFIX(crc32)(check, buf, len) : functable.adler32(check, buf, len)) -#else -# define UPDATE(check, buf, len) functable.adler32(check, buf, len) -#endif - -/* check macros for header crc */ -#ifdef GUNZIP -# define CRC2(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - check = PREFIX(crc32)(check, hbuf, 2); \ - } while (0) - -# define CRC4(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - hbuf[2] = (unsigned char)((word) >> 16); \ - hbuf[3] = (unsigned char)((word) >> 24); \ - check = PREFIX(crc32)(check, hbuf, 4); \ - } while (0) -#endif - -/* Load registers with state in inflate() for speed */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Restore state from registers in inflate() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = (z_const unsigned char *)next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Ensure that there is at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflate()/inflateBack(). */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - (hold & ((1U << (unsigned)(n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -#endif - -/* Set mode=BAD and prepare error message */ -#define SET_BAD(errmsg) \ - do { \ - state->mode = BAD; \ - strm->msg = (char *)errmsg; \ - } while (0) diff --git a/internal-complibs/zlib-ng-2.0.7/insert_string.c b/internal-complibs/zlib-ng-2.0.7/insert_string.c deleted file mode 100644 index 4ddf9ae5d..000000000 --- a/internal-complibs/zlib-ng-2.0.7/insert_string.c +++ /dev/null @@ -1,25 +0,0 @@ -/* insert_string_c -- insert_string variant for c - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - */ - -#include "zbuild.h" -#include "deflate.h" - -/* =========================================================================== - * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive - * input characters, so that a running hash key can be computed from the - * previous key instead of complete recalculation each time. - */ -#define HASH_SLIDE 16 // Number of bits to slide hash - -#define UPDATE_HASH(s, h, val) \ - h = ((val * 2654435761U) >> HASH_SLIDE); - -#define INSERT_STRING insert_string_c -#define QUICK_INSERT_STRING quick_insert_string_c - -#include "insert_string_tpl.h" diff --git a/internal-complibs/zlib-ng-2.0.7/insert_string_tpl.h b/internal-complibs/zlib-ng-2.0.7/insert_string_tpl.h deleted file mode 100644 index 9796e5196..000000000 --- a/internal-complibs/zlib-ng-2.0.7/insert_string_tpl.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef INSERT_STRING_H_ -#define INSERT_STRING_H_ - -/* insert_string.h -- Private insert_string functions shared with more than - * one insert string implementation - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * Authors: - * Wajdi Feghali - * Jim Guilford - * Vinodh Gopal - * Erdinc Ozturk - * Jim Kukunas - * - * Portions are Copyright (C) 2016 12Sided Technology, LLC. - * Author: - * Phil Vachon - * - * For conditions of distribution and use, see copyright notice in zlib.h - * - */ - -/* =========================================================================== - * Quick insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - */ -Z_INTERNAL Pos QUICK_INSERT_STRING(deflate_state *const s, const uint32_t str) { - Pos head; - uint8_t *strstart = s->window + str; - uint32_t val, hm, h = 0; - -#ifdef UNALIGNED_OK - val = *(uint32_t *)(strstart); -#else - val = ((uint32_t)(strstart[0])); - val |= ((uint32_t)(strstart[1]) << 8); - val |= ((uint32_t)(strstart[2]) << 16); - val |= ((uint32_t)(strstart[3]) << 24); -#endif - - UPDATE_HASH(s, h, val); - hm = h & HASH_MASK; - - head = s->head[hm]; - if (LIKELY(head != str)) { - s->prev[str & s->w_mask] = head; - s->head[hm] = (Pos)str; - } - return head; -} - -/* =========================================================================== - * Insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). - */ -Z_INTERNAL void INSERT_STRING(deflate_state *const s, const uint32_t str, uint32_t count) { - uint8_t *strstart = s->window + str; - uint8_t *strend = strstart + count - 1; /* last position */ - - for (Pos idx = (Pos)str; strstart <= strend; idx++, strstart++) { - uint32_t val, hm, h = 0; - -#ifdef UNALIGNED_OK - val = *(uint32_t *)(strstart); -#else - val = ((uint32_t)(strstart[0])); - val |= ((uint32_t)(strstart[1]) << 8); - val |= ((uint32_t)(strstart[2]) << 16); - val |= ((uint32_t)(strstart[3]) << 24); -#endif - - UPDATE_HASH(s, h, val); - hm = h & HASH_MASK; - - Pos head = s->head[hm]; - if (LIKELY(head != idx)) { - s->prev[idx & s->w_mask] = head; - s->head[hm] = idx; - } - } -} -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/match_tpl.h b/internal-complibs/zlib-ng-2.0.7/match_tpl.h deleted file mode 100644 index b15ca17b9..000000000 --- a/internal-complibs/zlib-ng-2.0.7/match_tpl.h +++ /dev/null @@ -1,180 +0,0 @@ - -#include "zbuild.h" -#include "deflate.h" -#include "functable.h" - -#ifndef MATCH_TPL_H -#define MATCH_TPL_H - -#ifdef UNALIGNED_OK -# ifdef UNALIGNED64_OK -typedef uint64_t bestcmp_t; -# else -typedef uint32_t bestcmp_t; -# endif -#else -typedef uint8_t bestcmp_t; -#endif - -#define EARLY_EXIT_TRIGGER_LEVEL 5 - -#endif - -/* Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is garbage. - * - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >=1 - * OUT assertion: the match length is not greater than s->lookahead - */ -Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) { - unsigned int strstart = s->strstart; - const unsigned wmask = s->w_mask; - unsigned char *window = s->window; - unsigned char *scan = window + strstart; - Z_REGISTER unsigned char *mbase_start = window; - Z_REGISTER unsigned char *mbase_end; - const Pos *prev = s->prev; - Pos limit; - int32_t early_exit; - uint32_t chain_length, nice_match, best_len, offset; - uint32_t lookahead = s->lookahead; - bestcmp_t scan_end; -#ifndef UNALIGNED_OK - bestcmp_t scan_end0; -#else - bestcmp_t scan_start; -#endif - -#define GOTO_NEXT_CHAIN \ - if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \ - continue; \ - return best_len; - - /* The code is optimized for MAX_MATCH-2 multiple of 16. */ - Assert(MAX_MATCH == 258, "Code too clever"); - - best_len = s->prev_length ? s->prev_length : 1; - - /* Calculate read offset which should only extend an extra byte - * to find the next best match length. - */ - offset = best_len-1; -#ifdef UNALIGNED_OK - if (best_len >= sizeof(uint32_t)) { - offset -= 2; -#ifdef UNALIGNED64_OK - if (best_len >= sizeof(uint64_t)) - offset -= 4; -#endif - } -#endif - - scan_end = *(bestcmp_t *)(scan+offset); -#ifndef UNALIGNED_OK - scan_end0 = *(bestcmp_t *)(scan+offset+1); -#else - scan_start = *(bestcmp_t *)(scan); -#endif - mbase_end = (mbase_start+offset); - - /* Do not waste too much time if we already have a good match */ - chain_length = s->max_chain_length; - early_exit = s->level < EARLY_EXIT_TRIGGER_LEVEL; - if (best_len >= s->good_match) - chain_length >>= 2; - nice_match = (uint32_t)s->nice_match; - - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0 - */ - limit = strstart > MAX_DIST(s) ? (Pos)(strstart - MAX_DIST(s)) : 0; - - Assert((unsigned long)strstart <= s->window_size - MIN_LOOKAHEAD, "need lookahead"); - for (;;) { - if (cur_match >= strstart) - break; - - /* Skip to next match if the match length cannot increase or if the match length is - * less than 2. Note that the checks below for insufficient lookahead only occur - * occasionally for performance reasons. - * Therefore uninitialized memory will be accessed and conditional jumps will be made - * that depend on those values. However the length of the match is limited to the - * lookahead, so the output of deflate is not affected by the uninitialized values. - */ -#ifdef UNALIGNED_OK - if (best_len < sizeof(uint32_t)) { - for (;;) { - if (*(uint16_t *)(mbase_end+cur_match) == (uint16_t)scan_end && - *(uint16_t *)(mbase_start+cur_match) == (uint16_t)scan_start) - break; - GOTO_NEXT_CHAIN; - } -# ifdef UNALIGNED64_OK - } else if (best_len >= sizeof(uint64_t)) { - for (;;) { - if (*(uint64_t *)(mbase_end+cur_match) == (uint64_t)scan_end && - *(uint64_t *)(mbase_start+cur_match) == (uint64_t)scan_start) - break; - GOTO_NEXT_CHAIN; - } -# endif - } else { - for (;;) { - if (*(uint32_t *)(mbase_end+cur_match) == (uint32_t)scan_end && - *(uint32_t *)(mbase_start+cur_match) == (uint32_t)scan_start) - break; - GOTO_NEXT_CHAIN; - } - } -#else - for (;;) { - if (mbase_end[cur_match] == scan_end && mbase_end[cur_match+1] == scan_end0 && - mbase_start[cur_match] == scan[0] && mbase_start[cur_match+1] == scan[1]) - break; - GOTO_NEXT_CHAIN; - } -#endif - uint32_t len = COMPARE256(scan+2, mbase_start+cur_match+2) + 2; - Assert(scan+len <= window+(unsigned)(s->window_size-1), "wild scan"); - - if (len > best_len) { - s->match_start = cur_match; - /* Do not look for matches beyond the end of the input. */ - if (len > lookahead) - return lookahead; - best_len = len; - if (best_len >= nice_match) - return best_len; - - offset = best_len-1; -#ifdef UNALIGNED_OK - if (best_len >= sizeof(uint32_t)) { - offset -= 2; -#ifdef UNALIGNED64_OK - if (best_len >= sizeof(uint64_t)) - offset -= 4; -#endif - } -#endif - scan_end = *(bestcmp_t *)(scan+offset); -#ifndef UNALIGNED_OK - scan_end0 = *(bestcmp_t *)(scan+offset+1); -#endif - mbase_end = (mbase_start+offset); - } else if (UNLIKELY(early_exit)) { - /* The probability of finding a match later if we here is pretty low, so for - * performance it's best to outright stop here for the lower compression levels - */ - break; - } - GOTO_NEXT_CHAIN; - } - - return best_len; -} - -#undef LONGEST_MATCH -#undef COMPARE256 -#undef COMPARE258 diff --git a/internal-complibs/zlib-ng-2.0.7/test/.gitignore b/internal-complibs/zlib-ng-2.0.7/test/.gitignore deleted file mode 100644 index 96a3cad07..000000000 --- a/internal-complibs/zlib-ng-2.0.7/test/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# ignore Makefiles; they're all automatically generated -Makefile -/switchlevels -/switchlevels.dSYM/ -/switchlevels.exe diff --git a/internal-complibs/zlib-ng-2.0.7/test/Makefile.in b/internal-complibs/zlib-ng-2.0.7/test/Makefile.in deleted file mode 100644 index 98ff6f1be..000000000 --- a/internal-complibs/zlib-ng-2.0.7/test/Makefile.in +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler -# Copyright 2015, Daniel Axtens, IBM Corporation -# zlib license, see zlib.h - -CC= -CFLAGS= -EXE= -SRCDIR= -SRCTOP= -LIBNAME= -TEST_LDFLAGS=-L.. ../$(LIBNAME).a -WITH_FUZZERS= - -COMPATTESTS = -QEMU_RUN= -QEMU_VER:=$(shell command -v $(QEMU_RUN) --version 2> /dev/null) - -all: oldtests cvetests $(COMPATTESTS) fuzzer ghtests - -oldtests: #set by ../configure -check_cross_dep: -ifneq (,$(QEMU_RUN)) -ifeq (,$(QEMU_VER)) - $(error "You need QEMU to run tests on non-native platform") -endif -endif - -ALL_SRC_FILES := $(wildcard ../*) - -# Only check the fuzzer when it is a stand-alone executable. -ifneq (,$(LIB_FUZZING_ENGINE)) -fuzzer: -else - ifeq (0,$(WITH_FUZZERS)) -fuzzer: - else -fuzzer: - @${QEMU_RUN} ../checksum_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../compress_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../example_small_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../example_large_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../example_flush_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../example_dict_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../minigzip_fuzzer$(EXE) $(ALL_SRC_FILES) - endif -endif - -teststatic: check_cross_dep - @TMPST=tmpst_$$$$; \ - HELLOST=tmphellost_$$$$; \ - if echo hello world | ${QEMU_RUN} ../minigzip$(EXE) > $$HELLOST && ${QEMU_RUN} ../minigzip$(EXE) -d < $$HELLOST && ${QEMU_RUN} ../example$(EXE) $$TMPST && ${QEMU_RUN} ../adler32_test$(EXE) && ${QEMU_RUN} ../crc32_test$(EXE); then \ - echo ' *** zlib test OK ***'; \ - else \ - echo ' *** zlib test FAILED ***'; exit 1; \ - fi; \ - rm -f $$TMPST $$HELLOST - -testshared: check_cross_dep - @LD_LIBRARY_PATH=`pwd`/..:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ - LD_LIBRARYN32_PATH=`pwd`/..:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \ - DYLD_LIBRARY_PATH=`pwd`/..:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ - SHLIB_PATH=`pwd`/..:$(SHLIB_PATH) ; export SHLIB_PATH; \ - TMPSH=tmpsh_$$$$; \ - HELLOSH=tmphellosh_$$$$; \ - if echo hello world | ${QEMU_RUN} ../minigzipsh$(EXE) > $$HELLOSH && ${QEMU_RUN} ../minigzipsh$(EXE) -d < $$HELLOSH && ${QEMU_RUN} ../examplesh$(EXE) $$TMPSH && ${QEMU_RUN} ../adler32_testsh$(EXE) && ${QEMU_RUN} ../crc32_testsh$(EXE); then \ - echo ' *** zlib shared test OK ***'; \ - else \ - echo ' *** zlib shared test FAILED ***'; exit 1; \ - fi; \ - rm -f $$TMPSH $$HELLOSH - -cvetests: testCVEinputs - -# Tests requiring zlib-ng to be built with --zlib-compat -compattests: testCVE-2003-0107 - -testCVEinputs: check_cross_dep - @EXE=$(EXE) QEMU_RUN="${QEMU_RUN}" $(SRCDIR)/testCVEinputs.sh - -testCVE-2003-0107: CVE-2003-0107$(EXE) check_cross_dep - @if ${QEMU_RUN} ./CVE-2003-0107$(EXE); then \ - echo ' *** zlib not vulnerable to CVE-2003-0107 ***'; \ - else \ - echo ' *** zlib VULNERABLE to CVE-2003-0107 ***'; exit 1; \ - fi - -CVE-2003-0107.o: $(SRCDIR)/CVE-2003-0107.c - $(CC) $(CFLAGS) -I.. -I$(SRCTOP) -c -o $@ $(SRCDIR)/CVE-2003-0107.c - -CVE-2003-0107$(EXE): CVE-2003-0107.o - $(CC) $(CFLAGS) -o $@ CVE-2003-0107.o $(TEST_LDFLAGS) - -.PHONY: ghtests -ghtests: testGH-361 testGH-364 testGH-751 testGH-1235 - -.PHONY: testGH-361 -testGH-361: - $(QEMU_RUN) ../minigzip$(EXE) -4 <$(SRCDIR)/GH-361/test.txt >/dev/null - -switchlevels$(EXE): $(SRCDIR)/switchlevels.c - $(CC) $(CFLAGS) -I.. -I$(SRCTOP) -o $@ $< $(TEST_LDFLAGS) - -.PHONY: testGH-364 -testGH-364: switchlevels$(EXE) - $(QEMU_RUN) ./switchlevels$(EXE) 1 5 9 3 <$(SRCDIR)/GH-364/test.bin >/dev/null - -.PHONY: testGH-751 -testGH-751: - $(QEMU_RUN) ../minigzip$(EXE) <$(SRCDIR)/GH-751/test.txt | $(QEMU_RUN) ../minigzip$(EXE) -d >/dev/null - -gh1235$(EXE): $(SRCDIR)/gh1235.c - $(CC) $(CFLAGS) -I.. -I$(SRCTOP) -o $@ $< $(TEST_LDFLAGS) - -.PHONY: testGH-1235 -testGH-1235: gh1235$(EXE) - $(QEMU_RUN) ./gh1235$(EXE) - -clean: - rm -f *.o *.gcda *.gcno *.gcov - rm -f CVE-2003-0107$(EXE) switchlevels$(EXE) gh1235$(EXE) - -distclean: - rm -f Makefile diff --git a/internal-complibs/zlib-ng-2.0.7/test/abi/zlib-v1.2.11-arm-linux-gnueabihf.abi b/internal-complibs/zlib-ng-2.0.7/test/abi/zlib-v1.2.11-arm-linux-gnueabihf.abi deleted file mode 100644 index 152a742cf..000000000 --- a/internal-complibs/zlib-ng-2.0.7/test/abi/zlib-v1.2.11-arm-linux-gnueabihf.abi +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/internal-complibs/zlib-ng-2.0.7/test/abi/zlib-v1.2.11-x86_64-linux-gnu.abi b/internal-complibs/zlib-ng-2.0.7/test/abi/zlib-v1.2.11-x86_64-linux-gnu.abi deleted file mode 100644 index 00a520c63..000000000 --- a/internal-complibs/zlib-ng-2.0.7/test/abi/zlib-v1.2.11-x86_64-linux-gnu.abi +++ /dev/null @@ -1,1037 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/internal-complibs/zlib-ng-2.0.7/test/crc32_test.c b/internal-complibs/zlib-ng-2.0.7/test/crc32_test.c deleted file mode 100644 index c625b501a..000000000 --- a/internal-complibs/zlib-ng-2.0.7/test/crc32_test.c +++ /dev/null @@ -1,199 +0,0 @@ -/* crc32_test.c -- crc32 unit test - * Copyright (C) 2019-2021 IBM Corporation - * Authors: Rogerio Alves - * Matheus Castanho - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include -#include -#include - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -typedef struct { - uint32_t line; - unsigned long crc; - const unsigned char *buf; - size_t len; - unsigned long expect; -} crc32_test; - -void test_crc32(unsigned long crc, const unsigned char *buf, size_t len, uint32_t chk, uint32_t line) { - uint32_t res = PREFIX(crc32_z)((uint32_t)crc, buf, len); - if (res != chk) { - fprintf(stderr, "FAIL [%d]: crc32 returned 0x%08X expected 0x%08X\n", - line, res, chk); - exit(1); - } -} - -static const crc32_test tests[] = { - {__LINE__, 0x0, (const unsigned char *)0x0, 0, 0x0}, - {__LINE__, 0xffffffff, (const unsigned char *)0x0, 0, 0x0}, - {__LINE__, 0x0, (const unsigned char *)0x0, 255, 0x0}, /* BZ 174799. */ - {__LINE__, 0x0, (const unsigned char *)0x0, 256, 0x0}, - {__LINE__, 0x0, (const unsigned char *)0x0, 257, 0x0}, - {__LINE__, 0x0, (const unsigned char *)0x0, 32767, 0x0}, - {__LINE__, 0x0, (const unsigned char *)0x0, 32768, 0x0}, - {__LINE__, 0x0, (const unsigned char *)0x0, 32769, 0x0}, - {__LINE__, 0x0, (const unsigned char *)"", 0, 0x0}, - {__LINE__, 0xffffffff, (const unsigned char *)"", 0, 0xffffffff}, - {__LINE__, 0x0, (const unsigned char *)"abacus", 6, 0xc3d7115b}, - {__LINE__, 0x0, (const unsigned char *)"backlog", 7, 0x269205}, - {__LINE__, 0x0, (const unsigned char *)"campfire", 8, 0x22a515f8}, - {__LINE__, 0x0, (const unsigned char *)"delta", 5, 0x9643fed9}, - {__LINE__, 0x0, (const unsigned char *)"executable", 10, 0xd68eda01}, - {__LINE__, 0x0, (const unsigned char *)"file", 4, 0x8c9f3610}, - {__LINE__, 0x0, (const unsigned char *)"greatest", 8, 0xc1abd6cd}, - {__LINE__, 0x0, (const unsigned char *)"hello", 5, 0x3610a686}, - {__LINE__, 0x0, (const unsigned char *)"inverter", 8, 0xc9e962c9}, - {__LINE__, 0x0, (const unsigned char *)"jigsaw", 6, 0xce4e3f69}, - {__LINE__, 0x0, (const unsigned char *)"karate", 6, 0x890be0e2}, - {__LINE__, 0x0, (const unsigned char *)"landscape", 9, 0xc4e0330b}, - {__LINE__, 0x0, (const unsigned char *)"machine", 7, 0x1505df84}, - {__LINE__, 0x0, (const unsigned char *)"nanometer", 9, 0xd4e19f39}, - {__LINE__, 0x0, (const unsigned char *)"oblivion", 8, 0xdae9de77}, - {__LINE__, 0x0, (const unsigned char *)"panama", 6, 0x66b8979c}, - {__LINE__, 0x0, (const unsigned char *)"quest", 5, 0x4317f817}, - {__LINE__, 0x0, (const unsigned char *)"resource", 8, 0xbc91f416}, - {__LINE__, 0x0, (const unsigned char *)"secret", 6, 0x5ca2e8e5}, - {__LINE__, 0x0, (const unsigned char *)"test", 4, 0xd87f7e0c}, - {__LINE__, 0x0, (const unsigned char *)"ultimate", 8, 0x3fc79b0b}, - {__LINE__, 0x0, (const unsigned char *)"vector", 6, 0x1b6e485b}, - {__LINE__, 0x0, (const unsigned char *)"walrus", 6, 0xbe769b97}, - {__LINE__, 0x0, (const unsigned char *)"xeno", 4, 0xe7a06444}, - {__LINE__, 0x0, (const unsigned char *)"yelling", 7, 0xfe3944e5}, - {__LINE__, 0x0, (const unsigned char *)"zlib", 4, 0x73887d3a}, - {__LINE__, 0x0, (const unsigned char *)"4BJD7PocN1VqX0jXVpWB", 20, 0xd487a5a1}, - {__LINE__, 0x0, (const unsigned char *)"F1rPWI7XvDs6nAIRx41l", 20, 0x61a0132e}, - {__LINE__, 0x0, (const unsigned char *)"ldhKlsVkPFOveXgkGtC2", 20, 0xdf02f76}, - {__LINE__, 0x0, (const unsigned char *)"5KKnGOOrs8BvJ35iKTOS", 20, 0x579b2b0a}, - {__LINE__, 0x0, (const unsigned char *)"0l1tw7GOcem06Ddu7yn4", 20, 0xf7d16e2d}, - {__LINE__, 0x0, (const unsigned char *)"MCr47CjPIn9R1IvE1Tm5", 20, 0x731788f5}, - {__LINE__, 0x0, (const unsigned char *)"UcixbzPKTIv0SvILHVdO", 20, 0x7112bb11}, - {__LINE__, 0x0, (const unsigned char *)"dGnAyAhRQDsWw0ESou24", 20, 0xf32a0dac}, - {__LINE__, 0x0, (const unsigned char *)"di0nvmY9UYMYDh0r45XT", 20, 0x625437bb}, - {__LINE__, 0x0, (const unsigned char *)"2XKDwHfAhFsV0RhbqtvH", 20, 0x896930f9}, - {__LINE__, 0x0, (const unsigned char *)"ZhrANFIiIvRnqClIVyeD", 20, 0x8579a37}, - {__LINE__, 0x0, (const unsigned char *)"v7Q9ehzioTOVeDIZioT1", 20, 0x632aa8e0}, - {__LINE__, 0x0, (const unsigned char *)"Yod5hEeKcYqyhfXbhxj2", 20, 0xc829af29}, - {__LINE__, 0x0, (const unsigned char *)"GehSWY2ay4uUKhehXYb0", 20, 0x1b08b7e8}, - {__LINE__, 0x0, (const unsigned char *)"kwytJmq6UqpflV8Y8GoE", 20, 0x4e33b192}, - {__LINE__, 0x0, (const unsigned char *)"70684206568419061514", 20, 0x59a179f0}, - {__LINE__, 0x0, (const unsigned char *)"42015093765128581010", 20, 0xcd1013d7}, - {__LINE__, 0x0, (const unsigned char *)"88214814356148806939", 20, 0xab927546}, - {__LINE__, 0x0, (const unsigned char *)"43472694284527343838", 20, 0x11f3b20c}, - {__LINE__, 0x0, (const unsigned char *)"49769333513942933689", 20, 0xd562d4ca}, - {__LINE__, 0x0, (const unsigned char *)"54979784887993251199", 20, 0x233395f7}, - {__LINE__, 0x0, (const unsigned char *)"58360544869206793220", 20, 0x2d167fd5}, - {__LINE__, 0x0, (const unsigned char *)"27347953487840714234", 20, 0x8b5108ba}, - {__LINE__, 0x0, (const unsigned char *)"07650690295365319082", 20, 0xc46b3cd8}, - {__LINE__, 0x0, (const unsigned char *)"42655507906821911703", 20, 0xc10b2662}, - {__LINE__, 0x0, (const unsigned char *)"29977409200786225655", 20, 0xc9a0f9d2}, - {__LINE__, 0x0, (const unsigned char *)"85181542907229116674", 20, 0x9341357b}, - {__LINE__, 0x0, (const unsigned char *)"87963594337989416799", 20, 0xf0424937}, - {__LINE__, 0x0, (const unsigned char *)"21395988329504168551", 20, 0xd7c4c31f}, - {__LINE__, 0x0, (const unsigned char *)"51991013580943379423", 20, 0xf11edcc4}, - {__LINE__, 0x0, (const unsigned char *)"*]+@!);({_$;}[_},?{?;(_?,=-][@", 30, 0x40795df4}, - {__LINE__, 0x0, (const unsigned char *)"_@:_).&(#.[:[{[:)$++-($_;@[)}+", 30, 0xdd61a631}, - {__LINE__, 0x0, (const unsigned char *)"&[!,[$_==}+.]@!;*(+},[;:)$;)-@", 30, 0xca907a99}, - {__LINE__, 0x0, (const unsigned char *)"]{.[.+?+[[=;[?}_#&;[=)__$$:+=_", 30, 0xf652deac}, - {__LINE__, 0x0, (const unsigned char *)"-%.)=/[@].:.(:,()$;=%@-$?]{%+%", 30, 0xaf39a5a9}, - {__LINE__, 0x0, (const unsigned char *)"+]#$(@&.=:,*];/.!]%/{:){:@(;)$", 30, 0x6bebb4cf}, - {__LINE__, 0x0, (const unsigned char *)")-._.:?[&:.=+}(*$/=!.${;(=$@!}", 30, 0x76430bac}, - {__LINE__, 0x0, (const unsigned char *)":(_*&%/[[}+,?#$&*+#[([*-/#;%(]", 30, 0x6c80c388}, - {__LINE__, 0x0, (const unsigned char *)"{[#-;:$/{)(+[}#]/{&!%(@)%:@-$:", 30, 0xd54d977d}, - {__LINE__, 0x0, (const unsigned char *)"_{$*,}(&,@.)):=!/%(&(,,-?$}}}!", 30, 0xe3966ad5}, - {__LINE__, 0x0, (const unsigned char *)"e$98KNzqaV)Y:2X?]77].{gKRD4G5{mHZk,Z)SpU%L3FSgv!Wb8MLAFdi{+fp)c,@8m6v)yXg@]HBDFk?.4&}g5_udE*JHCiH=aL", 100, 0xe7c71db9}, - {__LINE__, 0x0, (const unsigned char *)"r*Fd}ef+5RJQ;+W=4jTR9)R*p!B;]Ed7tkrLi;88U7g@3v!5pk2X6D)vt,.@N8c]@yyEcKi[vwUu@.Ppm@C6%Mv*3Nw}Y,58_aH)", 100, 0xeaa52777}, - {__LINE__, 0x0, (const unsigned char *)"h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 100, 0xcd472048}, - {__LINE__, 0x7a30360d, (const unsigned char *)"abacus", 6, 0xf8655a84}, - {__LINE__, 0x6fd767ee, (const unsigned char *)"backlog", 7, 0x1ed834b1}, - {__LINE__, 0xefeb7589, (const unsigned char *)"campfire", 8, 0x686cfca}, - {__LINE__, 0x61cf7e6b, (const unsigned char *)"delta", 5, 0x1554e4b1}, - {__LINE__, 0xdc712e2, (const unsigned char *)"executable", 10, 0x761b4254}, - {__LINE__, 0xad23c7fd, (const unsigned char *)"file", 4, 0x7abdd09b}, - {__LINE__, 0x85cb2317, (const unsigned char *)"greatest", 8, 0x4ba91c6b}, - {__LINE__, 0x9eed31b0, (const unsigned char *)"inverter", 8, 0xd5e78ba5}, - {__LINE__, 0xb94f34ca, (const unsigned char *)"jigsaw", 6, 0x23649109}, - {__LINE__, 0xab058a2, (const unsigned char *)"karate", 6, 0xc5591f41}, - {__LINE__, 0x5bff2b7a, (const unsigned char *)"landscape", 9, 0xf10eb644}, - {__LINE__, 0x605c9a5f, (const unsigned char *)"machine", 7, 0xbaa0a636}, - {__LINE__, 0x51bdeea5, (const unsigned char *)"nanometer", 9, 0x6af89afb}, - {__LINE__, 0x85c21c79, (const unsigned char *)"oblivion", 8, 0xecae222b}, - {__LINE__, 0x97216f56, (const unsigned char *)"panama", 6, 0x47dffac4}, - {__LINE__, 0x18444af2, (const unsigned char *)"quest", 5, 0x70c2fe36}, - {__LINE__, 0xbe6ce359, (const unsigned char *)"resource", 8, 0x1471d925}, - {__LINE__, 0x843071f1, (const unsigned char *)"secret", 6, 0x50c9a0db}, - {__LINE__, 0xf2480c60, (const unsigned char *)"ultimate", 8, 0xf973daf8}, - {__LINE__, 0x2d2feb3d, (const unsigned char *)"vector", 6, 0x344ac03d}, - {__LINE__, 0x7490310a, (const unsigned char *)"walrus", 6, 0x6d1408ef}, - {__LINE__, 0x97d247d4, (const unsigned char *)"xeno", 4, 0xe62670b5}, - {__LINE__, 0x93cf7599, (const unsigned char *)"yelling", 7, 0x1b36da38}, - {__LINE__, 0x73c84278, (const unsigned char *)"zlib", 4, 0x6432d127}, - {__LINE__, 0x228a87d1, (const unsigned char *)"4BJD7PocN1VqX0jXVpWB", 20, 0x997107d0}, - {__LINE__, 0xa7a048d0, (const unsigned char *)"F1rPWI7XvDs6nAIRx41l", 20, 0xdc567274}, - {__LINE__, 0x1f0ded40, (const unsigned char *)"ldhKlsVkPFOveXgkGtC2", 20, 0xdcc63870}, - {__LINE__, 0xa804a62f, (const unsigned char *)"5KKnGOOrs8BvJ35iKTOS", 20, 0x6926cffd}, - {__LINE__, 0x508fae6a, (const unsigned char *)"0l1tw7GOcem06Ddu7yn4", 20, 0xb52b38bc}, - {__LINE__, 0xe5adaf4f, (const unsigned char *)"MCr47CjPIn9R1IvE1Tm5", 20, 0xf83b8178}, - {__LINE__, 0x67136a40, (const unsigned char *)"UcixbzPKTIv0SvILHVdO", 20, 0xc5213070}, - {__LINE__, 0xb00c4a10, (const unsigned char *)"dGnAyAhRQDsWw0ESou24", 20, 0xbc7648b0}, - {__LINE__, 0x2e0c84b5, (const unsigned char *)"di0nvmY9UYMYDh0r45XT", 20, 0xd8123a72}, - {__LINE__, 0x81238d44, (const unsigned char *)"2XKDwHfAhFsV0RhbqtvH", 20, 0xd5ac5620}, - {__LINE__, 0xf853aa92, (const unsigned char *)"ZhrANFIiIvRnqClIVyeD", 20, 0xceae099d}, - {__LINE__, 0x5a692325, (const unsigned char *)"v7Q9ehzioTOVeDIZioT1", 20, 0xb07d2b24}, - {__LINE__, 0x3275b9f, (const unsigned char *)"Yod5hEeKcYqyhfXbhxj2", 20, 0x24ce91df}, - {__LINE__, 0x38371feb, (const unsigned char *)"GehSWY2ay4uUKhehXYb0", 20, 0x707b3b30}, - {__LINE__, 0xafc8bf62, (const unsigned char *)"kwytJmq6UqpflV8Y8GoE", 20, 0x16abc6a9}, - {__LINE__, 0x9b07db73, (const unsigned char *)"70684206568419061514", 20, 0xae1fb7b7}, - {__LINE__, 0xe75b214, (const unsigned char *)"42015093765128581010", 20, 0xd4eecd2d}, - {__LINE__, 0x72d0fe6f, (const unsigned char *)"88214814356148806939", 20, 0x4660ec7}, - {__LINE__, 0xf857a4b1, (const unsigned char *)"43472694284527343838", 20, 0xfd8afdf7}, - {__LINE__, 0x54b8e14, (const unsigned char *)"49769333513942933689", 20, 0xc6d1b5f2}, - {__LINE__, 0xd6aa5616, (const unsigned char *)"54979784887993251199", 20, 0x32476461}, - {__LINE__, 0x11e63098, (const unsigned char *)"58360544869206793220", 20, 0xd917cf1a}, - {__LINE__, 0xbe92385, (const unsigned char *)"27347953487840714234", 20, 0x4ad14a12}, - {__LINE__, 0x49511de0, (const unsigned char *)"07650690295365319082", 20, 0xe37b5c6c}, - {__LINE__, 0x3db13bc1, (const unsigned char *)"42655507906821911703", 20, 0x7cc497f1}, - {__LINE__, 0xbb899bea, (const unsigned char *)"29977409200786225655", 20, 0x99781bb2}, - {__LINE__, 0xf6cd9436, (const unsigned char *)"85181542907229116674", 20, 0x132256a1}, - {__LINE__, 0x9109e6c3, (const unsigned char *)"87963594337989416799", 20, 0xbfdb2c83}, - {__LINE__, 0x75770fc, (const unsigned char *)"21395988329504168551", 20, 0x8d9d1e81}, - {__LINE__, 0x69b1d19b, (const unsigned char *)"51991013580943379423", 20, 0x7b6d4404}, - {__LINE__, 0xc6132975, (const unsigned char *)"*]+@!);({_$;}[_},?{?;(_?,=-][@", 30, 0x8619f010}, - {__LINE__, 0xd58cb00c, (const unsigned char *)"_@:_).&(#.[:[{[:)$++-($_;@[)}+", 30, 0x15746ac3}, - {__LINE__, 0xb63b8caa, (const unsigned char *)"&[!,[$_==}+.]@!;*(+},[;:)$;)-@", 30, 0xaccf812f}, - {__LINE__, 0x8a45a2b8, (const unsigned char *)"]{.[.+?+[[=;[?}_#&;[=)__$$:+=_", 30, 0x78af45de}, - {__LINE__, 0xcbe95b78, (const unsigned char *)"-%.)=/[@].:.(:,()$;=%@-$?]{%+%", 30, 0x25b06b59}, - {__LINE__, 0x4ef8a54b, (const unsigned char *)"+]#$(@&.=:,*];/.!]%/{:){:@(;)$", 30, 0x4ba0d08f}, - {__LINE__, 0x76ad267a, (const unsigned char *)")-._.:?[&:.=+}(*$/=!.${;(=$@!}", 30, 0xe26b6aac}, - {__LINE__, 0x569e613c, (const unsigned char *)":(_*&%/[[}+,?#$&*+#[([*-/#;%(]", 30, 0x7e2b0a66}, - {__LINE__, 0x36aa61da, (const unsigned char *)"{[#-;:$/{)(+[}#]/{&!%(@)%:@-$:", 30, 0xb3430dc7}, - {__LINE__, 0xf67222df, (const unsigned char *)"_{$*,}(&,@.)):=!/%(&(,,-?$}}}!", 30, 0x626c17a}, - {__LINE__, 0x74b34fd3, (const unsigned char *)"e$98KNzqaV)Y:2X?]77].{gKRD4G5{mHZk,Z)SpU%L3FSgv!Wb8MLAFdi{+fp)c,@8m6v)yXg@]HBDFk?.4&}g5_udE*JHCiH=aL", 100, 0xccf98060}, - {__LINE__, 0x351fd770, (const unsigned char *)"r*Fd}ef+5RJQ;+W=4jTR9)R*p!B;]Ed7tkrLi;88U7g@3v!5pk2X6D)vt,.@N8c]@yyEcKi[vwUu@.Ppm@C6%Mv*3Nw}Y,58_aH)", 100, 0xd8b95312}, - {__LINE__, 0xc45aef77, (const unsigned char *)"h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 100, 0xbb1c9912}, - {__LINE__, 0xc45aef77, (const unsigned char *)"h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&" - "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&" - "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&" - "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&" - "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&" - "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 600, 0x888AFA5B} -}; - -static const int test_size = sizeof(tests) / sizeof(tests[0]); - -int main(void) { - int i; - for (i = 0; i < test_size; i++) { - test_crc32(tests[i].crc, tests[i].buf, tests[i].len, tests[i].expect, tests[i].line); - } - return 0; -} diff --git a/internal-complibs/zlib-ng-2.0.7/test/hash_head_0.c b/internal-complibs/zlib-ng-2.0.7/test/hash_head_0.c deleted file mode 100644 index 1f615c5d6..000000000 --- a/internal-complibs/zlib-ng-2.0.7/test/hash_head_0.c +++ /dev/null @@ -1,110 +0,0 @@ -/* Generated by fuzzing - test hash_head == 0 handling. */ - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -#include -#include -#include - -int main() { - PREFIX3(stream) strm; - memset(&strm, 0, sizeof(strm)); - - int ret = PREFIX(deflateInit2)(&strm, 1, Z_DEFLATED, -15, 4, Z_HUFFMAN_ONLY); - if (ret != Z_OK) { - fprintf(stderr, "deflateInit2() failed with code %d\n", ret); - return EXIT_FAILURE; - } - - unsigned char next_in[9698]; - memset(next_in, 0x30, sizeof(next_in)); - next_in[8193] = 0x00; - next_in[8194] = 0x00; - next_in[8195] = 0x00; - next_in[8199] = 0x8a; - strm.next_in = next_in; - unsigned char next_out[21572]; - strm.next_out = next_out; - - strm.avail_in = 0; - strm.avail_out = 1348; - ret = PREFIX(deflateParams(&strm, 3, Z_FILTERED)); - if (ret != Z_OK) { - fprintf(stderr, "deflateParams() failed with code %d\n", ret); - return EXIT_FAILURE; - } - - strm.avail_in = 6728; - strm.avail_out = 2696; - ret = PREFIX(deflate(&strm, Z_SYNC_FLUSH)); - if (ret != Z_OK) { - fprintf(stderr, "deflate() failed with code %d\n", ret); - return EXIT_FAILURE; - } - - strm.avail_in = 15; - strm.avail_out = 1348; - ret = PREFIX(deflateParams(&strm, 9, Z_FILTERED)); - if (ret != Z_OK) { - fprintf(stderr, "deflateParams() failed with code %d\n", ret); - return EXIT_FAILURE; - } - - strm.avail_in = 1453; - strm.avail_out = 1348; - ret = PREFIX(deflate(&strm, Z_FULL_FLUSH)); - if (ret != Z_OK) { - fprintf(stderr, "deflate() failed with code %d\n", ret); - return EXIT_FAILURE; - } - - strm.avail_in = (uint32_t)(next_in + sizeof(next_in) - strm.next_in); - strm.avail_out = (uint32_t)(next_out + sizeof(next_out) - strm.next_out); - ret = PREFIX(deflate)(&strm, Z_FINISH); - if (ret != Z_STREAM_END) { - fprintf(stderr, "deflate() failed with code %d\n", ret); - return EXIT_FAILURE; - } - uint32_t compressed_size = (uint32_t)(strm.next_out - next_out); - - ret = PREFIX(deflateEnd)(&strm); - if (ret != Z_OK) { - fprintf(stderr, "deflateEnd() failed with code %d\n", ret); - return EXIT_FAILURE; - } - - memset(&strm, 0, sizeof(strm)); - ret = PREFIX(inflateInit2)(&strm, -15); - if (ret != Z_OK) { - fprintf(stderr, "inflateInit2() failed with code %d\n", ret); - return EXIT_FAILURE; - } - - strm.next_in = next_out; - strm.avail_in = compressed_size; - unsigned char uncompressed[sizeof(next_in)]; - strm.next_out = uncompressed; - strm.avail_out = sizeof(uncompressed); - - ret = PREFIX(inflate)(&strm, Z_NO_FLUSH); - if (ret != Z_STREAM_END) { - fprintf(stderr, "inflate() failed with code %d\n", ret); - return EXIT_FAILURE; - } - - ret = PREFIX(inflateEnd)(&strm); - if (ret != Z_OK) { - fprintf(stderr, "inflateEnd() failed with code %d\n", ret); - return EXIT_FAILURE; - } - - if (memcmp(uncompressed, next_in, sizeof(uncompressed)) != 0) { - fprintf(stderr, "Uncompressed data differs from the original\n"); - return EXIT_FAILURE; - } -} diff --git a/internal-complibs/zlib-ng-2.0.7/test/testCVEinputs.sh b/internal-complibs/zlib-ng-2.0.7/test/testCVEinputs.sh deleted file mode 100755 index 84f6b31c5..000000000 --- a/internal-complibs/zlib-ng-2.0.7/test/testCVEinputs.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -TESTDIR="$(dirname "$0")" - -# check for QEMU if QEMU_RUN is set -if [ ! -z "${QEMU_RUN}" ]; then - QEMU_VERSION=$(${QEMU_RUN} --version 2> /dev/null) - if [ -z "${QEMU_VERSION}" ]; then - echo "**** You need QEMU to run tests on non-native platform" - exit 1 - fi -fi - -CVEs="CVE-2002-0059 CVE-2004-0797 CVE-2005-1849 CVE-2005-2096" - -for CVE in $CVEs; do - fail=0 - for testcase in ${TESTDIR}/${CVE}/*.gz; do - ${QEMU_RUN} ../minigzip${EXE} -d < "$testcase" - # we expect that a 1 error code is OK - # for a vulnerable failure we'd expect 134 or similar - if [ $? -ne 1 ] && [ $? -ne 0 ]; then - fail=1 - fi - done - if [ $fail -eq 0 ]; then - echo " --- zlib not vulnerable to $CVE ---"; - else - echo " --- zlib VULNERABLE to $CVE ---"; exit 1; - fi -done diff --git a/internal-complibs/zlib-ng-2.0.7/tools/codecov-upload.sh b/internal-complibs/zlib-ng-2.0.7/tools/codecov-upload.sh deleted file mode 100644 index e3a48aab7..000000000 --- a/internal-complibs/zlib-ng-2.0.7/tools/codecov-upload.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -ux -cd "$CODECOV_DIR" -python -m codecov --required --flags "$CODECOV_FLAGS" --name "$CODECOV_NAME" --gcov-exec="$CODECOV_EXEC" -if [ $? -ne 0 ]; then - sleep 30 - python -m codecov --required --flags "$CODECOV_FLAGS" --name "$CODECOV_NAME" --gcov-exec="$CODECOV_EXEC" --tries=25 -fi -exit $? diff --git a/internal-complibs/zlib-ng-2.0.7/tools/makecrct.c b/internal-complibs/zlib-ng-2.0.7/tools/makecrct.c deleted file mode 100644 index 3f6b37b13..000000000 --- a/internal-complibs/zlib-ng-2.0.7/tools/makecrct.c +++ /dev/null @@ -1,177 +0,0 @@ -/* crc32.c -- output crc32 tables - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016, 2018 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h -*/ - -#include -#include -#include "zbuild.h" -#include "deflate.h" -#include "crc32_p.h" - -static uint32_t crc_table[8][256]; -static uint32_t crc_comb[GF2_DIM][GF2_DIM]; - -static void gf2_matrix_square(uint32_t *square, const uint32_t *mat); -static void make_crc_table(void); -static void make_crc_combine_table(void); -static void print_crc_table(void); -static void print_crc_combine_table(void); -static void write_table(const uint32_t *, int); - - -/* ========================================================================= */ -static void gf2_matrix_square(uint32_t *square, const uint32_t *mat) { - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); -} - -/* ========================================================================= - Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x^2+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ -static void make_crc_table(void) { - int n, k; - uint32_t c; - uint32_t poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static const unsigned char p[] = {0, 1, 2, 4, 5, 7, 8, 10, 11, 12, 16, 22, 23, 26}; - - /* make exclusive-or pattern from polynomial (0xedb88320) */ - poly = 0; - for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) - poly |= (uint32_t)1 << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (uint32_t)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } - - /* generate crc for each value followed by one, two, and three zeros, - and then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = ZSWAP32(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = ZSWAP32(c); - } - } -} - -static void make_crc_combine_table(void) { - int n, k; - /* generate zero operators table for crc32_combine() */ - - /* generate the operator to apply a single zero bit to a CRC -- the - first row adds the polynomial if the low bit is a 1, and the - remaining rows shift the CRC right one bit */ - k = GF2_DIM - 3; - crc_comb[k][0] = 0xedb88320UL; /* CRC-32 polynomial */ - uint32_t row = 1; - for (n = 1; n < GF2_DIM; n++) { - crc_comb[k][n] = row; - row <<= 1; - } - /* generate operators that apply 2, 4, and 8 zeros to a CRC, putting - the last one, the operator for one zero byte, at the 0 position */ - gf2_matrix_square(crc_comb[k + 1], crc_comb[k]); - gf2_matrix_square(crc_comb[k + 2], crc_comb[k + 1]); - gf2_matrix_square(crc_comb[0], crc_comb[k + 2]); - - /* generate operators for applying 2^n zero bytes to a CRC, filling out - the remainder of the table -- the operators repeat after GF2_DIM - values of n, so the table only needs GF2_DIM entries, regardless of - the size of the length being processed */ - for (n = 1; n < k; n++) - gf2_matrix_square(crc_comb[n], crc_comb[n - 1]); -} - -static void write_table(const uint32_t *table, int k) { - int n; - - for (n = 0; n < k; n++) - printf("%s0x%08" PRIx32 "%s", n % 5 ? "" : " ", - (uint32_t)(table[n]), - n == k - 1 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); -} - -static void print_crc_table(void) { - int k; - printf("#ifndef CRC32_TBL_H_\n"); - printf("#define CRC32_TBL_H_\n\n"); - printf("/* crc32_tbl.h -- tables for rapid CRC calculation\n"); - printf(" * Generated automatically by makecrct.c\n */\n\n"); - - /* print CRC table */ - printf("static const uint32_t "); - printf("crc_table[8][256] =\n{\n {\n"); - write_table(crc_table[0], 256); - for (k = 1; k < 8; k++) { - printf(" },\n {\n"); - write_table(crc_table[k], 256); - } - printf(" }\n};\n\n"); - - printf("#endif /* CRC32_TBL_H_ */\n"); -} - -static void print_crc_combine_table(void) { - int k; - printf("#ifndef CRC32_COMB_TBL_H_\n"); - printf("#define CRC32_COMB_TBL_H_\n\n"); - printf("/* crc32_comb_tbl.h -- zero operators table for CRC combine\n"); - printf(" * Generated automatically by makecrct.c\n */\n\n"); - - /* print zero operator table */ - printf("static const uint32_t "); - printf("crc_comb[%d][%d] =\n{\n {\n", GF2_DIM, GF2_DIM); - write_table(crc_comb[0], GF2_DIM); - for (k = 1; k < GF2_DIM; k++) { - printf(" },\n {\n"); - write_table(crc_comb[k], GF2_DIM); - } - printf(" }\n};\n\n"); - - printf("#endif /* CRC32_COMB_TBL_H_ */\n"); -} - -// The output of this application can be piped out to recreate crc32.h -int main(int argc, char *argv[]) { - if (argc > 1 && strcmp(argv[1], "-c") == 0) { - make_crc_combine_table(); - print_crc_combine_table(); - } else { - make_crc_table(); - print_crc_table(); - } - return 0; -} diff --git a/internal-complibs/zlib-ng-2.0.7/trees_tbl._h b/internal-complibs/zlib-ng-2.0.7/trees_tbl._h deleted file mode 100644 index a4c68a566..000000000 --- a/internal-complibs/zlib-ng-2.0.7/trees_tbl._h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef TREES_TBL_H_ -#define TREES_TBL_H_ - -/* header created automatically with maketrees.c */ - -Z_INTERNAL const ct_data static_ltree[L_CODES+2] = { -{{ 12},{8}}, {{140},{8}}, {{ 76},{8}}, {{204},{8}}, {{ 44},{8}}, -{{172},{8}}, {{108},{8}}, {{236},{8}}, {{ 28},{8}}, {{156},{8}}, -{{ 92},{8}}, {{220},{8}}, {{ 60},{8}}, {{188},{8}}, {{124},{8}}, -{{252},{8}}, {{ 2},{8}}, {{130},{8}}, {{ 66},{8}}, {{194},{8}}, -{{ 34},{8}}, {{162},{8}}, {{ 98},{8}}, {{226},{8}}, {{ 18},{8}}, -{{146},{8}}, {{ 82},{8}}, {{210},{8}}, {{ 50},{8}}, {{178},{8}}, -{{114},{8}}, {{242},{8}}, {{ 10},{8}}, {{138},{8}}, {{ 74},{8}}, -{{202},{8}}, {{ 42},{8}}, {{170},{8}}, {{106},{8}}, {{234},{8}}, -{{ 26},{8}}, {{154},{8}}, {{ 90},{8}}, {{218},{8}}, {{ 58},{8}}, -{{186},{8}}, {{122},{8}}, {{250},{8}}, {{ 6},{8}}, {{134},{8}}, -{{ 70},{8}}, {{198},{8}}, {{ 38},{8}}, {{166},{8}}, {{102},{8}}, -{{230},{8}}, {{ 22},{8}}, {{150},{8}}, {{ 86},{8}}, {{214},{8}}, -{{ 54},{8}}, {{182},{8}}, {{118},{8}}, {{246},{8}}, {{ 14},{8}}, -{{142},{8}}, {{ 78},{8}}, {{206},{8}}, {{ 46},{8}}, {{174},{8}}, -{{110},{8}}, {{238},{8}}, {{ 30},{8}}, {{158},{8}}, {{ 94},{8}}, -{{222},{8}}, {{ 62},{8}}, {{190},{8}}, {{126},{8}}, {{254},{8}}, -{{ 1},{8}}, {{129},{8}}, {{ 65},{8}}, {{193},{8}}, {{ 33},{8}}, -{{161},{8}}, {{ 97},{8}}, {{225},{8}}, {{ 17},{8}}, {{145},{8}}, -{{ 81},{8}}, {{209},{8}}, {{ 49},{8}}, {{177},{8}}, {{113},{8}}, -{{241},{8}}, {{ 9},{8}}, {{137},{8}}, {{ 73},{8}}, {{201},{8}}, -{{ 41},{8}}, {{169},{8}}, {{105},{8}}, {{233},{8}}, {{ 25},{8}}, -{{153},{8}}, {{ 89},{8}}, {{217},{8}}, {{ 57},{8}}, {{185},{8}}, -{{121},{8}}, {{249},{8}}, {{ 5},{8}}, {{133},{8}}, {{ 69},{8}}, -{{197},{8}}, {{ 37},{8}}, {{165},{8}}, {{101},{8}}, {{229},{8}}, -{{ 21},{8}}, {{149},{8}}, {{ 85},{8}}, {{213},{8}}, {{ 53},{8}}, -{{181},{8}}, {{117},{8}}, {{245},{8}}, {{ 13},{8}}, {{141},{8}}, -{{ 77},{8}}, {{205},{8}}, {{ 45},{8}}, {{173},{8}}, {{109},{8}}, -{{237},{8}}, {{ 29},{8}}, {{157},{8}}, {{ 93},{8}}, {{221},{8}}, -{{ 61},{8}}, {{189},{8}}, {{125},{8}}, {{253},{8}}, {{ 19},{9}}, -{{275},{9}}, {{147},{9}}, {{403},{9}}, {{ 83},{9}}, {{339},{9}}, -{{211},{9}}, {{467},{9}}, {{ 51},{9}}, {{307},{9}}, {{179},{9}}, -{{435},{9}}, {{115},{9}}, {{371},{9}}, {{243},{9}}, {{499},{9}}, -{{ 11},{9}}, {{267},{9}}, {{139},{9}}, {{395},{9}}, {{ 75},{9}}, -{{331},{9}}, {{203},{9}}, {{459},{9}}, {{ 43},{9}}, {{299},{9}}, -{{171},{9}}, {{427},{9}}, {{107},{9}}, {{363},{9}}, {{235},{9}}, -{{491},{9}}, {{ 27},{9}}, {{283},{9}}, {{155},{9}}, {{411},{9}}, -{{ 91},{9}}, {{347},{9}}, {{219},{9}}, {{475},{9}}, {{ 59},{9}}, -{{315},{9}}, {{187},{9}}, {{443},{9}}, {{123},{9}}, {{379},{9}}, -{{251},{9}}, {{507},{9}}, {{ 7},{9}}, {{263},{9}}, {{135},{9}}, -{{391},{9}}, {{ 71},{9}}, {{327},{9}}, {{199},{9}}, {{455},{9}}, -{{ 39},{9}}, {{295},{9}}, {{167},{9}}, {{423},{9}}, {{103},{9}}, -{{359},{9}}, {{231},{9}}, {{487},{9}}, {{ 23},{9}}, {{279},{9}}, -{{151},{9}}, {{407},{9}}, {{ 87},{9}}, {{343},{9}}, {{215},{9}}, -{{471},{9}}, {{ 55},{9}}, {{311},{9}}, {{183},{9}}, {{439},{9}}, -{{119},{9}}, {{375},{9}}, {{247},{9}}, {{503},{9}}, {{ 15},{9}}, -{{271},{9}}, {{143},{9}}, {{399},{9}}, {{ 79},{9}}, {{335},{9}}, -{{207},{9}}, {{463},{9}}, {{ 47},{9}}, {{303},{9}}, {{175},{9}}, -{{431},{9}}, {{111},{9}}, {{367},{9}}, {{239},{9}}, {{495},{9}}, -{{ 31},{9}}, {{287},{9}}, {{159},{9}}, {{415},{9}}, {{ 95},{9}}, -{{351},{9}}, {{223},{9}}, {{479},{9}}, {{ 63},{9}}, {{319},{9}}, -{{191},{9}}, {{447},{9}}, {{127},{9}}, {{383},{9}}, {{255},{9}}, -{{511},{9}}, {{ 0},{7}}, {{ 64},{7}}, {{ 32},{7}}, {{ 96},{7}}, -{{ 16},{7}}, {{ 80},{7}}, {{ 48},{7}}, {{112},{7}}, {{ 8},{7}}, -{{ 72},{7}}, {{ 40},{7}}, {{104},{7}}, {{ 24},{7}}, {{ 88},{7}}, -{{ 56},{7}}, {{120},{7}}, {{ 4},{7}}, {{ 68},{7}}, {{ 36},{7}}, -{{100},{7}}, {{ 20},{7}}, {{ 84},{7}}, {{ 52},{7}}, {{116},{7}}, -{{ 3},{8}}, {{131},{8}}, {{ 67},{8}}, {{195},{8}}, {{ 35},{8}}, -{{163},{8}}, {{ 99},{8}}, {{227},{8}} -}; - -Z_INTERNAL const ct_data static_dtree[D_CODES] = { -{{ 0},{5}}, {{16},{5}}, {{ 8},{5}}, {{24},{5}}, {{ 4},{5}}, -{{20},{5}}, {{12},{5}}, {{28},{5}}, {{ 2},{5}}, {{18},{5}}, -{{10},{5}}, {{26},{5}}, {{ 6},{5}}, {{22},{5}}, {{14},{5}}, -{{30},{5}}, {{ 1},{5}}, {{17},{5}}, {{ 9},{5}}, {{25},{5}}, -{{ 5},{5}}, {{21},{5}}, {{13},{5}}, {{29},{5}}, {{ 3},{5}}, -{{19},{5}}, {{11},{5}}, {{27},{5}}, {{ 7},{5}}, {{23},{5}} -}; - -const unsigned char Z_INTERNAL zng_dist_code[DIST_CODE_LEN] = { - 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, -10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, -11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, -18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 -}; - -const unsigned char Z_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, -13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, -17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, -19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 -}; - -Z_INTERNAL const int base_length[LENGTH_CODES] = { -0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, -64, 80, 96, 112, 128, 160, 192, 224, 0 -}; - -Z_INTERNAL const int base_dist[D_CODES] = { - 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, - 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, - 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 -}; - -#endif /* TREES_TBL_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/win32/DLL_FAQ.txt b/internal-complibs/zlib-ng-2.0.7/win32/DLL_FAQ.txt deleted file mode 100644 index 7a5707967..000000000 --- a/internal-complibs/zlib-ng-2.0.7/win32/DLL_FAQ.txt +++ /dev/null @@ -1,397 +0,0 @@ - - Frequently Asked Questions about ZLIB1.DLL - - -This document describes the design, the rationale, and the usage -of the official DLL build of zlib, named ZLIB1.DLL. If you have -general questions about zlib, you should see the file "FAQ" found -in the zlib distribution, or at the following location: - https://www.zlib.net/zlib_faq.html - - - 1. What is ZLIB1.DLL, and how can I get it? - - - ZLIB1.DLL is the official build of zlib as a DLL. - (Please remark the character '1' in the name.) - - Pointers to a precompiled ZLIB1.DLL can be found in the zlib - web site at: - https://www.zlib.net/ - - Applications that link to ZLIB1.DLL can rely on the following - specification: - - * The exported symbols are exclusively defined in the source - files "zlib.h" and "zlib.def", found in an official zlib - source distribution. - * The symbols are exported by name, not by ordinal. - * The exported names are undecorated. - * The calling convention of functions is "C" (CDECL). - * The ZLIB1.DLL binary is linked to MSVCRT.DLL. - - The archive in which ZLIB1.DLL is bundled contains compiled - test programs that must run with a valid build of ZLIB1.DLL. - It is recommended to download the prebuilt DLL from the zlib - web site, instead of building it yourself, to avoid potential - incompatibilities that could be introduced by your compiler - and build settings. If you do build the DLL yourself, please - make sure that it complies with all the above requirements, - and it runs with the precompiled test programs, bundled with - the original ZLIB1.DLL distribution. - - If, for any reason, you need to build an incompatible DLL, - please use a different file name. - - - 2. Why did you change the name of the DLL to ZLIB1.DLL? - What happened to the old ZLIB.DLL? - - - The old ZLIB.DLL, built from zlib-1.1.4 or earlier, required - compilation settings that were incompatible to those used by - a static build. The DLL settings were supposed to be enabled - by defining the macro ZLIB_DLL, before including "zlib.h". - Incorrect handling of this macro was silently accepted at - build time, resulting in two major problems: - - * ZLIB_DLL was missing from the old makefile. When building - the DLL, not all people added it to the build options. In - consequence, incompatible incarnations of ZLIB.DLL started - to circulate around the net. - - * When switching from using the static library to using the - DLL, applications had to define the ZLIB_DLL macro and - to recompile all the sources that contained calls to zlib - functions. Failure to do so resulted in creating binaries - that were unable to run with the official ZLIB.DLL build. - - The only possible solution that we could foresee was to make - a binary-incompatible change in the DLL interface, in order to - remove the dependency on the ZLIB_DLL macro, and to release - the new DLL under a different name. - - We chose the name ZLIB1.DLL, where '1' indicates the major - zlib version number. We hope that we will not have to break - the binary compatibility again, at least not as long as the - zlib-1.x series will last. - - There is still a ZLIB_DLL macro, that can trigger a more - efficient build and use of the DLL, but compatibility no - longer dependents on it. - - - 3. Can I build ZLIB.DLL from the new zlib sources, and replace - an old ZLIB.DLL, that was built from zlib-1.1.4 or earlier? - - - In principle, you can do it by assigning calling convention - keywords to the macros Z_EXPORT and Z_EXPORTVA. In practice, - it depends on what you mean by "an old ZLIB.DLL", because the - old DLL exists in several mutually-incompatible versions. - You have to find out first what kind of calling convention is - being used in your particular ZLIB.DLL build, and to use the - same one in the new build. If you don't know what this is all - about, you might be better off if you would just leave the old - DLL intact. - - - 4. Can I compile my application using the new zlib interface, and - link it to an old ZLIB.DLL, that was built from zlib-1.1.4 or - earlier? - - - The official answer is "no"; the real answer depends again on - what kind of ZLIB.DLL you have. Even if you are lucky, this - course of action is unreliable. - - If you rebuild your application and you intend to use a newer - version of zlib (post- 1.1.4), it is strongly recommended to - link it to the new ZLIB1.DLL. - - - 5. Why are the zlib symbols exported by name, and not by ordinal? - - - Although exporting symbols by ordinal is a little faster, it - is risky. Any single glitch in the maintenance or use of the - DEF file that contains the ordinals can result in incompatible - builds and frustrating crashes. Simply put, the benefits of - exporting symbols by ordinal do not justify the risks. - - Technically, it should be possible to maintain ordinals in - the DEF file, and still export the symbols by name. Ordinals - exist in every DLL, and even if the dynamic linking performed - at the DLL startup is searching for names, ordinals serve as - hints, for a faster name lookup. However, if the DEF file - contains ordinals, the Microsoft linker automatically builds - an implib that will cause the executables linked to it to use - those ordinals, and not the names. It is interesting to - notice that the GNU linker for Win32 does not suffer from this - problem. - - It is possible to avoid the DEF file if the exported symbols - are accompanied by a "__declspec(dllexport)" attribute in the - source files. You can do this in zlib by predefining the - ZLIB_DLL macro. - - - 6. I see that the ZLIB1.DLL functions use the "C" (CDECL) calling - convention. Why not use the STDCALL convention? - STDCALL is the standard convention in Win32, and I need it in - my Visual Basic project! - - (For readability, we use CDECL to refer to the convention - triggered by the "__cdecl" keyword, STDCALL to refer to - the convention triggered by "__stdcall", and FASTCALL to - refer to the convention triggered by "__fastcall".) - - - Most of the native Windows API functions (without varargs) use - indeed the WINAPI convention (which translates to STDCALL in - Win32), but the standard C functions use CDECL. If a user - application is intrinsically tied to the Windows API (e.g. - it calls native Windows API functions such as CreateFile()), - sometimes it makes sense to decorate its own functions with - WINAPI. But if ANSI C or POSIX portability is a goal (e.g. - it calls standard C functions such as fopen()), it is not a - sound decision to request the inclusion of , or to - use non-ANSI constructs, for the sole purpose to make the user - functions STDCALL-able. - - The functionality offered by zlib is not in the category of - "Windows functionality", but is more like "C functionality". - - Technically, STDCALL is not bad; in fact, it is slightly - faster than CDECL, and it works with variable-argument - functions, just like CDECL. It is unfortunate that, in spite - of using STDCALL in the Windows API, it is not the default - convention used by the C compilers that run under Windows. - The roots of the problem reside deep inside the unsafety of - the K&R-style function prototypes, where the argument types - are not specified; but that is another story for another day. - - The remaining fact is that CDECL is the default convention. - Even if an explicit convention is hard-coded into the function - prototypes inside C headers, problems may appear. The - necessity to expose the convention in users' callbacks is one - of these problems. - - The calling convention issues are also important when using - zlib in other programming languages. Some of them, like Ada - (GNAT) and Fortran (GNU G77), have C bindings implemented - initially on Unix, and relying on the C calling convention. - On the other hand, the pre- .NET versions of Microsoft Visual - Basic require STDCALL, while Borland Delphi prefers, although - it does not require, FASTCALL. - - In fairness to all possible uses of zlib outside the C - programming language, we choose the default "C" convention. - Anyone interested in different bindings or conventions is - encouraged to maintain specialized projects. The "contrib/" - directory from the zlib distribution already holds a couple - of foreign bindings, such as Ada, C++, and Delphi. - - - 7. I need a DLL for my Visual Basic project. What can I do? - - - Define the ZLIB_WINAPI macro before including "zlib.h", when - building both the DLL and the user application (except that - you don't need to define anything when using the DLL in Visual - Basic). The ZLIB_WINAPI macro will switch on the WINAPI - (STDCALL) convention. The name of this DLL must be different - than the official ZLIB1.DLL. - - Gilles Vollant has contributed a build named ZLIBWAPI.DLL, - with the ZLIB_WINAPI macro turned on, and with the minizip - functionality built in. For more information, please read - the notes inside "contrib/vstudio/readme.txt", found in the - zlib distribution. - - - 8. I need to use zlib in my Microsoft .NET project. What can I - do? - - - Henrik Ravn has contributed a .NET wrapper around zlib. Look - into contrib/dotzlib/, inside the zlib distribution. - - - 9. If my application uses ZLIB1.DLL, should I link it to - MSVCRT.DLL? Why? - - - It is not required, but it is recommended to link your - application to MSVCRT.DLL, if it uses ZLIB1.DLL. - - The executables (.EXE, .DLL, etc.) that are involved in the - same process and are using the C run-time library (i.e. they - are calling standard C functions), must link to the same - library. There are several libraries in the Win32 system: - CRTDLL.DLL, MSVCRT.DLL, the static C libraries, etc. - Since ZLIB1.DLL is linked to MSVCRT.DLL, the executables that - depend on it should also be linked to MSVCRT.DLL. - - -10. Why are you saying that ZLIB1.DLL and my application should - be linked to the same C run-time (CRT) library? I linked my - application and my DLLs to different C libraries (e.g. my - application to a static library, and my DLLs to MSVCRT.DLL), - and everything works fine. - - - If a user library invokes only pure Win32 API (accessible via - and the related headers), its DLL build will work - in any context. But if this library invokes standard C API, - things get more complicated. - - There is a single Win32 library in a Win32 system. Every - function in this library resides in a single DLL module, that - is safe to call from anywhere. On the other hand, there are - multiple versions of the C library, and each of them has its - own separate internal state. Standalone executables and user - DLLs that call standard C functions must link to a C run-time - (CRT) library, be it static or shared (DLL). Intermixing - occurs when an executable (not necessarily standalone) and a - DLL are linked to different CRTs, and both are running in the - same process. - - Intermixing multiple CRTs is possible, as long as their - internal states are kept intact. The Microsoft Knowledge Base - articles KB94248 "HOWTO: Use the C Run-Time" and KB140584 - "HOWTO: Link with the Correct C Run-Time (CRT) Library" - mention the potential problems raised by intermixing. - - If intermixing works for you, it's because your application - and DLLs are avoiding the corruption of each of the CRTs' - internal states, maybe by careful design, or maybe by fortune. - - Also note that linking ZLIB1.DLL to non-Microsoft CRTs, such - as those provided by Borland, raises similar problems. - - -11. Why are you linking ZLIB1.DLL to MSVCRT.DLL? - - - MSVCRT.DLL exists on every Windows 95 with a new service pack - installed, or with Microsoft Internet Explorer 4 or later, and - on all other Windows 4.x or later (Windows 98, Windows NT 4, - or later). It is freely distributable; if not present in the - system, it can be downloaded from Microsoft or from other - software provider for free. - - The fact that MSVCRT.DLL does not exist on a virgin Windows 95 - is not so problematic. Windows 95 is scarcely found nowadays, - Microsoft ended its support a long time ago, and many recent - applications from various vendors, including Microsoft, do not - even run on it. Furthermore, no serious user should run - Windows 95 without a proper update installed. - - -12. Why are you not linking ZLIB1.DLL to - <> ? - - - We considered and abandoned the following alternatives: - - * Linking ZLIB1.DLL to a static C library (LIBC.LIB, or - LIBCMT.LIB) is not a good option. People are using the DLL - mainly to save disk space. If you are linking your program - to a static C library, you may as well consider linking zlib - in statically, too. - - * Linking ZLIB1.DLL to CRTDLL.DLL looks appealing, because - CRTDLL.DLL is present on every Win32 installation. - Unfortunately, it has a series of problems: it does not - work properly with Microsoft's C++ libraries, it does not - provide support for 64-bit file offsets, (and so on...), - and Microsoft discontinued its support a long time ago. - - * Linking ZLIB1.DLL to MSVCR70.DLL or MSVCR71.DLL, supplied - with the Microsoft .NET platform, and Visual C++ 7.0/7.1, - raises problems related to the status of ZLIB1.DLL as a - system component. According to the Microsoft Knowledge Base - article KB326922 "INFO: Redistribution of the Shared C - Runtime Component in Visual C++ .NET", MSVCR70.DLL and - MSVCR71.DLL are not supposed to function as system DLLs, - because they may clash with MSVCRT.DLL. Instead, the - application's installer is supposed to put these DLLs - (if needed) in the application's private directory. - If ZLIB1.DLL depends on a non-system runtime, it cannot - function as a redistributable system component. - - * Linking ZLIB1.DLL to non-Microsoft runtimes, such as - Borland's, or Cygwin's, raises problems related to the - reliable presence of these runtimes on Win32 systems. - It's easier to let the DLL build of zlib up to the people - who distribute these runtimes, and who may proceed as - explained in the answer to Question 14. - - -13. If ZLIB1.DLL cannot be linked to MSVCR70.DLL or MSVCR71.DLL, - how can I build/use ZLIB1.DLL in Microsoft Visual C++ 7.0 - (Visual Studio .NET) or newer? - - - Due to the problems explained in the Microsoft Knowledge Base - article KB326922 (see the previous answer), the C runtime that - comes with the VC7 environment is no longer considered a - system component. That is, it should not be assumed that this - runtime exists, or may be installed in a system directory. - Since ZLIB1.DLL is supposed to be a system component, it may - not depend on a non-system component. - - In order to link ZLIB1.DLL and your application to MSVCRT.DLL - in VC7, you need the library of Visual C++ 6.0 or older. If - you don't have this library at hand, it's probably best not to - use ZLIB1.DLL. - - We are hoping that, in the future, Microsoft will provide a - way to build applications linked to a proper system runtime, - from the Visual C++ environment. Until then, you have a - couple of alternatives, such as linking zlib in statically. - If your application requires dynamic linking, you may proceed - as explained in the answer to Question 14. - - -14. I need to link my own DLL build to a CRT different than - MSVCRT.DLL. What can I do? - - - Feel free to rebuild the DLL from the zlib sources, and link - it the way you want. You should, however, clearly state that - your build is unofficial. You should give it a different file - name, and/or install it in a private directory that can be - accessed by your application only, and is not visible to the - others (i.e. it's neither in the PATH, nor in the SYSTEM or - SYSTEM32 directories). Otherwise, your build may clash with - applications that link to the official build. - - For example, in Cygwin, zlib is linked to the Cygwin runtime - CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL. - - -15. May I include additional pieces of code that I find useful, - link them in ZLIB1.DLL, and export them? - - - No. A legitimate build of ZLIB1.DLL must not include code - that does not originate from the official zlib source code. - But you can make your own private DLL build, under a different - file name, as suggested in the previous answer. - - For example, zlib is a part of the VCL library, distributed - with Borland Delphi and C++ Builder. The DLL build of VCL - is a redistributable file, named VCLxx.DLL. - - -16. May I remove some functionality out of ZLIB1.DLL, by enabling - macros like NO_GZCOMPRESS or NO_GZIP at compile time? - - - No. A legitimate build of ZLIB1.DLL must provide the complete - zlib functionality, as implemented in the official zlib source - code. But you can make your own private DLL build, under a - different file name, as suggested in the previous answer. - - -17. I made my own ZLIB1.DLL build. Can I test it for compliance? - - - We prefer that you download the official DLL from the zlib - web site. If you need something peculiar from this DLL, you - can send your suggestion to the zlib mailing list. - - However, in case you do rebuild the DLL yourself, you can run - it with the test programs found in the DLL distribution. - Running these test programs is not a guarantee of compliance, - but a failure can imply a detected problem. - -** - -This document is written and maintained by -Cosmin Truta diff --git a/internal-complibs/zlib-ng-2.0.7/win32/Makefile.a64 b/internal-complibs/zlib-ng-2.0.7/win32/Makefile.a64 deleted file mode 100644 index a2f2e6a60..000000000 --- a/internal-complibs/zlib-ng-2.0.7/win32/Makefile.a64 +++ /dev/null @@ -1,208 +0,0 @@ -# Makefile for zlib using Microsoft (Visual) C -# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler -# -# Usage: -# nmake -f win32/Makefile.a64 (standard build) -# nmake -f win32/Makefile.a64 LOC=-DFOO (nonstandard build) - -# The toplevel directory of the source tree. -# -TOP = . - -# optional build flags -LOC = - -# variables -STATICLIB = zlib.lib -SHAREDLIB = zlib1.dll -IMPLIB = zdll.lib - -CC = cl -LD = link -AR = lib -RC = rc -CP = copy /y -CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) -WFLAGS = \ - -D_CRT_SECURE_NO_DEPRECATE \ - -D_CRT_NONSTDC_NO_DEPRECATE \ - -DUNALIGNED_OK \ - -DUNALIGNED64_OK \ - -D_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 \ - -DARM_FEATURES \ - # -LDFLAGS = -nologo -debug -incremental:no -opt:ref -manifest -ARFLAGS = -nologo -RCFLAGS = /dARM64 /r -DEFFILE = zlib.def -RCFILE = zlib1.rc -RESFILE = zlib1.res -WITH_GZFILEOP = yes -ZLIB_COMPAT = -SUFFIX = - -OBJS = \ - adler32.obj \ - armfeature.obj \ - chunkset.obj \ - compare258.obj \ - compress.obj \ - crc32.obj \ - crc32_comb.obj \ - deflate.obj \ - deflate_fast.obj \ - deflate_slow.obj \ - deflate_quick.obj \ - deflate_medium.obj \ - functable.obj \ - infback.obj \ - inflate.obj \ - inftrees.obj \ - inffast.obj \ - insert_string.obj \ - trees.obj \ - uncompr.obj \ - zutil.obj \ - # -!if "$(ZLIB_COMPAT)" != "" -WITH_GZFILEOP = yes -WFLAGS = $(WFLAGS) -DZLIB_COMPAT -DEFFILE = zlibcompat.def -!else -STATICLIB = zlib-ng.lib -SHAREDLIB = zlib-ng1.dll -IMPLIB = zngdll.lib -DEFFILE = zlib-ng.def -RCFILE = zlib-ng1.rc -RESFILE = zlib-ng1.res -SUFFIX = -ng -!endif - -!if "$(WITH_GZFILEOP)" != "" -WFLAGS = $(WFLAGS) -DWITH_GZFILEOP -OBJS = $(OBJS) gzlib.obj gzread.obj gzwrite.obj -!endif - -WFLAGS = $(WFLAGS) \ - -DARM_ACLE_CRC_HASH \ - -D__ARM_NEON__=1 \ - -DARM_NEON_ADLER32 \ - -DARM_NEON_CHUNKSET \ - -DARM_NEON_SLIDEHASH \ - -DARM_NOCHECK_NEON \ - # -OBJS = $(OBJS) crc32_acle.obj insert_string_acle.obj adler32_neon.obj chunkset_neon.obj slide_neon.obj - -# targets -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ - example.exe minigzip.exe example_d.exe minigzip_d.exe - -zconf: $(TOP)/zconf$(SUFFIX).h.in - $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h - -$(STATICLIB): zconf $(OBJS) - $(AR) $(ARFLAGS) -out:$@ $(OBJS) - -$(IMPLIB): $(SHAREDLIB) - -$(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE) - $(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \ - -out:$@ -base:0x55A4C0000 $(OBJS) $(RESFILE) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;2 - -example.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -example_d.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip_d.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -{$(TOP)}.c.obj: - $(CC) -c $(WFLAGS) $(CFLAGS) $< - -gzlib2.obj: gzlib.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c - -gzread2.obj: gzread.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c - -gzwrite2.obj: gzwrite.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c - -{$(TOP)/arch/arm}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< - -{$(TOP)/test}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $< - -$(TOP)/zconf$(SUFFIX).h: zconf - -SRCDIR = $(TOP) -# Keep the dependences in sync with top-level Makefile.in -adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h -chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86.h -gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -crc32.obj: $(SRCDIR)/crc32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_tbl.h -crc32_comb.obj: $(SRCDIR)/crc32_comb.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/crc32_comb_tbl.h -deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h -deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h -inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h -inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h -inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h -trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h -zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h - -example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -$(RESFILE): $(TOP)/win32/$(RCFILE) - $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE) - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -testdll: example_d.exe minigzip_d.exe - example_d - echo hello world | minigzip_d | minigzip_d -d - - -# cleanup -clean: - -del $(STATICLIB) - -del $(SHAREDLIB) - -del $(IMPLIB) - -del *.obj - -del *.res - -del *.exp - -del *.exe - -del *.pdb - -del *.manifest - -distclean: clean - -del zconf$(SUFFIX).h diff --git a/internal-complibs/zlib-ng-2.0.7/win32/Makefile.arm b/internal-complibs/zlib-ng-2.0.7/win32/Makefile.arm deleted file mode 100644 index 5ed53f5f3..000000000 --- a/internal-complibs/zlib-ng-2.0.7/win32/Makefile.arm +++ /dev/null @@ -1,220 +0,0 @@ -# Makefile for zlib using Microsoft (Visual) C -# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler -# -# Usage: -# nmake -f win32/Makefile.arm (standard build) -# nmake -f win32/Makefile.arm LOC=-DFOO (nonstandard build) - -# The toplevel directory of the source tree. -# -TOP = . - -# optional build flags -LOC = - -# variables -STATICLIB = zlib.lib -SHAREDLIB = zlib1.dll -IMPLIB = zdll.lib - -CC = cl -LD = link -AR = lib -RC = rc -CP = copy /y -CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) -WFLAGS = \ - -D_CRT_SECURE_NO_DEPRECATE \ - -D_CRT_NONSTDC_NO_DEPRECATE \ - -DUNALIGNED_OK \ - -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 \ - -DARM_FEATURES \ - # -LDFLAGS = -nologo -debug -incremental:no -opt:ref -manifest -ARFLAGS = -nologo -RCFLAGS = /dARM /r -DEFFILE = zlib.def -RCFILE = zlib1.rc -RESFILE = zlib1.res -WITH_GZFILEOP = yes -ZLIB_COMPAT = -WITH_ACLE = -WITH_NEON = -WITH_VFPV3 = -NEON_ARCH = /arch:VFPv4 -SUFFIX = - -OBJS = \ - adler32.obj \ - armfeature.obj \ - chunkset.obj \ - compare258.obj \ - compress.obj \ - crc32.obj \ - crc32_comb.obj \ - deflate.obj \ - deflate_fast.obj \ - deflate_slow.obj \ - deflate_quick.obj \ - deflate_medium.obj \ - functable.obj \ - infback.obj \ - inflate.obj \ - inftrees.obj \ - inffast.obj \ - insert_string.obj \ - trees.obj \ - uncompr.obj \ - zutil.obj \ - # -!if "$(ZLIB_COMPAT)" != "" -WITH_GZFILEOP = yes -WFLAGS = $(WFLAGS) -DZLIB_COMPAT -DEFFILE = zlibcompat.def -!else -STATICLIB = zlib-ng.lib -SHAREDLIB = zlib-ng1.dll -IMPLIB = zngdll.lib -DEFFILE = zlib-ng.def -RCFILE = zlib-ng1.rc -RESFILE = zlib-ng1.res -SUFFIX = -ng -!endif - -!if "$(WITH_GZFILEOP)" != "" -WFLAGS = $(WFLAGS) -DWITH_GZFILEOP -OBJS = $(OBJS) gzlib.obj gzread.obj gzwrite.obj -!endif - -!if "$(WITH_ACLE)" != "" -WFLAGS = $(WFLAGS) -DARM_ACLE_CRC_HASH -OBJS = $(OBJS) crc32_acle.obj insert_string_acle.obj -!endif -!if "$(WITH_VFPV3)" != "" -NEON_ARCH = /arch:VFPv3 -!endif -!if "$(WITH_NEON)" != "" -CFLAGS = $(CFLAGS) $(NEON_ARCH) -WFLAGS = $(WFLAGS) \ - -D__ARM_NEON__=1 \ - -DARM_NEON_ADLER32 \ - -DARM_NEON_CHUNKSET \ - -DARM_NEON_SLIDEHASH \ - -DARM_NOCHECK_NEON \ - # -OBJS = $(OBJS) adler32_neon.obj chunkset_neon.obj slide_neon.obj -!endif - -# targets -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ - example.exe minigzip.exe example_d.exe minigzip_d.exe - -zconf: $(TOP)/zconf$(SUFFIX).h.in - $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h - -$(STATICLIB): zconf $(OBJS) - $(AR) $(ARFLAGS) -out:$@ $(OBJS) - -$(IMPLIB): $(SHAREDLIB) - -$(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE) - $(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \ - -out:$@ -base:0x5A4C0000 $(OBJS) $(RESFILE) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;2 - -example.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -example_d.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip_d.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -{$(TOP)}.c.obj: - $(CC) -c $(WFLAGS) $(CFLAGS) $< - -gzlib2.obj: gzlib.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c - -gzread2.obj: gzread.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c - -gzwrite2.obj: gzwrite.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c - -{$(TOP)/arch/arm}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< - -{$(TOP)/test}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $< - -$(TOP)/zconf$(SUFFIX).h: zconf - -SRCDIR = $(TOP) -# Keep the dependences in sync with top-level Makefile.in -adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h -functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86.h -gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -crc32.obj: $(SRCDIR)/crc32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_tbl.h -crc32_comb.obj: $(SRCDIR)/crc32_comb.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/crc32_comb_tbl.h -deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h -deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h -inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h -inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h -inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h -trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h -zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h - -example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -$(RESFILE): $(TOP)/win32/$(RCFILE) - $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE) - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -testdll: example_d.exe minigzip_d.exe - example_d - echo hello world | minigzip_d | minigzip_d -d - - -# cleanup -clean: - -del $(STATICLIB) - -del $(SHAREDLIB) - -del $(IMPLIB) - -del *.obj - -del *.res - -del *.exp - -del *.exe - -del *.pdb - -del *.manifest - -distclean: clean - -del zconf$(SUFFIX).h diff --git a/internal-complibs/zlib-ng-2.0.7/win32/Makefile.msc b/internal-complibs/zlib-ng-2.0.7/win32/Makefile.msc deleted file mode 100644 index f1c711cc4..000000000 --- a/internal-complibs/zlib-ng-2.0.7/win32/Makefile.msc +++ /dev/null @@ -1,215 +0,0 @@ -# Makefile for zlib using Microsoft (Visual) C -# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler -# -# Usage: -# nmake -f win32/Makefile.msc (standard build) -# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build) - -# The toplevel directory of the source tree. -# -TOP = . - -# optional build flags -LOC = - -# variables -STATICLIB = zlib.lib -SHAREDLIB = zlib1.dll -IMPLIB = zdll.lib - -CC = cl -LD = link -AR = lib -RC = rc -CP = copy /y -CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) -WFLAGS = \ - -D_CRT_SECURE_NO_DEPRECATE \ - -D_CRT_NONSTDC_NO_DEPRECATE \ - -DX86_FEATURES \ - -DX86_PCLMULQDQ_CRC \ - -DX86_SSE2 \ - -DX86_SSE42_CRC_INTRIN \ - -DX86_SSE42_CRC_HASH \ - -DX86_AVX2 \ - -DX86_AVX_CHUNKSET \ - -DX86_SSE2_CHUNKSET \ - -DUNALIGNED_OK \ - -DUNALIGNED64_OK \ - # -LDFLAGS = -nologo -debug -incremental:no -opt:ref -manifest -ARFLAGS = -nologo -RCFLAGS = /dWIN32 /r -DEFFILE = zlib.def -RCFILE = zlib1.rc -RESFILE = zlib1.res -WITH_GZFILEOP = yes -ZLIB_COMPAT = -SUFFIX = - -OBJS = \ - adler32.obj \ - chunkset.obj \ - chunkset_avx.obj \ - chunkset_sse.obj \ - compare258.obj \ - compare258_avx.obj \ - compare258_sse.obj \ - compress.obj \ - crc32.obj \ - crc32_comb.obj \ - crc_folding.obj \ - deflate.obj \ - deflate_fast.obj \ - deflate_quick.obj \ - deflate_slow.obj \ - deflate_medium.obj \ - functable.obj \ - infback.obj \ - inflate.obj \ - inftrees.obj \ - inffast.obj \ - insert_string.obj \ - insert_string_sse.obj \ - slide_avx.obj \ - slide_sse.obj \ - trees.obj \ - uncompr.obj \ - zutil.obj \ - x86.obj \ - # -!if "$(ZLIB_COMPAT)" != "" -WITH_GZFILEOP = yes -WFLAGS = $(WFLAGS) -DZLIB_COMPAT -DEFFILE = zlibcompat.def -!else -STATICLIB = zlib-ng.lib -SHAREDLIB = zlib-ng1.dll -IMPLIB = zngdll.lib -DEFFILE = zlib-ng.def -RCFILE = zlib-ng1.rc -RESFILE = zlib-ng1.res -SUFFIX = -ng -!endif - -!if "$(WITH_GZFILEOP)" != "" -WFLAGS = $(WFLAGS) -DWITH_GZFILEOP -OBJS = $(OBJS) gzlib.obj gzread.obj gzwrite.obj -!endif - -# targets -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ - example.exe minigzip.exe example_d.exe minigzip_d.exe - -zconf: $(TOP)/zconf$(SUFFIX).h.in - $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h - -$(STATICLIB): zconf $(OBJS) - $(AR) $(ARFLAGS) -out:$@ $(OBJS) - -$(IMPLIB): $(SHAREDLIB) - -$(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE) - $(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \ - -out:$@ $(OBJS) $(RESFILE) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;2 - -example.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -example_d.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip_d.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -{$(TOP)}.c.obj: - $(CC) -c $(WFLAGS) $(CFLAGS) $< - -gzlib2.obj: gzlib.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c - -gzread2.obj: gzread.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c - -gzwrite2.obj: gzwrite.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c - -{$(TOP)/arch/x86}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< - -{$(TOP)/test}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $< - -$(TOP)/zconf$(SUFFIX).h: zconf - -SRCDIR = $(TOP) -# Keep the dependences in sync with top-level Makefile.in -adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h -functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86.h -gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -chunkset_avx.obj: $(SRCDIR)/arch/x86/chunkset_avx.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -chunkset_sse.obj: $(SRCDIR)/arch/x86/chunkset_sse.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -crc32.obj: $(SRCDIR)/crc32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_tbl.h -crc32_comb.obj: $(SRCDIR)/crc32_comb.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/crc32_comb_tbl.h -deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h -deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h -inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h -inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h -inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h -slide_sse.obj: $(SRCDIR)/arch/x86/slide_sse.c $(SRCDIR)/deflate.h -trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h -zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h - -example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -$(RESFILE): $(TOP)/win32/$(RCFILE) - $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE) - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -testdll: example_d.exe minigzip_d.exe - example_d - echo hello world | minigzip_d | minigzip_d -d - - -# cleanup -clean: - -del $(STATICLIB) - -del $(SHAREDLIB) - -del $(IMPLIB) - -del *.obj - -del *.res - -del *.exp - -del *.exe - -del *.pdb - -del *.manifest - -distclean: clean - -del zconf$(SUFFIX).h diff --git a/internal-complibs/zlib-ng-2.0.7/win32/README-WIN32.txt b/internal-complibs/zlib-ng-2.0.7/win32/README-WIN32.txt deleted file mode 100644 index 905ace6b8..000000000 --- a/internal-complibs/zlib-ng-2.0.7/win32/README-WIN32.txt +++ /dev/null @@ -1,103 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.11 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -https://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) -and rfc1952.txt (gzip format). - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). Two compiled -examples are distributed in this package, example and minigzip. The example_d -and minigzip_d flavors validate that the zlib1.dll file is working correctly. - -Questions about zlib should be sent to . The zlib home page -is https://zlib.net/ . Before reporting a problem, please check this site to -verify that you have the latest version of zlib; otherwise get the latest -version and check whether the problem still exists or not. - -PLEASE read DLL_FAQ.txt, and the the zlib FAQ https://zlib.net/zlib_faq.html -before asking for help. - - -Manifest: - -The package zlib-1.2.11-win32-x86.zip will contain the following files: - - README-WIN32.txt This document - ChangeLog Changes since previous zlib packages - DLL_FAQ.txt Frequently asked questions about zlib1.dll - zlib.3.pdf Documentation of this library in Adobe Acrobat format - - example.exe A statically-bound example (using zlib.lib, not the dll) - example.pdb Symbolic information for debugging example.exe - - example_d.exe A zlib1.dll bound example (using zdll.lib) - example_d.pdb Symbolic information for debugging example_d.exe - - minigzip.exe A statically-bound test program (using zlib.lib, not the dll) - minigzip.pdb Symbolic information for debugging minigzip.exe - - minigzip_d.exe A zlib1.dll bound test program (using zdll.lib) - minigzip_d.pdb Symbolic information for debugging minigzip_d.exe - - zlib.h Install these files into the compilers' INCLUDE path to - zconf.h compile programs which use zlib.lib or zdll.lib - - zdll.lib Install these files into the compilers' LIB path if linking - zdll.exp a compiled program to the zlib1.dll binary - - zlib.lib Install these files into the compilers' LIB path to link zlib - zlib.pdb into compiled programs, without zlib1.dll runtime dependency - (zlib.pdb provides debugging info to the compile time linker) - - zlib1.dll Install this binary shared library into the system PATH, or - the program's runtime directory (where the .exe resides) - zlib1.pdb Install in the same directory as zlib1.dll, in order to debug - an application crash using WinDbg or similar tools. - -All .pdb files above are entirely optional, but are very useful to a developer -attempting to diagnose program misbehavior or a crash. Many additional -important files for developers can be found in the zlib127.zip source package -available from https://zlib.net/ - review that package's README file for details. - - -Acknowledgments: - -The deflate format used by zlib was defined by Phil Katz. The deflate and -zlib specifications were written by L. Peter Deutsch. Thanks to all the -people who reported problems and suggested various improvements in zlib; they -are too numerous to cite here. - - -Copyright notice: - - (C) 1995-2012 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* receiving -lengthy legal documents to sign. The sources are provided for free but without -warranty of any kind. The library has been entirely written by Jean-loup -Gailly and Mark Adler; it does not include third-party code. - -If you redistribute modified sources, we would appreciate that you include in -the file ChangeLog history information documenting your changes. Please read -the FAQ for more information on the distribution of modified source versions. diff --git a/internal-complibs/zlib-ng-2.0.7/win32/zlib-ng.def b/internal-complibs/zlib-ng-2.0.7/win32/zlib-ng.def deleted file mode 100644 index 467d79009..000000000 --- a/internal-complibs/zlib-ng-2.0.7/win32/zlib-ng.def +++ /dev/null @@ -1,60 +0,0 @@ -; zlib-ng data compression library -EXPORTS -; basic functions - zlibng_version - zng_deflate - zng_deflateEnd - zng_inflate - zng_inflateEnd -; advanced functions - zng_deflateSetDictionary - zng_deflateGetDictionary - zng_deflateCopy - zng_deflateReset - zng_deflateParams - zng_deflateTune - zng_deflateBound - zng_deflatePending - zng_deflatePrime - zng_deflateSetHeader - zng_deflateSetParams - zng_deflateGetParams - zng_inflateSetDictionary - zng_inflateGetDictionary - zng_inflateSync - zng_inflateCopy - zng_inflateReset - zng_inflateReset2 - zng_inflatePrime - zng_inflateMark - zng_inflateGetHeader - zng_inflateBack - zng_inflateBackEnd - zng_zlibCompileFlags -; utility functions - zng_compress - zng_compress2 - zng_compressBound - zng_uncompress - zng_uncompress2 -; checksum functions - zng_adler32 - zng_adler32_z - zng_crc32 - zng_crc32_z - zng_adler32_combine - zng_crc32_combine -; various hacks, don't look :) - zng_deflateInit_ - zng_deflateInit2_ - zng_inflateInit_ - zng_inflateInit2_ - zng_inflateBackInit_ - zng_zError - zng_inflateSyncPoint - zng_get_crc_table - zng_inflateUndermine - zng_inflateValidate - zng_inflateCodesUsed - zng_inflateResetKeep - zng_deflateResetKeep diff --git a/internal-complibs/zlib-ng-2.0.7/win32/zlib.def b/internal-complibs/zlib-ng-2.0.7/win32/zlib.def deleted file mode 100644 index 67644205a..000000000 --- a/internal-complibs/zlib-ng-2.0.7/win32/zlib.def +++ /dev/null @@ -1,61 +0,0 @@ -; zlib data compression library -EXPORTS -; basic functions - zlibVersion - deflate - deflateEnd - inflate - inflateEnd -; advanced functions - deflateSetDictionary - deflateGetDictionary - deflateCopy - deflateReset - deflateParams - deflateTune - deflateBound - deflatePending - deflatePrime - deflateSetHeader - inflateSetDictionary - inflateGetDictionary - inflateSync - inflateCopy - inflateReset - inflateReset2 - inflatePrime - inflateMark - inflateGetHeader - inflateBack - inflateBackEnd - zlibCompileFlags -; utility functions - compress - compress2 - compressBound - uncompress - uncompress2 -; large file functions - adler32_combine64 - crc32_combine64 -; checksum functions - adler32 - adler32_z - crc32 - crc32_z - adler32_combine - crc32_combine -; various hacks, don't look :) - deflateInit_ - deflateInit2_ - inflateInit_ - inflateInit2_ - inflateBackInit_ - zError - inflateSyncPoint - get_crc_table - inflateUndermine - inflateValidate - inflateCodesUsed - inflateResetKeep - deflateResetKeep diff --git a/internal-complibs/zlib-ng-2.0.7/win32/zlibcompat.def b/internal-complibs/zlib-ng-2.0.7/win32/zlibcompat.def deleted file mode 100644 index a2188b000..000000000 --- a/internal-complibs/zlib-ng-2.0.7/win32/zlibcompat.def +++ /dev/null @@ -1,94 +0,0 @@ -; zlib data compression library -EXPORTS -; basic functions - zlibVersion - deflate - deflateEnd - inflate - inflateEnd -; advanced functions - deflateSetDictionary - deflateGetDictionary - deflateCopy - deflateReset - deflateParams - deflateTune - deflateBound - deflatePending - deflatePrime - deflateSetHeader - inflateSetDictionary - inflateGetDictionary - inflateSync - inflateCopy - inflateReset - inflateReset2 - inflatePrime - inflateMark - inflateGetHeader - inflateBack - inflateBackEnd - zlibCompileFlags -; utility functions - compress - compress2 - compressBound - uncompress - uncompress2 - gzopen - gzdopen - gzbuffer - gzsetparams - gzread - gzfread - gzwrite - gzfwrite - gzprintf - gzvprintf - gzputs - gzgets - gzputc - gzgetc - gzungetc - gzflush - gzseek - gzrewind - gztell - gzoffset - gzeof - gzdirect - gzclose - gzclose_r - gzclose_w - gzerror - gzclearerr -; large file functions - gzopen64 - gzseek64 - gztell64 - gzoffset64 - adler32_combine64 - crc32_combine64 -; checksum functions - adler32 - adler32_z - crc32 - crc32_z - adler32_combine - crc32_combine -; various hacks, don't look :) - deflateInit_ - deflateInit2_ - inflateInit_ - inflateInit2_ - inflateBackInit_ - gzgetc_ - zError - inflateSyncPoint - get_crc_table - inflateUndermine - inflateValidate - inflateCodesUsed - inflateResetKeep - deflateResetKeep - gzopen_w diff --git a/internal-complibs/zlib-ng-2.0.7/zbuild.h b/internal-complibs/zlib-ng-2.0.7/zbuild.h deleted file mode 100644 index 17f98101a..000000000 --- a/internal-complibs/zlib-ng-2.0.7/zbuild.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef _ZBUILD_H -#define _ZBUILD_H - -#ifndef _ISOC11_SOURCE -# define _ISOC11_SOURCE 1 /* aligned_alloc */ -#endif - -/* This has to be first include that defines any types */ -#if defined(_MSC_VER) -# if defined(_WIN64) - typedef __int64 ssize_t; -# else - typedef long ssize_t; -# endif -#endif - -#if defined(ZLIB_COMPAT) -# define PREFIX(x) x -# define PREFIX2(x) ZLIB_ ## x -# define PREFIX3(x) z_ ## x -# define PREFIX4(x) x ## 64 -# define zVersion zlibVersion -# define z_size_t unsigned long -#else -# define PREFIX(x) zng_ ## x -# define PREFIX2(x) ZLIBNG_ ## x -# define PREFIX3(x) zng_ ## x -# define PREFIX4(x) zng_ ## x -# define zVersion zlibng_version -# define z_size_t size_t -#endif - -/* Minimum of a and b. */ -#define MIN(a, b) ((a) > (b) ? (b) : (a)) -/* Maximum of a and b. */ -#define MAX(a, b) ((a) < (b) ? (b) : (a)) -/* Ignore unused variable warning */ -#define Z_UNUSED(var) (void)(var) - -#if defined(__has_feature) -# if __has_feature(memory_sanitizer) -# define Z_MEMORY_SANITIZER 1 -# include -# endif -#endif - -#endif diff --git a/internal-complibs/zlib-ng-2.0.7/zconf.h b/internal-complibs/zlib-ng-2.0.7/zconf.h deleted file mode 100644 index 1c03f294f..000000000 --- a/internal-complibs/zlib-ng-2.0.7/zconf.h +++ /dev/null @@ -1,201 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef ZCONF_H -#define ZCONF_H - -#if !defined(_WIN32) && defined(__WIN32__) -# define _WIN32 -#endif - -#ifdef __STDC_VERSION__ -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif - -/* Clang macro for detecting declspec support - * https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute - */ -#ifndef __has_declspec_attribute -# define __has_declspec_attribute(x) 0 -#endif - -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# define MAX_MEM_LEVEL 9 -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus about 7 kilobytes - for small objects. -*/ - -/* Type declarations */ - - -#ifndef OF /* function prototypes */ -# define OF(args) args -#endif - -#ifdef ZLIB_INTERNAL -# define Z_INTERNAL ZLIB_INTERNAL -#endif - -/* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -#if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))) -# ifdef Z_INTERNAL -# define Z_EXTERN extern __declspec(dllexport) -# else -# define Z_EXTERN extern __declspec(dllimport) -# endif -#endif - -/* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -#if defined(ZLIB_WINAPI) && defined(_WIN32) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define Z_EXPORT WINAPI -# define Z_EXPORTVA WINAPIV -#endif - -#ifndef Z_EXTERN -# define Z_EXTERN extern -#endif -#ifndef Z_EXPORT -# define Z_EXPORT -#endif -#ifndef Z_EXPORTVA -# define Z_EXPORTVA -#endif - -/* For backwards compatibility */ - -#ifndef ZEXTERN -# define ZEXTERN Z_EXTERN -#endif -#ifndef ZEXPORT -# define ZEXPORT Z_EXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA Z_EXPORTVA -#endif - -/* Legacy zlib typedefs for backwards compatibility. Don't assume stdint.h is defined. */ -typedef unsigned char Byte; -typedef Byte Bytef; - -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -typedef char charf; -typedef int intf; -typedef uInt uIntf; -typedef uLong uLongf; - -typedef void const *voidpc; -typedef void *voidpf; -typedef void *voidp; - -typedef unsigned int z_crc_t; - -#if 1 /* was set to #if 1 by configure/cmake/etc */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */ -typedef PTRDIFF_TYPE ptrdiff_t; -#endif - -#include /* for off_t */ - -#include /* for wchar_t and NULL */ - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ -#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifndef z_off_t -# define z_off_t off_t -# endif -#endif - -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 -#endif - -#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 -#endif - -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 -#endif - -#if !defined(SEEK_SET) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t -#else -# if defined(__MSYS__) -# define z_off64_t _off64_t -# elif defined(_WIN32) && !defined(__GNUC__) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif -#endif - -#endif /* ZCONF_H */ diff --git a/internal-complibs/zlib-ng-2.0.7/zconf.h.included b/internal-complibs/zlib-ng-2.0.7/zconf.h.included deleted file mode 100644 index 1c03f294f..000000000 --- a/internal-complibs/zlib-ng-2.0.7/zconf.h.included +++ /dev/null @@ -1,201 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef ZCONF_H -#define ZCONF_H - -#if !defined(_WIN32) && defined(__WIN32__) -# define _WIN32 -#endif - -#ifdef __STDC_VERSION__ -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif - -/* Clang macro for detecting declspec support - * https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute - */ -#ifndef __has_declspec_attribute -# define __has_declspec_attribute(x) 0 -#endif - -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# define MAX_MEM_LEVEL 9 -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus about 7 kilobytes - for small objects. -*/ - -/* Type declarations */ - - -#ifndef OF /* function prototypes */ -# define OF(args) args -#endif - -#ifdef ZLIB_INTERNAL -# define Z_INTERNAL ZLIB_INTERNAL -#endif - -/* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -#if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))) -# ifdef Z_INTERNAL -# define Z_EXTERN extern __declspec(dllexport) -# else -# define Z_EXTERN extern __declspec(dllimport) -# endif -#endif - -/* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -#if defined(ZLIB_WINAPI) && defined(_WIN32) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define Z_EXPORT WINAPI -# define Z_EXPORTVA WINAPIV -#endif - -#ifndef Z_EXTERN -# define Z_EXTERN extern -#endif -#ifndef Z_EXPORT -# define Z_EXPORT -#endif -#ifndef Z_EXPORTVA -# define Z_EXPORTVA -#endif - -/* For backwards compatibility */ - -#ifndef ZEXTERN -# define ZEXTERN Z_EXTERN -#endif -#ifndef ZEXPORT -# define ZEXPORT Z_EXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA Z_EXPORTVA -#endif - -/* Legacy zlib typedefs for backwards compatibility. Don't assume stdint.h is defined. */ -typedef unsigned char Byte; -typedef Byte Bytef; - -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -typedef char charf; -typedef int intf; -typedef uInt uIntf; -typedef uLong uLongf; - -typedef void const *voidpc; -typedef void *voidpf; -typedef void *voidp; - -typedef unsigned int z_crc_t; - -#if 1 /* was set to #if 1 by configure/cmake/etc */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */ -typedef PTRDIFF_TYPE ptrdiff_t; -#endif - -#include /* for off_t */ - -#include /* for wchar_t and NULL */ - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ -#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifndef z_off_t -# define z_off_t off_t -# endif -#endif - -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 -#endif - -#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 -#endif - -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 -#endif - -#if !defined(SEEK_SET) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t -#else -# if defined(__MSYS__) -# define z_off64_t _off64_t -# elif defined(_WIN32) && !defined(__GNUC__) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif -#endif - -#endif /* ZCONF_H */ diff --git a/internal-complibs/zlib-ng-2.0.7/zutil.h b/internal-complibs/zlib-ng-2.0.7/zutil.h deleted file mode 100644 index 757873717..000000000 --- a/internal-complibs/zlib-ng-2.0.7/zutil.h +++ /dev/null @@ -1,274 +0,0 @@ -#ifndef ZUTIL_H_ -#define ZUTIL_H_ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -#if defined(HAVE_VISIBILITY_INTERNAL) -# define Z_INTERNAL __attribute__((visibility ("internal"))) -#elif defined(HAVE_VISIBILITY_HIDDEN) -# define Z_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define Z_INTERNAL -#endif - -#ifndef __cplusplus -# define Z_REGISTER register -#else -# define Z_REGISTER -#endif - -#ifndef Z_TLS -# define Z_TLS -#endif - -#include -#include -#include -#include -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif -#include "zbuild.h" - -typedef unsigned char uch; /* Included for compatibility with external code only */ -typedef uint16_t ush; /* Included for compatibility with external code only */ -typedef unsigned long ulg; - -extern z_const char * const PREFIX(z_errmsg)[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) PREFIX(z_errmsg)[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm, err) return (strm->msg = ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - -#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */ - -#define ZLIB_WRAPLEN 6 /* zlib format overhead */ -#define GZIP_WRAPLEN 18 /* gzip format overhead */ - -#define DEFLATE_HEADER_BITS 3 -#define DEFLATE_EOBS_BITS 15 -#define DEFLATE_PAD_BITS 6 -#define DEFLATE_BLOCK_OVERHEAD ((DEFLATE_HEADER_BITS + DEFLATE_EOBS_BITS + DEFLATE_PAD_BITS) >> 3) -/* deflate block overhead: 3 bits for block start + 15 bits for block end + padding to nearest byte */ - -#define DEFLATE_QUICK_LIT_MAX_BITS 9 -#define DEFLATE_QUICK_OVERHEAD(x) ((x * (DEFLATE_QUICK_LIT_MAX_BITS - 8) + 7) >> 3) -/* deflate_quick worst-case overhead: 9 bits per literal, round up to next byte (+7) */ - - -#define ZLIB_WRAPLEN 6 /* zlib format overhead */ - - /* target dependencies */ - -#ifdef AMIGA -# define OS_CODE 1 -#endif - -#ifdef __370__ -# if __TARGET_LIB__ < 0x20000000 -# define OS_CODE 4 -# elif __TARGET_LIB__ < 0x40000000 -# define OS_CODE 11 -# else -# define OS_CODE 8 -# endif -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 5 -#endif - -#ifdef OS2 -# define OS_CODE 6 -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 7 -#endif - -#ifdef __acorn -# define OS_CODE 13 -#endif - -#if defined(_WIN32) && !defined(__CYGWIN__) -# define OS_CODE 10 -#endif - -#ifdef __APPLE__ -# define OS_CODE 19 -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) -# define fdopen(fd, type) _fdopen(fd, type) -#endif - -/* MS Visual Studio does not allow inline in C, only C++. - But it provides __inline instead, so use that. */ -#if defined(_MSC_VER) && !defined(inline) && !defined(__cplusplus) -# define inline __inline -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 3 /* assume Unix */ -#endif - - /* functions */ - -/* Diagnostic functions */ -#ifdef ZLIB_DEBUG -# include - extern int Z_INTERNAL z_verbose; - extern void Z_INTERNAL z_error(char *m); -# define Assert(cond, msg) {if (!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose >= 0) fprintf x;} -# define Tracev(x) {if (z_verbose > 0) fprintf x;} -# define Tracevv(x) {if (z_verbose > 1) fprintf x;} -# define Tracec(c, x) {if (z_verbose > 0 && (c)) fprintf x;} -# define Tracecv(c, x) {if (z_verbose > 1 && (c)) fprintf x;} -#else -# define Assert(cond, msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c, x) -# define Tracecv(c, x) -#endif - -void Z_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size); -void Z_INTERNAL zng_cfree(void *opaque, void *ptr); - -#define ZALLOC(strm, items, size) (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (void *)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -/* Reverse the bytes in a value. Use compiler intrinsics when - possible to take advantage of hardware implementations. */ -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -# pragma intrinsic(_byteswap_ulong) -# define ZSWAP16(q) _byteswap_ushort(q) -# define ZSWAP32(q) _byteswap_ulong(q) -# define ZSWAP64(q) _byteswap_uint64(q) - -#elif defined(__Clang__) || (defined(__GNUC__) && \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) -# define ZSWAP16(q) __builtin_bswap16(q) -# define ZSWAP32(q) __builtin_bswap32(q) -# define ZSWAP64(q) __builtin_bswap64(q) - -#elif defined(__GNUC__) && (__GNUC__ >= 2) && defined(__linux__) -# include -# define ZSWAP16(q) bswap_16(q) -# define ZSWAP32(q) bswap_32(q) -# define ZSWAP64(q) bswap_64(q) - -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) -# include -# define ZSWAP16(q) bswap16(q) -# define ZSWAP32(q) bswap32(q) -# define ZSWAP64(q) bswap64(q) -#elif defined(__OpenBSD__) -# include -# define ZSWAP16(q) swap16(q) -# define ZSWAP32(q) swap32(q) -# define ZSWAP64(q) swap64(q) -#elif defined(__INTEL_COMPILER) -/* ICC does not provide a two byte swap. */ -# define ZSWAP16(q) ((((q) & 0xff) << 8) | (((q) & 0xff00) >> 8)) -# define ZSWAP32(q) _bswap(q) -# define ZSWAP64(q) _bswap64(q) - -#else -# define ZSWAP16(q) ((((q) & 0xff) << 8) | (((q) & 0xff00) >> 8)) -# define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) -# define ZSWAP64(q) \ - (((q & 0xFF00000000000000u) >> 56u) | \ - ((q & 0x00FF000000000000u) >> 40u) | \ - ((q & 0x0000FF0000000000u) >> 24u) | \ - ((q & 0x000000FF00000000u) >> 8u) | \ - ((q & 0x00000000FF000000u) << 8u) | \ - ((q & 0x0000000000FF0000u) << 24u) | \ - ((q & 0x000000000000FF00u) << 40u) | \ - ((q & 0x00000000000000FFu) << 56u)) -#endif - -/* Only enable likely/unlikely if the compiler is known to support it */ -#if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__INTEL_COMPILER) || defined(__Clang__) -# define LIKELY_NULL(x) __builtin_expect((x) != 0, 0) -# define LIKELY(x) __builtin_expect(!!(x), 1) -# define UNLIKELY(x) __builtin_expect(!!(x), 0) -# define PREFETCH_L1(addr) __builtin_prefetch(addr, 0, 3) -# define PREFETCH_L2(addr) __builtin_prefetch(addr, 0, 2) -# define PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 2) -#elif defined(__WIN__) -# include -# define LIKELY_NULL(x) x -# define LIKELY(x) x -# define UNLIKELY(x) x -# define PREFETCH_L1(addr) _mm_prefetch((char *) addr, _MM_HINT_T0) -# define PREFETCH_L2(addr) _mm_prefetch((char *) addr, _MM_HINT_T1) -# define PREFETCH_RW(addr) _mm_prefetch((char *) addr, _MM_HINT_T1) -#else -# define LIKELY_NULL(x) x -# define LIKELY(x) x -# define UNLIKELY(x) x -# define PREFETCH_L1(addr) addr -# define PREFETCH_L2(addr) addr -# define PREFETCH_RW(addr) addr -#endif /* (un)likely */ - -#if defined(_MSC_VER) -# define ALIGNED_(x) __declspec(align(x)) -#else -# if defined(__GNUC__) -# define ALIGNED_(x) __attribute__ ((aligned(x))) -# endif -#endif - -#if defined(X86_FEATURES) -# include "arch/x86/x86.h" -#elif defined(ARM_FEATURES) -# include "arch/arm/arm.h" -#elif defined(POWER_FEATURES) -# include "arch/power/power.h" -#endif - -#endif /* ZUTIL_H_ */ diff --git a/internal-complibs/zlib-ng-2.0.7/zutil_p.h b/internal-complibs/zlib-ng-2.0.7/zutil_p.h deleted file mode 100644 index 856b44f90..000000000 --- a/internal-complibs/zlib-ng-2.0.7/zutil_p.h +++ /dev/null @@ -1,46 +0,0 @@ -/* zutil_p.h -- Private inline functions used internally in zlib-ng - * - */ - -#ifndef ZUTIL_P_H -#define ZUTIL_P_H - -#if defined(HAVE_POSIX_MEMALIGN) && !defined(_POSIX_C_SOURCE) -# define _POSIX_C_SOURCE 200112L /* For posix_memalign(). */ -#endif - -#if defined(__APPLE__) || defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_ALIGNED_ALLOC) -# include -#elif defined(__FreeBSD__) -# include -# include -#else -# include -#endif - -/* Function to allocate 16 or 64-byte aligned memory */ -static inline void *zng_alloc(size_t size) { -#ifdef HAVE_POSIX_MEMALIGN - void *ptr; - return posix_memalign(&ptr, 64, size) ? NULL : ptr; -#elif defined(_WIN32) - return (void *)_aligned_malloc(size, 64); -#elif defined(__APPLE__) - return (void *)malloc(size); /* MacOS always aligns to 16 bytes */ -#elif defined(HAVE_ALIGNED_ALLOC) - return (void *)aligned_alloc(64, size); -#else - return (void *)memalign(64, size); -#endif -} - -/* Function that can free aligned memory */ -static inline void zng_free(void *ptr) { -#if defined(_WIN32) - _aligned_free(ptr); -#else - free(ptr); -#endif -} - -#endif diff --git a/internal-complibs/zlib-ng-2.2.2/.codecov.yaml b/internal-complibs/zlib-ng-2.2.2/.codecov.yaml new file mode 100644 index 000000000..fc17c66a9 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/.codecov.yaml @@ -0,0 +1,27 @@ +codecov: + max_report_age: off + notify: + wait_for_ci: false + require_ci_to_pass: false +comment: + require_base: false + require_head: false +coverage: + status: + project: + default: + threshold: 0.07 +fixes: +- '/home/actions-runner/_work/zlib-ng/zlib-ng::' +- '/home/actions-runner/_work/zlib-ng/zlib-ng/build/::' +ignore: +- usr/include/.* +- /usr/include/.* +- /build/usr/include/.* +- usr/lib/.* +- /usr/lib/.* +- /build/usr/lib/.* +- usr/lib64/.* +- /usr/lib64/.* +- /build/usr/lib64/.* +- _deps/**/* diff --git a/internal-complibs/zlib-ng-2.0.7/.shellcheckrc b/internal-complibs/zlib-ng-2.2.2/.shellcheckrc similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/.shellcheckrc rename to internal-complibs/zlib-ng-2.2.2/.shellcheckrc diff --git a/internal-complibs/zlib-ng-2.2.2/CMakeLists.txt b/internal-complibs/zlib-ng-2.2.2/CMakeLists.txt new file mode 100644 index 000000000..fba3575d4 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/CMakeLists.txt @@ -0,0 +1,1424 @@ +cmake_minimum_required(VERSION 3.5.1) +if(CMAKE_VERSION VERSION_LESS 3.12) + cmake_policy(VERSION ${CMAKE_VERSION}) +else() + cmake_policy(VERSION 3.5.1...3.29.0) +endif() +message(STATUS "Using CMake version ${CMAKE_VERSION}") + +# If not specified on the command line, enable C11 as the default +# Configuration items that affect the global compiler environment standards +# should be issued before the "project" command. +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 11) # The C standard whose features are requested to build this target +endif() +if(NOT CMAKE_C_STANDARD_REQUIRED) + set(CMAKE_C_STANDARD_REQUIRED ON) # Boolean describing whether the value of C_STANDARD is a requirement +endif() +if(NOT CMAKE_C_EXTENSIONS) + set(CMAKE_C_EXTENSIONS OFF) # Boolean specifying whether compiler specific extensions are requested +endif() +set(VALID_C_STANDARDS "99" "11") +if(NOT CMAKE_C_STANDARD IN_LIST VALID_C_STANDARDS) + MESSAGE(FATAL_ERROR "CMAKE_C_STANDARD:STRING=${CMAKE_C_STANDARD} not in known standards list\n ${VALID_C_STANDARDS}") +endif() + +# Parse the full version number from zlib.h.in and include in ZLIB_FULL_VERSION +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h.in _zlib_h_contents) +string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9]+.[0-9]+.[0-9]+).*\".*" + "\\1" ZLIB_HEADER_VERSION ${_zlib_h_contents}) +string(REGEX REPLACE ".*#define[ \t]+ZLIBNG_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" + "\\1" ZLIBNG_HEADER_VERSION ${_zlib_h_contents}) +message(STATUS "ZLIB_HEADER_VERSION: ${ZLIB_HEADER_VERSION}") +message(STATUS "ZLIBNG_HEADER_VERSION: ${ZLIBNG_HEADER_VERSION}") + +project(zlib VERSION ${ZLIB_HEADER_VERSION} LANGUAGES C) + +include(CheckTypeSize) +include(CheckSymbolExists) +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckCSourceCompiles) +include(CheckCSourceRuns) +include(CheckCCompilerFlag) +include(CMakeDependentOption) +include(CMakePackageConfigHelpers) +include(FeatureSummary) + +include(cmake/detect-arch.cmake) +include(cmake/detect-install-dirs.cmake) +include(cmake/detect-coverage.cmake) +include(cmake/detect-intrinsics.cmake) +include(cmake/detect-sanitizer.cmake) +include(cmake/fallback-macros.cmake) + +if(CMAKE_TOOLCHAIN_FILE) + message(STATUS "Using CMake toolchain: ${CMAKE_TOOLCHAIN_FILE}") +endif() + +# Make sure we use an appropriate BUILD_TYPE by default, "Release" to be exact +# this should select the maximum generic optimisation on the current platform (i.e. -O3 for gcc/clang) +get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT GENERATOR_IS_MULTI_CONFIG) + if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING + "Choose the type of build, standard options are: Debug Release RelWithDebInfo MinSizeRel." + FORCE) + add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (default)") + else() + add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (selected)") + endif() +endif() + +# +# Options parsing +# +option(WITH_GZFILEOP "Compile with support for gzFile related functions" ON) +option(ZLIB_COMPAT "Compile with zlib compatible API" OFF) +option(ZLIB_ENABLE_TESTS "Build test binaries" ON) +option(ZLIBNG_ENABLE_TESTS "Test zlib-ng specific API" ON) +option(WITH_GTEST "Build gtest_zlib" ON) +option(WITH_FUZZERS "Build test/fuzz" OFF) +option(WITH_BENCHMARKS "Build test/benchmarks" OFF) +option(WITH_BENCHMARK_APPS "Build application benchmarks" OFF) +option(WITH_OPTIM "Build with optimisation" ON) +option(WITH_REDUCED_MEM "Reduced memory usage for special cases (reduces performance)" OFF) +option(WITH_NEW_STRATEGIES "Use new strategies" ON) +option(WITH_NATIVE_INSTRUCTIONS + "Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)" OFF) +option(WITH_RUNTIME_CPU_DETECTION "Build with runtime detection of CPU architecture" ON) +option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF) +option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF) +option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF) +option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF) +option(WITH_UNALIGNED "Support unaligned reads on platforms that support it" ON) + +set(ZLIB_SYMBOL_PREFIX "" CACHE STRING "Give this prefix to all publicly exported symbols. +Useful when embedding into a larger library. +Default is no prefix (empty prefix).") + +# Add multi-choice option +set(WITH_SANITIZER AUTO CACHE STRING "Enable sanitizer support") +set_property(CACHE WITH_SANITIZER PROPERTY STRINGS "Memory" "Address" "Undefined" "Thread") + +if(BASEARCH_ARM_FOUND) + option(WITH_ACLE "Build with ACLE" ON) + option(WITH_NEON "Build with NEON intrinsics" ON) + cmake_dependent_option(WITH_ARMV6 "Build with ARMv6 SIMD" ON "NOT ARCH STREQUAL \"aarch64\"" OFF) +elseif(BASEARCH_PPC_FOUND) + option(WITH_ALTIVEC "Build with AltiVec (VMX) optimisations for PowerPC" ON) + option(WITH_POWER8 "Build with optimisations for POWER8" ON) + option(WITH_POWER9 "Build with optimisations for POWER9" ON) +elseif(BASEARCH_RISCV_FOUND) + option(WITH_RVV "Build with RVV intrinsics" ON) +elseif(BASEARCH_S360_FOUND) + option(WITH_DFLTCC_DEFLATE "Build with DFLTCC intrinsics for compression on IBM Z" OFF) + option(WITH_DFLTCC_INFLATE "Build with DFLTCC intrinsics for decompression on IBM Z" OFF) + option(WITH_CRC32_VX "Build with vectorized CRC32 on IBM Z" ON) +elseif(BASEARCH_X86_FOUND) + option(WITH_SSE2 "Build with SSE2" ON) + cmake_dependent_option(WITH_SSSE3 "Build with SSSE3" ON "WITH_SSE2" OFF) + cmake_dependent_option(WITH_SSE42 "Build with SSE42" ON "WITH_SSSE3" OFF) + cmake_dependent_option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON "WITH_SSE42" OFF) + cmake_dependent_option(WITH_AVX2 "Build with AVX2" ON "WITH_SSE42" OFF) + cmake_dependent_option(WITH_AVX512 "Build with AVX512" ON "WITH_AVX2" OFF) + cmake_dependent_option(WITH_AVX512VNNI "Build with AVX512 VNNI extensions" ON "WITH_AVX512" OFF) + cmake_dependent_option(WITH_VPCLMULQDQ "Build with VPCLMULQDQ" ON "WITH_PCLMULQDQ;WITH_AVX512" OFF) +endif() + +option(INSTALL_UTILS "Copy minigzip and minideflate during install" OFF) + +mark_as_advanced(FORCE + ZLIB_SYMBOL_PREFIX + WITH_REDUCED_MEM + WITH_ACLE WITH_NEON + WITH_ARMV6 + WITH_DFLTCC_DEFLATE + WITH_DFLTCC_INFLATE + WITH_CRC32_VX + WITH_AVX2 WITH_SSE2 + WITH_SSSE3 WITH_SSE42 + WITH_PCLMULQDQ + WITH_ALTIVEC + WITH_POWER8 + WITH_POWER9 + WITH_RVV + WITH_INFLATE_STRICT + WITH_INFLATE_ALLOW_INVALID_DIST + WITH_UNALIGNED + INSTALL_UTILS + ) + +if(ZLIB_COMPAT) + add_definitions(-DZLIB_COMPAT) + set(WITH_GZFILEOP ON) + set(SUFFIX "") + set(ZLIB_FULL_VERSION ${ZLIB_HEADER_VERSION}.zlib-ng) + set(EXPORT_NAME ZLIB) +else() + set(SUFFIX "-ng") + set(ZLIB_FULL_VERSION ${ZLIBNG_HEADER_VERSION}) + set(EXPORT_NAME zlib-ng) +endif() + +if(WITH_GZFILEOP) + add_definitions(-DWITH_GZFILEOP) +endif() + +if(CMAKE_C_COMPILER_ID MATCHES "^Intel") + if(CMAKE_HOST_UNIX) + set(WARNFLAGS -Wall) + set(WARNFLAGS_MAINTAINER -Wall -Wcheck -Wremarks) + set(WARNFLAGS_DISABLE) + else() + set(WARNFLAGS /Wall) + set(WARNFLAGS_MAINTAINER /W5) + set(WARNFLAGS_DISABLE) + endif() + check_c_compiler_flag(-diag-disable=10441 HAVE_DIAG_10441) + if(HAVE_DIAG_10441) + list(APPEND WARNFLAGS_DISABLE "-diag-disable=10441") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -diag-disable=10441") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -diag-disable=10441") + endif() +elseif(MSVC) + # Minimum supported MSVC version is 1800 = Visual Studio 12.0/2013 + # See also https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html + if(MSVC_VERSION VERSION_LESS 1800) + message(SEND_ERROR "Unsupported Visual Studio compiler version (requires 2013 or later).") + endif() + # TODO. ICC can be used through MSVC. I'm not sure if we'd ever see that combination + # (who'd use cmake from an IDE...) but checking for ICC before checking for MSVC should + # avoid mistakes. + # /Oi ? + set(WARNFLAGS /W3 /w34242 /WX) + set(WARNFLAGS_MAINTAINER /W4) + set(WARNFLAGS_DISABLE /wd4206 /wd4054) + if(BASEARCH_ARM_FOUND) + add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE) + if(NOT "${ARCH}" MATCHES "aarch64") + set(NEONFLAG "/arch:VFPv4") + endif() + endif() +elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + # Enable warnings in GCC and Clang + set(WARNFLAGS -Wall) + set(WARNFLAGS_MAINTAINER -Wextra) + set(WARNFLAGS_DISABLE) + # Check whether -fno-lto is available + set(CMAKE_REQUIRED_FLAGS "-fno-lto") + check_c_source_compiles( + "int main() { return 0; }" + FNO_LTO_AVAILABLE FAIL_REGEX "not supported") + set(CMAKE_REQUIRED_FLAGS) + if(FNO_LTO_AVAILABLE) + set(ZNOLTOFLAG "-fno-lto") + endif() + if(NOT WITH_NATIVE_INSTRUCTIONS) + if(BASEARCH_ARM_FOUND) + if("${ARCH}" MATCHES "arm" AND NOT CMAKE_C_FLAGS MATCHES "-mfloat-abi") + # Auto-detect support for ARM floating point ABI + check_include_file(features.h HAVE_FEATURES_H) + if(HAVE_FEATURES_H) + set(CMAKE_REQUIRED_FLAGS -mfloat-abi=softfp) + check_c_source_compiles( + "#include + int main() { return 0; }" + HAVE_FLOATABI_SOFTFP) + if(HAVE_FLOATABI_SOFTFP) + set(FLOATABI -mfloat-abi=softfp) + else() + set(CMAKE_REQUIRED_FLAGS -mfloat-abi=hard) + check_c_source_compiles( + "#include + int main() { return 0; }" + HAVE_FLOATABI_HARD) + if(HAVE_FLOATABI_HARD) + set(FLOATABI -mfloat-abi=hard) + endif() + endif() + set(CMAKE_REQUIRED_FLAGS) + endif() + if(FLOATABI) + message(STATUS "ARM floating point arch: ${FLOATABI}") + add_compile_options(${FLOATABI}) + else() + message(STATUS "ARM floating point arch not auto-detected") + endif() + endif() + endif() + # Disable LTO unless Native Instructions are enabled + if(FNO_LTO_AVAILABLE) + set(NOLTOFLAG ${ZNOLTOFLAG}) + endif() + endif() + if(MINGW) + # Add `-Wno-pedantic-ms-format` only if the toolchain supports it + check_c_compiler_flag(-Wno-pedantic-ms-format HAVE_NO_PEDANTIC_MS_FORMAT) + if(HAVE_NO_PEDANTIC_MS_FORMAT) + list(APPEND WARNFLAGS_DISABLE -Wno-pedantic-ms-format) + endif() + endif() +endif() + +# Set native march/mcpu +if(WITH_NATIVE_INSTRUCTIONS) + if(NATIVE_ARCH_OVERRIDE) + message(STATUS "WARNING: WITH_NATIVE_INSTRUCTIONS enabled, but running with NATIVE_ARCH_OVERRIDE: ${NATIVE_ARCH_OVERRIDE}") + set(NATIVEFLAG "${NATIVE_ARCH_OVERRIDE}") + else() + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + check_c_compiler_flag(-march=native HAVE_MARCH_NATIVE) + if(HAVE_MARCH_NATIVE) + set(NATIVEFLAG "-march=native") + else() + check_c_compiler_flag(-mcpu=native HAVE_MCPU_NATIVE) + if(HAVE_MCPU_NATIVE) + set(NATIVEFLAG "-mcpu=native") + endif() + endif() + # Fall through + endif() + endif() + if(NATIVEFLAG) + # Apply flags to all source files and compilation checks + if(WIN32) + separate_arguments(NATIVEOPTIONS WINDOWS_COMMAND "${NATIVEFLAG}") + else() + separate_arguments(NATIVEOPTIONS UNIX_COMMAND "${NATIVEFLAG}") + endif() + add_compile_options(${NATIVEOPTIONS}) + set(WITH_RUNTIME_CPU_DETECTION OFF) + else() + message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not implemented yet on this configuration") + set(WITH_NATIVE_INSTRUCTIONS OFF) + endif() +endif() + +# Compile without functable or CPU detection +if(NOT WITH_RUNTIME_CPU_DETECTION) + if(MSVC AND BASEARCH_X86_FOUND) + message(STATUS "WARNING: Microsoft Visual Studio does not support compile time detection of CPU features for \"/arch\" before \"AVX\"") + # Workaround for MSVC. By default MSVC does not define the __SSE*__ macros. + # Fix it if AVX is enabled. + set(CMAKE_REQUIRED_FLAGS "${NATIVEFLAG}") + check_c_source_compiles( + "#ifndef __AVX__ + # error \"AVX is not enabled.\" + #endif + int main(void) { return 0; }" + MSVC_IS_ENABLED_AVX + ) + set(CMAKE_REQUIRED_FLAGS) + if(MSVC_IS_ENABLED_AVX) + add_definitions( + -D__SSE__=1 + -D__SSE2__=1 + -D__SSE3__=1 + -D__SSSE3__=1 + -D__SSE4_1__=1 + -D__SSE4_2__=1 + -D__PCLMUL__=1 + ) + endif() + endif() + add_definitions(-DDISABLE_RUNTIME_CPU_DETECTION) +endif() + +# Force disable LTO if WITH_NATIVE_INSTRUCTIONS is not active +if(NOT WITH_NATIVE_INSTRUCTIONS) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) + foreach(_cfg_name IN LISTS CMAKE_CONFIGURATION_TYPES) + string(TOUPPER "${_cfg_name}" _cfg_name_uc) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_${_cfg_name_uc} OFF) + endforeach() +endif() + +# Set architecture alignment requirements +if(NOT WITH_UNALIGNED) + add_definitions(-DNO_UNALIGNED) + message(STATUS "Unaligned reads manually disabled") +endif() + +# Apply warning compiler flags +if(WITH_MAINTAINER_WARNINGS) + add_compile_options(${WARNFLAGS} ${WARNFLAGS_MAINTAINER} ${WARNFLAGS_DISABLE}) +else() + add_compile_options(${WARNFLAGS} ${WARNFLAGS_DISABLE}) +endif() + +# Set code coverage compiler flags +if(WITH_CODE_COVERAGE) + add_code_coverage() +endif() + +# Replace optimization level 3 added by default with level 2 +if(NOT WITH_CODE_COVERAGE AND NOT MSVC AND NOT CMAKE_C_FLAGS MATCHES "([\\/\\-]O)3") + string(REGEX REPLACE "([\\/\\-]O)3" "\\12" + CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") +endif() + +# +# Check for standard/system includes +# +check_include_file(arm_acle.h HAVE_ARM_ACLE_H) +if(HAVE_ARM_ACLE_H) + add_definitions(-DHAVE_ARM_ACLE_H) +endif() +check_include_file(sys/auxv.h HAVE_SYS_AUXV_H) +if(HAVE_SYS_AUXV_H) + add_definitions(-DHAVE_SYS_AUXV_H) +endif() +check_include_file(sys/sdt.h HAVE_SYS_SDT_H) +if(HAVE_SYS_SDT_H) + add_definitions(-DHAVE_SYS_SDT_H) +endif() +check_include_file(unistd.h HAVE_UNISTD_H) + +# +# Check for Linux includes +# +check_include_file(linux/auxvec.h HAVE_LINUX_AUXVEC_H) +if(HAVE_LINUX_AUXVEC_H) + add_definitions(-DHAVE_LINUX_AUXVEC_H) +endif() + +# +# Check to see if we have large file support +# +set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64) +check_type_size(off64_t OFF64_T) +if(HAVE_OFF64_T) + add_definitions(-D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64) +else() + check_type_size(_off64_t _OFF64_T) + if(HAVE__OFF64_T) + add_definitions(-D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64) + else() + check_type_size(__off64_t __OFF64_T) + endif() +endif() +set(CMAKE_REQUIRED_DEFINITIONS) # clear variable + +# +# Check for fseeko and other optional functions +# +check_function_exists(fseeko HAVE_FSEEKO) +if(NOT HAVE_FSEEKO) + add_definitions(-DNO_FSEEKO) +endif() + +check_function_exists(strerror HAVE_STRERROR) +if(NOT HAVE_STRERROR) + add_definitions(-DNO_STRERROR) +endif() + +set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112L) +check_symbol_exists(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN) +if(HAVE_POSIX_MEMALIGN) + add_definitions(-DHAVE_POSIX_MEMALIGN) +endif() +set(CMAKE_REQUIRED_DEFINITIONS) + +set(CMAKE_REQUIRED_DEFINITIONS -D_ISOC11_SOURCE=1) +check_symbol_exists(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC) +if(HAVE_ALIGNED_ALLOC) + add_definitions(-DHAVE_ALIGNED_ALLOC) +endif() +set(CMAKE_REQUIRED_DEFINITIONS) + +if(WITH_SANITIZER STREQUAL "Address") + add_address_sanitizer() +elseif(WITH_SANITIZER STREQUAL "Memory") + add_memory_sanitizer() +elseif(WITH_SANITIZER STREQUAL "Thread") + add_thread_sanitizer() +elseif(WITH_SANITIZER STREQUAL "Undefined") + add_undefined_sanitizer() +endif() + +# +# Check whether compiler supports -fno-semantic-interposition parameter +# +check_c_compiler_flag(-fno-semantic-interposition HAVE_NO_INTERPOSITION) + +# +# Check if we can hide zlib internal symbols that are linked between separate source files using hidden +# +check_c_source_compiles( + "#define Z_INTERNAL __attribute__((visibility (\"hidden\"))) + int Z_INTERNAL foo; + int main() { + return 0; + }" + HAVE_ATTRIBUTE_VISIBILITY_HIDDEN FAIL_REGEX "visibility") +if(HAVE_ATTRIBUTE_VISIBILITY_HIDDEN) + add_definitions(-DHAVE_VISIBILITY_HIDDEN) +endif() + +# +# Check if we can hide zlib internal symbols that are linked between separate source files using internal +# +check_c_source_compiles( + "#define Z_INTERNAL __attribute__((visibility (\"internal\"))) + int Z_INTERNAL foo; + int main() { + return 0; + }" + HAVE_ATTRIBUTE_VISIBILITY_INTERNAL FAIL_REGEX "visibility") +if(HAVE_ATTRIBUTE_VISIBILITY_INTERNAL) + add_definitions(-DHAVE_VISIBILITY_INTERNAL) +endif() + +# +# Check for __attribute__((aligned(x))) support in the compiler +# +check_c_source_compiles( + "int main(void) { + __attribute__((aligned(8))) int test = 0; + (void)test; + return 0; + }" + HAVE_ATTRIBUTE_ALIGNED FAIL_REGEX "aligned") +if(HAVE_ATTRIBUTE_ALIGNED) + add_definitions(-DHAVE_ATTRIBUTE_ALIGNED) +endif() + +# +# Check for __builtin_assume_aligned(x,n) support in the compiler +# +check_c_source_compiles( + "char *test(char *buffer) { + char *abuffer = __builtin_assume_aligned(buffer,64); + return abuffer; + } + int main() { + return 0; + }" + HAVE_BUILTIN_ASSUME_ALIGNED) +if(HAVE_BUILTIN_ASSUME_ALIGNED) + add_definitions(-DHAVE_BUILTIN_ASSUME_ALIGNED) +endif() + +# +# check for __builtin_ctz() support in the compiler +# +check_c_source_compiles( + "int main(void) { + unsigned int zero = 0; + long test = __builtin_ctz(zero); + (void)test; + return 0; + }" + HAVE_BUILTIN_CTZ +) +if(HAVE_BUILTIN_CTZ) + add_definitions(-DHAVE_BUILTIN_CTZ) +endif() + +# +# check for __builtin_ctzll() support in the compiler +# +check_c_source_compiles( + "int main(void) { + unsigned int zero = 0; + long test = __builtin_ctzll(zero); + (void)test; + return 0; + }" + HAVE_BUILTIN_CTZLL +) +if(HAVE_BUILTIN_CTZLL) + add_definitions(-DHAVE_BUILTIN_CTZLL) +endif() + +# +# check for ptrdiff_t support +# +check_c_source_compiles( + "#include + int main() { + ptrdiff_t *a; + (void)a; + return 0; + }" + HAVE_PTRDIFF_T +) +if(NOT HAVE_PTRDIFF_T) + set(NEED_PTRDIFF_T 1) + + check_type_size("void *" SIZEOF_DATA_PTR) + message(STATUS "sizeof(void *) is ${SIZEOF_DATA_PTR} bytes") + + if(${SIZEOF_DATA_PTR} MATCHES "4") + set(PTRDIFF_TYPE "uint32_t") + elseif(${SIZEOF_DATA_PTR} MATCHES "8") + set(PTRDIFF_TYPE "uint64_t") + else() + message(FATAL_ERROR "sizeof(void *) is neither 32 nor 64 bit") + endif() +endif() + +add_compile_options($<$:-DZLIB_DEBUG>) + +if(MSVC) + set(CMAKE_DEBUG_POSTFIX "d") + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) +endif() + +if(BASEARCH_X86_FOUND) + # FORCE_SSE2 option will only be shown if HAVE_SSE2_INTRIN is true + if("${ARCH}" MATCHES "i[3-6]86") + cmake_dependent_option(FORCE_SSE2 "Always assume CPU is SSE2 capable" OFF "HAVE_SSE2_INTRIN" OFF) + endif() +endif() + +# +# Enable deflate_quick at level 1 +# +if(NOT WITH_NEW_STRATEGIES) + add_definitions(-DNO_QUICK_STRATEGY) +endif() +# +# Enable deflate_medium at level 4-6 +# +if(NOT WITH_NEW_STRATEGIES) + add_definitions(-DNO_MEDIUM_STRATEGY) +endif() +# +# Enable inflate compilation options +# +if(WITH_INFLATE_STRICT) + add_definitions(-DINFLATE_STRICT) + message(STATUS "Inflate strict distance checking enabled") +endif() +if(WITH_INFLATE_ALLOW_INVALID_DIST) + add_definitions(-DINFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR) + message(STATUS "Inflate zero data for invalid distances enabled") +endif() +# +# Enable reduced memory configuration +# +if(WITH_REDUCED_MEM) + add_definitions(-DHASH_SIZE=32768u -DGZBUFSIZE=8192 -DNO_LIT_MEM) + message(STATUS "Configured for reduced memory environment") +endif() + +set(GENERIC_ARCHDIR "arch/generic") + +set(ZLIB_ARCH_SRCS) +set(ZLIB_ARCH_HDRS ${GENERIC_ARCHDIR}/generic_functions.h) + +if(BASEARCH_ARM_FOUND) + set(ARCHDIR "arch/arm") +elseif(BASEARCH_PPC_FOUND) + set(ARCHDIR "arch/power") +elseif(BASEARCH_RISCV_FOUND) + set(ARCHDIR "arch/riscv") +elseif(BASEARCH_S360_FOUND) + set(ARCHDIR "arch/s390") +elseif(BASEARCH_X86_FOUND) + set(ARCHDIR "arch/x86") + if(NOT ${ARCH} MATCHES "x86_64") + add_feature_info(SSE2 1 "Support the SSE2 instruction set, using \"${SSE2FLAG}\"") + endif() +else() + set(ARCHDIR ${GENERIC_ARCHDIR}) + message(STATUS "No optimized architecture: using ${ARCHDIR}") +endif() + +if(WITH_OPTIM) + if(BASEARCH_ARM_FOUND) + add_definitions(-DARM_FEATURES) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + if("${ARCH}" MATCHES "aarch64") + check_c_source_compiles( + "#include + int main() { + return (getauxval(AT_HWCAP) & HWCAP_CRC32); + }" + ARM_AUXV_HAS_CRC32 + ) + if(ARM_AUXV_HAS_CRC32) + add_definitions(-DARM_AUXV_HAS_CRC32) + else() + message(STATUS "HWCAP_CRC32 not present in sys/auxv.h; cannot detect support at runtime.") + endif() + else() + check_c_source_compiles( + "#include + int main() { + return (getauxval(AT_HWCAP2) & HWCAP2_CRC32); + }" + ARM_AUXV_HAS_CRC32 + ) + if(ARM_AUXV_HAS_CRC32) + add_definitions(-DARM_AUXV_HAS_CRC32) + else() + check_c_source_compiles( + "#include + #include + int main() { + return (getauxval(AT_HWCAP2) & HWCAP2_CRC32); + }" + ARM_HWCAP_HAS_CRC32 + ) + if (ARM_HWCAP_HAS_CRC32) + add_definitions(-DARM_AUXV_HAS_CRC32 -DARM_ASM_HWCAP) + else() + message(STATUS "HWCAP2_CRC32 not present in sys/auxv.h; cannot detect support at runtime.") + endif() + endif() + check_c_source_compiles( + "#include + int main() { + return (getauxval(AT_HWCAP) & HWCAP_ARM_NEON); + }" + ARM_AUXV_HAS_NEON + ) + if(ARM_AUXV_HAS_NEON) + add_definitions(-DARM_AUXV_HAS_NEON) + else() + check_c_source_compiles( + "#include + int main() { + return (getauxval(AT_HWCAP) & HWCAP_NEON); + }" + ARM_AUXV_HAS_NEON + ) + if (ARM_AUXV_HAS_NEON) + add_definitions(-DARM_AUXV_HAS_NEON) + else() + message(STATUS "Neither HWCAP_ARM_NEON or HWCAP_NEON present in sys/auxv.h; cannot detect support at runtime.") + endif() + endif() + endif() + endif() + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/arm_functions.h) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/arm_features.h) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/arm_features.c) + endif() + + if(WITH_ACLE) + check_acle_compiler_flag() + if(HAVE_ACLE_FLAG) + add_definitions(-DARM_ACLE) + set(ACLE_SRCS ${ARCHDIR}/crc32_acle.c) + set_property(SOURCE ${ACLE_SRCS} PROPERTY COMPILE_FLAGS "${ACLEFLAG} ${NOLTOFLAG}") + list(APPEND ZLIB_ARCH_SRCS ${ACLE_SRCS}) + add_feature_info(ACLE_CRC 1 "Support ACLE optimized CRC hash generation, using \"${ACLEFLAG}\"") + else() + set(WITH_ACLE OFF) + endif() + else() + set(WITH_ACLE OFF) + endif() + if(WITH_NEON) + check_neon_compiler_flag() + if(NEON_AVAILABLE) + add_definitions(-DARM_NEON) + set(NEON_SRCS ${ARCHDIR}/adler32_neon.c ${ARCHDIR}/chunkset_neon.c + ${ARCHDIR}/compare256_neon.c ${ARCHDIR}/slide_hash_neon.c) + list(APPEND ZLIB_ARCH_SRCS ${NEON_SRCS}) + set_property(SOURCE ${NEON_SRCS} PROPERTY COMPILE_FLAGS "${NEONFLAG} ${NOLTOFLAG}") + if(MSVC) + add_definitions(-D__ARM_NEON__) + endif() + add_feature_info(NEON_ADLER32 1 "Support NEON instructions in adler32, using \"${NEONFLAG}\"") + add_feature_info(NEON_SLIDEHASH 1 "Support NEON instructions in slide_hash, using \"${NEONFLAG}\"") + check_neon_ld4_intrinsics() + if(NEON_HAS_LD4) + add_definitions(-DARM_NEON_HASLD4) + endif() + else() + set(WITH_NEON OFF) + endif() + endif() + if(WITH_ARMV6) + check_armv6_compiler_flag() + if(HAVE_ARMV6_INLINE_ASM OR HAVE_ARMV6_INTRIN) + add_definitions(-DARM_SIMD) + set(ARMV6_SRCS ${ARCHDIR}/slide_hash_armv6.c) + set_property(SOURCE ${ARMV6_SRCS} PROPERTY COMPILE_FLAGS "${ARMV6FLAG} ${NOLTOFLAG}") + list(APPEND ZLIB_ARCH_SRCS ${ARMV6_SRCS}) + add_feature_info(ARMV6 1 "Support ARMv6 SIMD instructions in slide_hash, using \"${ARMV6FLAG}\"") + if(HAVE_ARMV6_INTRIN) + add_definitions(-DARM_SIMD_INTRIN) + endif() + else() + set(WITH_ARMV6 OFF) + endif() + else() + set(WITH_ARMV6 OFF) + endif() + elseif(BASEARCH_PPC_FOUND) + # Common arch detection code + if(WITH_ALTIVEC) + check_ppc_intrinsics() + endif() + if(WITH_POWER8) + check_power8_intrinsics() + endif() + if(WITH_POWER9) + check_power9_intrinsics() + endif() + if(POWER8_NEED_AUXVEC_H OR POWER9_NEED_AUXVEC_H) + add_definitions(-DPOWER_NEED_AUXVEC_H) + endif() + if(HAVE_POWER8_INTRIN OR HAVE_POWER9_INTRIN) + add_definitions(-DPOWER_FEATURES) + endif() + if(HAVE_VMX OR HAVE_POWER8_INTRIN OR HAVE_POWER9_INTRIN) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/power_functions.h) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/power_features.h) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/power_features.c) + endif() + endif() + # VMX specific options and files + if(WITH_ALTIVEC) + if(HAVE_VMX) + add_definitions(-DPPC_FEATURES) + if(HAVE_ALTIVEC) + add_definitions(-DPPC_VMX) + set(PPC_SRCS ${ARCHDIR}/adler32_vmx.c ${ARCHDIR}/slide_hash_vmx.c) + list(APPEND ZLIB_ARCH_SRCS ${PPC_SRCS}) + add_feature_info(ALTIVEC 1 "Support the AltiVec instruction set, using \"-maltivec\"") + set_property(SOURCE ${PPC_SRCS} PROPERTY COMPILE_FLAGS "${PPCFLAGS}") + else() + set(WITH_ALTIVEC OFF) + endif() + endif() + endif() + # Power8 specific options and files + if(WITH_POWER8) + if(HAVE_POWER8_INTRIN) + add_definitions(-DPOWER8_VSX) + set(POWER8_SRCS ${ARCHDIR}/adler32_power8.c ${ARCHDIR}/chunkset_power8.c ${ARCHDIR}/slide_hash_power8.c) + if("${ARCH}" MATCHES "powerpc64(le)?") + add_definitions(-DPOWER8_VSX_CRC32) + list(APPEND POWER8_SRCS ${ARCHDIR}/crc32_power8.c) + endif() + list(APPEND ZLIB_ARCH_SRCS ${POWER8_SRCS}) + set_property(SOURCE ${POWER8_SRCS} PROPERTY COMPILE_FLAGS "${POWER8FLAG} ${NOLTOFLAG}") + else() + set(WITH_POWER8 OFF) + endif() + endif() + # Power9 specific options and files + if(WITH_POWER9) + if(HAVE_POWER9_INTRIN) + add_definitions(-DPOWER9) + set(POWER9_SRCS ${ARCHDIR}/compare256_power9.c) + list(APPEND ZLIB_ARCH_SRCS ${POWER9_SRCS}) + set_property(SOURCE ${POWER9_SRCS} PROPERTY COMPILE_FLAGS "${POWER9FLAG} ${NOLTOFLAG}") + else() + set(WITH_POWER9 OFF) + endif() + endif() + elseif(BASEARCH_RISCV_FOUND) + if(WITH_RVV) + check_rvv_intrinsics() + if(HAVE_RVV_INTRIN) + add_definitions(-DRISCV_FEATURES) + add_definitions(-DRISCV_RVV) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/riscv_functions.h) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/riscv_features.h) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/riscv_features.c) + endif() + # FIXME: we will not set compile flags for riscv_features.c when + # the kernels update hwcap or hwprobe for riscv + set(RVV_SRCS ${ARCHDIR}/adler32_rvv.c ${ARCHDIR}/chunkset_rvv.c ${ARCHDIR}/compare256_rvv.c ${ARCHDIR}/slide_hash_rvv.c) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND RVV_SRCS ${ARCHDIR}/riscv_features.c) + endif() + list(APPEND ZLIB_ARCH_SRCS ${RVV_SRCS}) + set_property(SOURCE ${RVV_SRCS} PROPERTY COMPILE_FLAGS "${RISCVFLAG} ${NOLTOFLAG}") + else() + set(WITH_RVV OFF) + endif() + endif() + elseif(BASEARCH_S360_FOUND) + check_s390_intrinsics() + if(HAVE_S390_INTRIN) + add_definitions(-DS390_FEATURES) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/s390_functions.h) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/s390_features.h) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/s390_features.c) + endif() + endif() + if(WITH_DFLTCC_DEFLATE) + add_definitions(-DS390_DFLTCC_DEFLATE) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_deflate.c) + endif() + if(WITH_DFLTCC_INFLATE) + add_definitions(-DS390_DFLTCC_INFLATE) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_inflate.c) + endif() + if(WITH_CRC32_VX) + check_vgfma_intrinsics() + if(HAVE_VGFMA_INTRIN) + add_definitions(-DS390_CRC32_VX) + set(CRC32_VX_SRCS ${ARCHDIR}/crc32-vx.c) + list(APPEND ZLIB_ARCH_SRCS ${CRC32_VX_SRCS}) + set_property(SOURCE ${CRC32_VX_SRCS} PROPERTY COMPILE_FLAGS "${VGFMAFLAG} ${NOLTOFLAG}") + else() + set(WITH_CRC32_VX OFF) + endif() + endif() + elseif(BASEARCH_X86_FOUND) + add_definitions(-DX86_FEATURES) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/x86_functions.h) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/x86_features.h) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/x86_features.c) + endif() + if(MSVC) + list(APPEND ZLIB_ARCH_HDRS fallback_builtins.h) + endif() + check_xsave_intrinsics() + if(HAVE_XSAVE_INTRIN) + add_feature_info(XSAVE 1 "Support XSAVE intrinsics using \"${XSAVEFLAG}\"") + if(WITH_RUNTIME_CPU_DETECTION) + set_property(SOURCE ${ARCHDIR}/x86_features.c PROPERTY COMPILE_FLAGS "${XSAVEFLAG}") + endif() + if(NOT (CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 8.2)) + add_definitions(-DX86_HAVE_XSAVE_INTRIN) + endif() + endif() + if(WITH_SSE2) + check_sse2_intrinsics() + if(HAVE_SSE2_INTRIN) + add_definitions(-DX86_SSE2) + set(SSE2_SRCS ${ARCHDIR}/chunkset_sse2.c ${ARCHDIR}/compare256_sse2.c ${ARCHDIR}/slide_hash_sse2.c) + list(APPEND ZLIB_ARCH_SRCS ${SSE2_SRCS}) + if(NOT ${ARCH} MATCHES "x86_64") + set_property(SOURCE ${SSE2_SRCS} PROPERTY COMPILE_FLAGS "${SSE2FLAG} ${NOLTOFLAG}") + add_feature_info(FORCE_SSE2 FORCE_SSE2 "Assume CPU is SSE2 capable") + if(FORCE_SSE2) + add_definitions(-DX86_NOCHECK_SSE2) + endif() + endif() + else() + set(WITH_SSE2 OFF) + endif() + endif() + if(WITH_SSSE3) + check_ssse3_intrinsics() + if(HAVE_SSSE3_INTRIN AND WITH_SSE2) + add_definitions(-DX86_SSSE3) + set(SSSE3_SRCS ${ARCHDIR}/adler32_ssse3.c ${ARCHDIR}/chunkset_ssse3.c) + add_feature_info(SSSE3_ADLER32 1 "Support SSSE3-accelerated adler32, using \"${SSSE3FLAG}\"") + list(APPEND ZLIB_ARCH_SRCS ${SSSE3_SRCS}) + set_property(SOURCE ${SSSE3_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${NOLTOFLAG}") + else() + set(WITH_SSSE3 OFF) + endif() + endif() + if(WITH_SSE42) + check_sse42_intrinsics() + if(HAVE_SSE42_INTRIN AND WITH_SSSE3) + add_definitions(-DX86_SSE42) + set(SSE42_SRCS ${ARCHDIR}/adler32_sse42.c) + add_feature_info(SSE42_CRC 1 "Support SSE4.2 optimized adler32 hash generation, using \"${SSE42FLAG}\"") + list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS}) + set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE42FLAG} ${NOLTOFLAG}") + else() + set(WITH_SSE42 OFF) + endif() + endif() + if(WITH_PCLMULQDQ) + check_pclmulqdq_intrinsics() + if(HAVE_PCLMULQDQ_INTRIN AND WITH_SSE42) + add_definitions(-DX86_PCLMULQDQ_CRC) + set(PCLMULQDQ_SRCS ${ARCHDIR}/crc32_pclmulqdq.c) + add_feature_info(PCLMUL_CRC 1 "Support CRC hash generation using PCLMULQDQ, using \"${SSE42FLAG} ${PCLMULFLAG}\"") + list(APPEND ZLIB_ARCH_SRCS ${PCLMULQDQ_SRCS}) + set_property(SOURCE ${PCLMULQDQ_SRCS} PROPERTY COMPILE_FLAGS "${SSE42FLAG} ${PCLMULFLAG} ${NOLTOFLAG}") + else() + set(WITH_PCLMULQDQ OFF) + endif() + endif() + if(WITH_AVX2) + check_avx2_intrinsics() + if(HAVE_AVX2_INTRIN AND WITH_SSE42) + add_definitions(-DX86_AVX2) + set(AVX2_SRCS ${ARCHDIR}/slide_hash_avx2.c) + add_feature_info(AVX2_SLIDEHASH 1 "Support AVX2 optimized slide_hash, using \"${AVX2FLAG}\"") + list(APPEND AVX2_SRCS ${ARCHDIR}/chunkset_avx2.c) + add_feature_info(AVX2_CHUNKSET 1 "Support AVX2 optimized chunkset, using \"${AVX2FLAG}\"") + list(APPEND AVX2_SRCS ${ARCHDIR}/compare256_avx2.c) + add_feature_info(AVX2_COMPARE256 1 "Support AVX2 optimized compare256, using \"${AVX2FLAG}\"") + list(APPEND AVX2_SRCS ${ARCHDIR}/adler32_avx2.c) + add_feature_info(AVX2_ADLER32 1 "Support AVX2-accelerated adler32, using \"${AVX2FLAG}\"") + list(APPEND ZLIB_ARCH_SRCS ${AVX2_SRCS}) + set_property(SOURCE ${AVX2_SRCS} PROPERTY COMPILE_FLAGS "${AVX2FLAG} ${NOLTOFLAG}") + else() + set(WITH_AVX2 OFF) + endif() + endif() + if(WITH_AVX512) + check_avx512_intrinsics() + if(HAVE_AVX512_INTRIN AND WITH_AVX2) + add_definitions(-DX86_AVX512) + list(APPEND AVX512_SRCS ${ARCHDIR}/adler32_avx512.c) + add_feature_info(AVX512_ADLER32 1 "Support AVX512-accelerated adler32, using \"${AVX512FLAG}\"") + list(APPEND ZLIB_ARCH_SRCS ${AVX512_SRCS}) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/adler32_avx512_p.h) + set_property(SOURCE ${AVX512_SRCS} PROPERTY COMPILE_FLAGS "${AVX512FLAG} ${NOLTOFLAG}") + else() + set(WITH_AVX512 OFF) + endif() + endif() + if(WITH_AVX512VNNI) + check_avx512vnni_intrinsics() + if(HAVE_AVX512VNNI_INTRIN AND WITH_AVX2) + add_definitions(-DX86_AVX512VNNI) + add_feature_info(AVX512VNNI_ADLER32 1 "Support AVX512VNNI adler32, using \"${AVX512VNNIFLAG}\"") + list(APPEND AVX512VNNI_SRCS ${ARCHDIR}/adler32_avx512_vnni.c) + list(APPEND ZLIB_ARCH_SRCS ${AVX512VNNI_SRCS}) + set_property(SOURCE ${AVX512VNNI_SRCS} PROPERTY COMPILE_FLAGS "${AVX512VNNIFLAG} ${NOLTOFLAG}") + else() + set(WITH_AVX512VNNI OFF) + endif() + endif() + if(WITH_VPCLMULQDQ) + check_vpclmulqdq_intrinsics() + if(HAVE_VPCLMULQDQ_INTRIN AND WITH_PCLMULQDQ AND WITH_AVX512) + add_definitions(-DX86_VPCLMULQDQ_CRC) + set(VPCLMULQDQ_SRCS ${ARCHDIR}/crc32_vpclmulqdq.c) + add_feature_info(VPCLMUL_CRC 1 "Support CRC hash generation using VPCLMULQDQ, using \"${PCLMULFLAG} ${VPCLMULFLAG} ${AVX512FLAG}\"") + list(APPEND ZLIB_ARCH_SRCS ${VPCLMULQDQ_SRCS}) + set_property(SOURCE ${VPCLMULQDQ_SRCS} PROPERTY COMPILE_FLAGS "${PCLMULFLAG} ${VPCLMULFLAG} ${AVX512FLAG} ${NOLTOFLAG}") + else() + set(WITH_VPCLMULQDQ OFF) + endif() + endif() + endif() +endif() + +message(STATUS "Architecture-specific source files: ${ZLIB_ARCH_SRCS}") + +#============================================================================ +# zconf.h +#============================================================================ + +macro(generate_cmakein input output) + file(REMOVE ${output}) + file(STRINGS ${input} _lines) + foreach(_line IN LISTS _lines) + string(REGEX REPLACE "#ifdef HAVE_UNISTD_H.*" "@ZCONF_UNISTD_LINE@" _line "${_line}") + string(REGEX REPLACE "#ifdef NEED_PTRDIFF_T.*" "@ZCONF_PTRDIFF_LINE@" _line "${_line}") + if(NEED_PTRDIFF_T) + string(REGEX REPLACE "typedef PTRDIFF_TYPE" "typedef @PTRDIFF_TYPE@" _line "${_line}") + endif() + file(APPEND ${output} "${_line}\n") + endforeach() +endmacro(generate_cmakein) + +generate_cmakein( ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.in ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h.cmakein ) + +if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) + # If we're doing an out of source build and the user has a zconf.h + # in their source tree... + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h) + message(STATUS "Renaming") + message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h") + message(STATUS "to 'zconf${SUFFIX}.h.included' because this file is included with zlib") + message(STATUS "but CMake generates it automatically in the build directory.") + file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.included) + endif() + + # If we're doing an out of source build and the user has a zconf.h.cmakein + # in their source tree... + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein) + message(STATUS "Renaming") + message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein") + message(STATUS "to 'zconf${SUFFIX}.h.cmakeincluded' because this file is included with zlib") + message(STATUS "but CMake generates it automatically in the build directory.") + file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakeincluded) + endif() +endif() + +# The user is allowed (but discouraged) to set absolute CMAKE_INSTALL_*DIR paths. +# If they do, we copy these non-relocatable paths into the pkg-config file. +if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(PC_INC_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}") +else() + set(PC_INC_INSTALL_DIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") +endif() + +if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") + set(PC_LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") +else() + set(PC_LIB_INSTALL_DIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +endif() + +#============================================================================ +# zlib +#============================================================================ + +set(ZLIB_PUBLIC_HDRS + ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h + ${CMAKE_CURRENT_BINARY_DIR}/zlib_name_mangling${SUFFIX}.h + ${CMAKE_CURRENT_BINARY_DIR}/zlib${SUFFIX}.h +) +set(ZLIB_PRIVATE_HDRS + adler32_p.h + chunkset_tpl.h + compare256_rle.h + arch_functions.h + crc32_braid_p.h + crc32_braid_comb_p.h + crc32_braid_tbl.h + deflate.h + deflate_p.h + functable.h + inffast_tpl.h + inffixed_tbl.h + inflate.h + inflate_p.h + inftrees.h + insert_string_tpl.h + match_tpl.h + trees.h + trees_emit.h + trees_tbl.h + zbuild.h + zendian.h + zutil.h +) +set(ZLIB_SRCS + arch/generic/adler32_c.c + arch/generic/adler32_fold_c.c + arch/generic/chunkset_c.c + arch/generic/compare256_c.c + arch/generic/crc32_braid_c.c + arch/generic/crc32_fold_c.c + arch/generic/slide_hash_c.c + adler32.c + compress.c + crc32.c + crc32_braid_comb.c + deflate.c + deflate_fast.c + deflate_huff.c + deflate_medium.c + deflate_quick.c + deflate_rle.c + deflate_slow.c + deflate_stored.c + functable.c + infback.c + inflate.c + inftrees.c + insert_string.c + insert_string_roll.c + trees.c + uncompr.c + zutil.c +) + +if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_PRIVATE_HDRS cpu_features.h) + list(APPEND ZLIB_SRCS cpu_features.c) +endif() + +set(ZLIB_GZFILE_PRIVATE_HDRS + gzguts.h +) +set(ZLIB_GZFILE_SRCS + gzlib.c + ${CMAKE_CURRENT_BINARY_DIR}/gzread.c + gzwrite.c +) + +set(ZLIB_ALL_SRCS ${ZLIB_SRCS} ${ZLIB_ARCH_HDRS} ${ZLIB_ARCH_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +if(WITH_GZFILEOP) + list(APPEND ZLIB_ALL_SRCS ${ZLIB_GZFILE_PRIVATE_HDRS} ${ZLIB_GZFILE_SRCS}) +endif() + +if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) + set(ZLIB_DLL_SRCS win32/zlib${SUFFIX}1.rc) +endif() + +if(NOT DEFINED BUILD_SHARED_LIBS) + add_library(zlib SHARED ${ZLIB_ALL_SRCS} ${ZLIB_DLL_SRCS}) + add_library(zlibstatic STATIC ${ZLIB_ALL_SRCS}) + + set(ZLIB_INSTALL_LIBRARIES zlib zlibstatic) +else() + add_library(zlib ${ZLIB_ALL_SRCS}) + + if(BUILD_SHARED_LIBS) + target_sources(zlib PRIVATE ${ZLIB_DLL_SRCS}) + else() + add_library(zlibstatic ALIAS zlib) + endif() + + set(ZLIB_INSTALL_LIBRARIES zlib) +endif() + +# INFO: Mimics official zlib CMake target +# Generates ZLIB.cmake in case ZLIB_COMPAT=ON and always exports the CMake target ZLIB::ZLIB +# In case ZLIB_COMPAT=OFF, the CMake target and file follows zlib-ng naming convention +if (ZLIB_COMPAT) + if (TARGET zlib) + set_target_properties(zlib PROPERTIES EXPORT_NAME ZLIB) + else() + set_target_properties(zlibstatic PROPERTIES EXPORT_NAME ZLIB) + endif() +endif() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${ARCHDIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/arch/generic) + +foreach(ZLIB_INSTALL_LIBRARY ${ZLIB_INSTALL_LIBRARIES}) + if(NOT ZLIB_COMPAT) + target_compile_definitions(${ZLIB_INSTALL_LIBRARY} PUBLIC ZLIBNG_NATIVE_API) + endif() + target_include_directories(${ZLIB_INSTALL_LIBRARY} PUBLIC + "$${CMAKE_CURRENT_SOURCE_DIR}>" + "$") +endforeach() + +if(WIN32) + # Shared library + if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) + set_target_properties(zlib PROPERTIES OUTPUT_NAME zlib${SUFFIX}) + endif() + # Static library + if(NOT DEFINED BUILD_SHARED_LIBS) + if(MSVC) + set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME zlibstatic${SUFFIX}) + else() + set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z${SUFFIX}) + endif() + elseif(NOT BUILD_SHARED_LIBS) + if(MSVC) + set_target_properties(zlib PROPERTIES OUTPUT_NAME zlibstatic${SUFFIX}) + else() + set_target_properties(zlib PROPERTIES OUTPUT_NAME z${SUFFIX}) + endif() + endif() +else() + # On unix-like platforms the library is almost always called libz + set_target_properties(${ZLIB_INSTALL_LIBRARIES} PROPERTIES OUTPUT_NAME z${SUFFIX}) +endif() + +if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) + set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) + + if(ZLIB_COMPAT) + set_target_properties(zlib PROPERTIES SOVERSION 1) + else() + set_target_properties(zlib PROPERTIES SOVERSION 2) + endif() + + if(NOT CYGWIN) + # This property causes shared libraries on Linux to have the full version + # encoded into their final filename. We disable this on Cygwin because + # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll + # seems to be the default. + # + # This has no effect with MSVC, on that platform the version info for + # the DLL comes from the resource file win32/zlib1.rc + set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) + endif() + + if(UNIX) + if(HAVE_NO_INTERPOSITION) + set_target_properties(zlib PROPERTIES COMPILE_FLAGS "-fno-semantic-interposition") + endif() + if(NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL AIX) + if(NOT ZLIB_COMPAT) + add_definitions(-DHAVE_SYMVER) + endif() + set_target_properties(zlib PROPERTIES LINK_FLAGS + "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.map\"") + endif() + endif() + if(MSYS) + # Suppress version number from shared library name + set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 0) + elseif(WIN32) + # Creates zlib1.dll when building shared library version + if(ZLIB_COMPAT) + set_target_properties(zlib PROPERTIES SUFFIX "1.dll") + else() + set_target_properties(zlib PROPERTIES SUFFIX "2.dll") + endif() + endif() +endif() + +if(HAVE_UNISTD_H) + SET(ZCONF_UNISTD_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */") +else() + SET(ZCONF_UNISTD_LINE "#if 0 /* was set to #if 0 by configure/cmake/etc */") +endif() +if(NEED_PTRDIFF_T) + SET(ZCONF_PTRDIFF_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */") +else() + SET(ZCONF_PTRDIFF_LINE "#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */") +endif() + +set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib${SUFFIX}.pc) +if(WITH_GZFILEOP) + set(PKG_CONFIG_CFLAGS "-DWITH_GZFILEOP") +endif() +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein + ${ZLIB_PC} @ONLY) +configure_file(${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h.cmakein + ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.h.in + ${CMAKE_CURRENT_BINARY_DIR}/zlib${SUFFIX}.h @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gzread.c.in + ${CMAKE_CURRENT_BINARY_DIR}/gzread.c @ONLY) + +if (NOT ZLIB_SYMBOL_PREFIX STREQUAL "") + add_feature_info(ZLIB_SYMBOL_PREFIX ON "Publicly exported symbols have a custom prefix") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib_name_mangling${SUFFIX}.h.in + ${CMAKE_CURRENT_BINARY_DIR}/zlib_name_mangling${SUFFIX}.h @ONLY) +else() + add_feature_info(ZLIB_SYMBOL_PREFIX OFF "Publicly exported symbols DO NOT have a custom prefix") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib_name_mangling.h.empty + ${CMAKE_CURRENT_BINARY_DIR}/zlib_name_mangling${SUFFIX}.h COPYONLY) +endif() +# add_definitions(-DZLIB_SYMBOL_PREFIX=${ZLIB_SYMBOL_PREFIX}) # not needed + + +if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) + install(TARGETS ${ZLIB_INSTALL_LIBRARIES} + EXPORT ${EXPORT_NAME} + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") +endif() +if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zlib${SUFFIX}.h + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" RENAME zlib${SUFFIX}.h) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zlib_name_mangling${SUFFIX}.h + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" RENAME zlib_name_mangling${SUFFIX}.h) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" RENAME zconf${SUFFIX}.h) +endif() +if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL) + install(FILES ${ZLIB_PC} DESTINATION "${PKGCONFIG_INSTALL_DIR}") + install(EXPORT ${EXPORT_NAME} + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME}" + NAMESPACE ${EXPORT_NAME}::) + # Use GNU-style variable names + set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}) + set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) + if (ZLIB_COMPAT) + set(PACKAGE_CONFIGNAME zlib) + set(PACKAGE_VERSION ${ZLIB_HEADER_VERSION}) + else() + set(PACKAGE_CONFIGNAME zlib-ng) + set(PACKAGE_VERSION ${ZLIBNG_HEADER_VERSION}) + endif() + configure_package_config_file(${PACKAGE_CONFIGNAME}-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_CONFIGNAME}-config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME} + PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_CONFIGNAME}-config-version.cmake + VERSION ${PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_CONFIGNAME}-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_CONFIGNAME}-config-version.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME}) +endif() + +#============================================================================ +# Example binaries +#============================================================================ + +if(ZLIB_ENABLE_TESTS) + enable_testing() + + if(BUILD_SHARED_LIBS) + if(ZLIBNG_ENABLE_TESTS) + message(STATUS "Disabling zlib-ng tests because shared libraries are enabled") + set(ZLIBNG_ENABLE_TESTS OFF) + endif() + + if(WITH_BENCHMARKS OR WITH_BENCHMARK_APPS) + message(STATUS "Disabling benchmarks because shared libraries are enabled") + set(WITH_BENCHMARKS OFF) + set(WITH_BENCHMARK_APPS OFF) + endif() + endif() + + add_subdirectory(test) +endif() + +add_feature_info(WITH_GZFILEOP WITH_GZFILEOP "Compile with support for gzFile related functions") +add_feature_info(ZLIB_COMPAT ZLIB_COMPAT "Compile with zlib compatible API") +add_feature_info(ZLIB_ENABLE_TESTS ZLIB_ENABLE_TESTS "Build test binaries") +add_feature_info(ZLIBNG_ENABLE_TESTS ZLIBNG_ENABLE_TESTS "Test zlib-ng specific API") +add_feature_info(WITH_SANITIZER WITH_SANITIZER "Enable sanitizer support") +add_feature_info(WITH_GTEST WITH_GTEST "Build gtest_zlib") +add_feature_info(WITH_FUZZERS WITH_FUZZERS "Build test/fuzz") +add_feature_info(WITH_BENCHMARKS WITH_BENCHMARKS "Build test/benchmarks") +add_feature_info(WITH_BENCHMARK_APPS WITH_BENCHMARK_APPS "Build application benchmarks") +add_feature_info(WITH_OPTIM WITH_OPTIM "Build with optimisation") +add_feature_info(WITH_NEW_STRATEGIES WITH_NEW_STRATEGIES "Use new strategies") +add_feature_info(WITH_NATIVE_INSTRUCTIONS WITH_NATIVE_INSTRUCTIONS + "Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)") +add_feature_info(WITH_RUNTIME_CPU_DETECTION WITH_RUNTIME_CPU_DETECTION "Build with runtime CPU detection") +add_feature_info(WITH_MAINTAINER_WARNINGS WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings") +add_feature_info(WITH_CODE_COVERAGE WITH_CODE_COVERAGE "Enable code coverage reporting") +add_feature_info(WITH_INFLATE_STRICT WITH_INFLATE_STRICT "Build with strict inflate distance checking") +add_feature_info(WITH_INFLATE_ALLOW_INVALID_DIST WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances") + +if(BASEARCH_ARM_FOUND) + add_feature_info(WITH_ACLE WITH_ACLE "Build with ACLE") + add_feature_info(WITH_NEON WITH_NEON "Build with NEON intrinsics") + add_feature_info(WITH_ARMV6 WITH_ARMV6 "Build with ARMv6 SIMD") +elseif(BASEARCH_PPC_FOUND) + add_feature_info(WITH_ALTIVEC WITH_ALTIVEC "Build with AltiVec optimisations") + add_feature_info(WITH_POWER8 WITH_POWER8 "Build with optimisations for POWER8") + add_feature_info(WITH_POWER9 WITH_POWER9 "Build with optimisations for POWER9") +elseif(BASEARCH_RISCV_FOUND) + add_feature_info(WITH_RVV WITH_RVV "Build with RVV intrinsics") +elseif(BASEARCH_S360_FOUND) + add_feature_info(WITH_DFLTCC_DEFLATE WITH_DFLTCC_DEFLATE "Build with DFLTCC intrinsics for compression on IBM Z") + add_feature_info(WITH_DFLTCC_INFLATE WITH_DFLTCC_INFLATE "Build with DFLTCC intrinsics for decompression on IBM Z") + add_feature_info(WITH_CRC32_VX WITH_CRC32_VX "Build with vectorized CRC32 on IBM Z") +elseif(BASEARCH_X86_FOUND) + add_feature_info(WITH_AVX2 WITH_AVX2 "Build with AVX2") + add_feature_info(WITH_AVX512 WITH_AVX512 "Build with AVX512") + add_feature_info(WITH_AVX512VNNI WITH_AVX512VNNI "Build with AVX512 VNNI") + add_feature_info(WITH_SSE2 WITH_SSE2 "Build with SSE2") + add_feature_info(WITH_SSSE3 WITH_SSSE3 "Build with SSSE3") + add_feature_info(WITH_SSE42 WITH_SSE42 "Build with SSE42") + add_feature_info(WITH_PCLMULQDQ WITH_PCLMULQDQ "Build with PCLMULQDQ") + add_feature_info(WITH_VPCLMULQDQ WITH_VPCLMULQDQ "Build with VPCLMULQDQ") +endif() + +add_feature_info(INSTALL_UTILS INSTALL_UTILS "Copy minigzip and minideflate during install") + +FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES) + +#============================================================================ +# CPack +#============================================================================ +set(CPACK_GENERATOR "TGZ") +set(CPACK_SOURCE_GENERATOR "TGZ") +set(CPACK_SOURCE_IGNORE_FILES .git/ _CPack_Packages/ "${PROJECT_BINARY_DIR}/") + +set(CPACK_PACKAGE_NAME "zlib${SUFFIX}") +set(CPACK_PACKAGE_VERSION ${ZLIB_FULL_VERSION}) +set(CPACK_PACKAGE_DIRECTORY "${PROJECT_BINARY_DIR}/package") + +if("${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}") + message(WARNING "Building to source folder is not recommended. Cpack will be unable to generate source package.") +endif() + +include(CPack) diff --git a/internal-complibs/zlib-ng-2.0.7/FAQ.zlib b/internal-complibs/zlib-ng-2.2.2/FAQ.zlib similarity index 99% rename from internal-complibs/zlib-ng-2.0.7/FAQ.zlib rename to internal-complibs/zlib-ng-2.2.2/FAQ.zlib index 163160c10..698a4f83f 100644 --- a/internal-complibs/zlib-ng-2.0.7/FAQ.zlib +++ b/internal-complibs/zlib-ng-2.2.2/FAQ.zlib @@ -20,8 +20,7 @@ The latest zlib FAQ is at https://zlib.net/zlib_faq.html 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at https://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? diff --git a/internal-complibs/zlib-ng-2.0.7/INDEX.md b/internal-complibs/zlib-ng-2.2.2/INDEX.md similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/INDEX.md rename to internal-complibs/zlib-ng-2.2.2/INDEX.md diff --git a/internal-complibs/zlib-ng-2.0.7/LICENSE.md b/internal-complibs/zlib-ng-2.2.2/LICENSE.md similarity index 94% rename from internal-complibs/zlib-ng-2.0.7/LICENSE.md rename to internal-complibs/zlib-ng-2.2.2/LICENSE.md index adb48d472..e866d7ac1 100644 --- a/internal-complibs/zlib-ng-2.0.7/LICENSE.md +++ b/internal-complibs/zlib-ng-2.2.2/LICENSE.md @@ -1,4 +1,4 @@ -(C) 1995-2013 Jean-loup Gailly and Mark Adler +(C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/internal-complibs/zlib-ng-2.0.7/Makefile.in b/internal-complibs/zlib-ng-2.2.2/Makefile.in similarity index 61% rename from internal-complibs/zlib-ng-2.0.7/Makefile.in rename to internal-complibs/zlib-ng-2.2.2/Makefile.in index ed723df5e..6eb180de0 100644 --- a/internal-complibs/zlib-ng-2.0.7/Makefile.in +++ b/internal-complibs/zlib-ng-2.2.2/Makefile.in @@ -1,5 +1,5 @@ # Makefile for zlib -# Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler +# Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler # For conditions of distribution and use, see copyright notice in zlib.h # To compile and test, type: @@ -28,8 +28,9 @@ SUFFIX=-ng TEST_LIBS=$(LIBNAME1).a LDSHARED=$(CC) LDSHAREDFLAGS=-shared +LDVERSIONSCRIPT= -VER=2.0.7 +VER=2.2.2 VER1=2 STATICLIB=$(LIBNAME1).a @@ -57,6 +58,8 @@ EXE= SRCDIR=. INCLUDES=-I$(SRCDIR) +BUILDDIR=. + ARCHDIR=arch/generic ARCH_STATIC_OBJS= ARCH_SHARED_OBJS= @@ -72,26 +75,35 @@ man3dir = ${mandir}/man3 pkgconfigdir = ${libdir}/pkgconfig OBJZ = \ + arch/generic/adler32_c.o \ + arch/generic/adler32_fold_c.o \ + arch/generic/chunkset_c.o \ + arch/generic/compare256_c.o \ + arch/generic/crc32_braid_c.o \ + arch/generic/crc32_fold_c.o \ + arch/generic/slide_hash_c.o \ adler32.o \ - chunkset.o \ - compare258.o \ compress.o \ crc32.o \ - crc32_comb.o \ + crc32_braid_comb.o \ deflate.o \ deflate_fast.o \ + deflate_huff.o \ deflate_medium.o \ deflate_quick.o \ + deflate_rle.o \ deflate_slow.o \ + deflate_stored.o \ functable.o \ infback.o \ - inffast.o \ inflate.o \ inftrees.o \ insert_string.o \ + insert_string_roll.o \ trees.o \ uncompr.o \ zutil.o \ + cpu_features.o \ $(ARCH_STATIC_OBJS) OBJG = \ @@ -99,29 +111,39 @@ OBJG = \ gzread.o \ gzwrite.o +TESTOBJG = OBJC = $(OBJZ) $(OBJG) PIC_OBJZ = \ + arch/generic/adler32_c.lo \ + arch/generic/adler32_fold_c.lo \ + arch/generic/chunkset_c.lo \ + arch/generic/compare256_c.lo \ + arch/generic/crc32_braid_c.lo \ + arch/generic/crc32_fold_c.lo \ + arch/generic/slide_hash_c.lo \ adler32.lo \ - chunkset.lo \ - compare258.lo \ compress.lo \ crc32.lo \ - crc32_comb.lo \ + crc32_braid_comb.lo \ deflate.lo \ deflate_fast.lo \ + deflate_huff.lo \ deflate_medium.lo \ deflate_quick.lo \ + deflate_rle.lo \ deflate_slow.lo \ + deflate_stored.lo \ functable.lo \ infback.lo \ - inffast.lo \ inflate.lo \ inftrees.lo \ insert_string.lo \ + insert_string_roll.lo \ trees.lo \ uncompr.lo \ zutil.lo \ + cpu_features.lo \ $(ARCH_SHARED_OBJS) PIC_OBJG = \ @@ -129,6 +151,7 @@ PIC_OBJG = \ gzread.lo \ gzwrite.lo +PIC_TESTOBJG = PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG) OBJS = $(OBJC) @@ -137,9 +160,9 @@ PIC_OBJS = $(PIC_OBJC) all: static shared -static: adler32_test$(EXE) crc32_test$(EXE) example$(EXE) minigzip$(EXE) fuzzers makefixed$(EXE) maketrees$(EXE) makecrct$(EXE) +static: example$(EXE) minigzip$(EXE) makefixed$(EXE) maketrees$(EXE) makecrct$(EXE) -shared: adler32_testsh$(EXE) crc32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) +shared: examplesh$(EXE) minigzipsh$(EXE) check: test @@ -151,6 +174,12 @@ $(ARCHDIR)/%.o: $(SRCDIR)/$(ARCHDIR)/%.c $(ARCHDIR)/%.lo: $(SRCDIR)/$(ARCHDIR)/%.c $(MAKE) -C $(ARCHDIR) $(notdir $@) +arch/generic/%.o: $(SRCDIR)/arch/generic/%.c + $(MAKE) -C arch/generic $(notdir $@) + +arch/generic/%.lo: $(SRCDIR)/arch/generic/%.c + $(MAKE) -C arch/generic $(notdir $@) + %.o: $(ARCHDIR)/%.o -cp $< $@ @@ -160,60 +189,7 @@ $(ARCHDIR)/%.lo: $(SRCDIR)/$(ARCHDIR)/%.c test: all $(MAKE) -C test -# This variable is set by configure. -WITH_FUZZERS= - -# By default, use our own standalone_fuzz_target_runner. -# This runner does no fuzzing, but simply executes the inputs -# provided via parameters. -# Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a" -# to link the fuzzer(s) against a real fuzzing engine. -ifeq (,$(LIB_FUZZING_ENGINE)) - LIB_FUZZING_ENGINE = standalone_fuzz_target_runner.o -else - # OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE. - WITH_FUZZERS=1 -endif - -ifeq (1,$(WITH_FUZZERS)) -fuzzers: checksum_fuzzer$(EXE) compress_fuzzer$(EXE) example_small_fuzzer$(EXE) example_large_fuzzer$(EXE) example_flush_fuzzer$(EXE) example_dict_fuzzer$(EXE) minigzip_fuzzer$(EXE) -else -fuzzers: -endif - -# The standalone fuzz target runner. -standalone_fuzz_target_runner.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -checksum_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -compress_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -example_small_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -example_large_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -example_flush_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -example_dict_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -minigzip_fuzzer.o: - $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $< -checksum_fuzzer$(EXE): checksum_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) checksum_fuzzer.o $(STATICLIB) -lpthread -compress_fuzzer$(EXE): compress_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) compress_fuzzer.o $(STATICLIB) -lpthread -example_small_fuzzer$(EXE): example_small_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_small_fuzzer.o $(STATICLIB) -lpthread -example_large_fuzzer$(EXE): example_large_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_large_fuzzer.o $(STATICLIB) -lpthread -example_flush_fuzzer$(EXE): example_flush_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_flush_fuzzer.o $(STATICLIB) -lpthread -example_dict_fuzzer$(EXE): example_dict_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_dict_fuzzer.o $(STATICLIB) -lpthread -minigzip_fuzzer$(EXE): minigzip_fuzzer.o standalone_fuzz_target_runner.o $(OBJG) $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) minigzip_fuzzer.o $(OBJG) $(STATICLIB) -lpthread - -infcover.o: $(SRCDIR)/test/infcover.c $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h +infcover.o: $(SRCDIR)/test/infcover.c zlib$(SUFFIX).h zconf$(SUFFIX).h zlib_name_mangling$(SUFFIX).h $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/infcover.c infcover$(EXE): infcover.o $(STATICLIB) @@ -231,12 +207,6 @@ $(STATICLIB): $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 -adler32_test.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/adler32_test.c - -crc32_test.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/crc32_test.c - example.o: $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $(SRCDIR)/test/example.c @@ -252,8 +222,8 @@ maketrees.o: makecrct.o: $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/makecrct.c -zlibrc.o: win32/zlib$(SUFFIX)1.rc - $(RC) $(RCFLAGS) -o $@ win32/zlib$(SUFFIX)1.rc +zlibrc.o: $(SRCDIR)/win32/zlib$(SUFFIX)1.rc + $(RC) $(RCFLAGS) -o $@ $(SRCDIR)/win32/zlib$(SUFFIX)1.rc .SUFFIXES: .lo @@ -263,12 +233,27 @@ zlibrc.o: win32/zlib$(SUFFIX)1.rc %.lo: $(SRCDIR)/%.c $(CC) $(SFLAGS) -DPIC $(INCLUDES) -c -o $@ $< -$(OBJG): %.o: $(SRCDIR)/%.c +gzlib.o: $(SRCDIR)/gzlib.c + $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $< + +gzlib.lo: $(SRCDIR)/gzlib.c + $(CC) $(SFLAGS) -DPIC -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $< + +gzread.o: gzread.c $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $< +gzread.lo: gzread.c + $(CC) $(SFLAGS) -DPIC -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $< + +gzwrite.o: $(SRCDIR)/gzwrite.c + $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $< + +gzwrite.lo: $(SRCDIR)/gzwrite.c + $(CC) $(SFLAGS) -DPIC -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $< + $(SHAREDTARGET): $(PIC_OBJS) $(DEFFILE) $(RCOBJS) ifneq ($(SHAREDTARGET),) - $(LDSHARED) $(CFLAGS) $(LDSHAREDFLAGS) $(LDFLAGS) -o $@ $(DEFFILE) $(PIC_OBJS) $(RCOBJS) $(LDSHAREDLIBC) + $(LDSHARED) $(CFLAGS) $(LDSHAREDFLAGS) $(LDVERSIONSCRIPT) $(LDFLAGS) -o $@ $(DEFFILE) $(PIC_OBJS) $(RCOBJS) $(LDSHAREDLIBC) ifneq ($(STRIP),) $(STRIP) $@ endif @@ -279,50 +264,27 @@ ifneq ($(SHAREDLIB),$(SHAREDTARGET)) endif endif -adler32_test$(EXE): adler32_test.o $(STATICLIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ adler32_test.o $(TEST_LIBS) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -crc32_test$(EXE): crc32_test.o $(STATICLIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ crc32_test.o $(TEST_LIBS) $(LDSHAREDLIBC) +example$(EXE): example.o $(TESTOBJG) $(STATICLIB) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TESTOBJG) $(TEST_LIBS) $(LDSHAREDLIBC) ifneq ($(STRIP),) $(STRIP) $@ endif -example$(EXE): example.o $(STATICLIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS) $(LDSHAREDLIBC) +minigzip$(EXE): minigzip.o $(TESTOBJG) $(STATICLIB) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TESTOBJG) $(TEST_LIBS) $(LDSHAREDLIBC) ifneq ($(STRIP),) $(STRIP) $@ endif -minigzip$(EXE): minigzip.o $(STATICLIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS) $(LDSHAREDLIBC) +minigzipsh$(EXE): minigzip.o $(PIC_TESTOBJG) $(SHAREDTARGET) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(PIC_TESTOBJG) $(SHAREDLIB) $(LDSHAREDLIBC) ifneq ($(STRIP),) $(STRIP) $@ endif -adler32_testsh$(EXE): adler32_test.o $(SHAREDTARGET) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ adler32_test.o $(SHAREDLIB) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -crc32_testsh$(EXE): crc32_test.o $(SHAREDTARGET) - $(CC) $(LDFLAGS) -o $@ crc32_test.o $(SHAREDLIB) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -examplesh$(EXE): example.o $(SHAREDTARGET) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(SHAREDLIB) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif -minigzipsh$(EXE): minigzip.o $(SHAREDTARGET) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(SHAREDLIB) $(LDSHAREDLIBC) +examplesh$(EXE): example.o $(PIC_TESTOBJG) $(SHAREDTARGET) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(PIC_TESTOBJG) $(SHAREDLIB) $(LDSHAREDLIBC) ifneq ($(STRIP),) $(STRIP) $@ endif @@ -381,10 +343,11 @@ install-libs: install-shared install-static install: install-libs -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi - rm -f $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h - cp $(SRCDIR)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zlib$(SUFFIX).h + rm -f $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zlib_name_mangling$(SUFFIX).h + cp zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zlib$(SUFFIX).h cp zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h - chmod 644 $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h + cp zlib_name_mangling$(SUFFIX).h $(DESTDIR)$(includedir)/zlib_name_mangling$(SUFFIX).h + chmod 644 $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zlib_name_mangling$(SUFFIX).h uninstall-static: cd $(DESTDIR)$(libdir) && rm -f $(STATICLIB) @@ -398,18 +361,16 @@ ifneq ($(IMPORTLIB),) endif uninstall: uninstall-static uninstall-shared - cd $(DESTDIR)$(includedir) && rm -f zlib$(SUFFIX).h zconf$(SUFFIX).h + cd $(DESTDIR)$(includedir) && rm -f zlib$(SUFFIX).h zconf$(SUFFIX).h zlib_name_mangling$(SUFFIX).h cd $(DESTDIR)$(pkgconfigdir) && rm -f $(PKGFILE) mostlyclean: clean clean: @if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) clean; fi + @if [ -f arch/generic/Makefile ]; then $(MAKE) -C arch/generic clean; fi @if [ -f test/Makefile ]; then $(MAKE) -C test clean; fi rm -f *.o *.lo *~ \ - adler32_test$(EXE) crc32_test$(EXE) example$(EXE) minigzip$(EXE) \ - adler32_testsh$(EXE) crc32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ - checksum_fuzzer$(EXE) compress_fuzzer$(EXE) example_small_fuzzer$(EXE) example_large_fuzzer$(EXE) \ - example_flush_fuzzer$(EXE) example_dict_fuzzer$(EXE) minigzip_fuzzer$(EXE) \ + example$(EXE) minigzip$(EXE) minigzipsh$(EXE) \ infcover makefixed$(EXE) maketrees$(EXE) makecrct$(EXE) \ $(STATICLIB) $(IMPORTLIB) $(SHAREDLIB) $(SHAREDLIBV) $(SHAREDLIBM) \ foo.gz so_locations \ @@ -424,7 +385,7 @@ maintainer-clean: distclean distclean: clean @if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) distclean; fi @if [ -f test/Makefile ]; then $(MAKE) -C test distclean; fi - rm -f $(PKGFILE) configure.log zconf.h zconf.h.cmakein *.pc + rm -f $(PKGFILE) configure.log zconf.h zconf.h.cmakein zlib$(SUFFIX).h zlib_name_mangling$(SUFFIX).h *.pc gzread.c -@rm -f .DS_Store # Reset Makefile if building inside source tree @if [ -f Makefile.in ]; then \ diff --git a/internal-complibs/zlib-ng-2.0.7/PORTING.md b/internal-complibs/zlib-ng-2.2.2/PORTING.md similarity index 64% rename from internal-complibs/zlib-ng-2.0.7/PORTING.md rename to internal-complibs/zlib-ng-2.2.2/PORTING.md index 1f2c7d62d..208f6ee9e 100644 --- a/internal-complibs/zlib-ng-2.0.7/PORTING.md +++ b/internal-complibs/zlib-ng-2.2.2/PORTING.md @@ -4,6 +4,38 @@ Porting applications to use zlib-ng Zlib-ng can be used/compiled in two different modes, that require some consideration by the application developer. +Changes from zlib affecting native and compat modes +--------------------------------------------------- +Zlib-ng is not as conservative with memory allocation as Zlib is. + +Where Zlib's inflate will allocate a lower amount of memory depending on +compression level and window size, zlib-ng will always allocate the maximum +amount of memory and possibly leave parts of it unused. +Zlib-ng's deflate will however allocate a lower amount of memory depending +on compression level and window size. + +Zlib-ng also allocates one "big" buffer instead of doing multiple smaller +allocations. This is faster, can lead to better cache locality and reduces +space lost to alignment padding. + +At the time of writing, by default zlib-ng allocates the following amounts +of memory on a 64-bit system (except on S390x that requires ~4KiB more): +- Deflate: 350.272 Bytes +- Inflate: 42.112 Bytes + +**Advantages:** +- All memory is allocated during DeflateInit or InflateInit functions, + leaving the actual deflate/inflate functions free from allocations. +- Zlib-ng can only fail from memory allocation errors during init. +- Time spent doing memory allocation systemcalls is all done during init, + allowing applications to do prepare this before doing latency-sensitive + deflate/inflate later. +- Can reduce wasted memory due to buffer alignment padding both by OS and zlib-ng. +- Potentially improved memory locality. + +**Disadvantages:** +- Zlib-ng allocates a little more memory than zlib does. + zlib-compat mode ---------------- Zlib-ng can be compiled in zlib-compat mode, suitable for zlib-replacement @@ -33,8 +65,8 @@ certain value will need to be updated. - If your application is pre-allocating a memory buffer and you are providing deflate/inflate init with your own allocator that allocates from that buffer (looking at you nginx), you should be aware that zlib-ng needs to allocate - more memory than stock zlib needs. The same problem exists with Intels and - Cloudflares zlib forks. Doing this is not recommended since it makes it + more memory than stock zlib needs. The same problem exists with Intel’s and + Cloudflare’s zlib forks. Doing this is not recommended since it makes it very hard to maintain compatibility over time. **Build Considerations:** @@ -43,7 +75,8 @@ certain value will need to be updated. - Static library is *libz.a* on Unix and macOS, or *zlib.lib* on Windows - Shared library is *libz.so* on Unix, *libz.dylib* on macOS, or *zlib1.dll* on Windows -- Type `z_size_t` is *unsigned long* +- Type `z_size_t` is *unsigned __int64* on 64-bit Windows, and *unsigned long* on 32-bit Windows, Unix and macOS +- Type `z_uintmax_t` is *unsigned long* in zlib-compat mode, and *size_t* with zlib-ng API zlib-ng native mode ------------------- diff --git a/internal-complibs/zlib-ng-2.2.2/README.md b/internal-complibs/zlib-ng-2.2.2/README.md new file mode 100644 index 000000000..411621b52 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/README.md @@ -0,0 +1,229 @@ +| CI | Stable | Develop | +|:---|:-------|:--------| +| GitHub Actions | [![Stable CMake](https://github.com/zlib-ng/zlib-ng/actions/workflows/cmake.yml/badge.svg?branch=stable)](https://github.com/zlib-ng/zlib-ng/actions/workflows/cmake.yml?query=branch%3Astable)
[![Stable Configure](https://github.com/zlib-ng/zlib-ng/actions/workflows/configure.yml/badge.svg?branch=stable)](https://github.com/zlib-ng/zlib-ng/actions/workflows/configure.yml?query=branch%3Astable)
[![Stable NMake](https://github.com/zlib-ng/zlib-ng/actions/workflows/nmake.yml/badge.svg?branch=stable)](https://github.com/zlib-ng/zlib-ng/actions/workflows/nmake.yml?query=branch%3Astable) | [![Develop CMake](https://github.com/zlib-ng/zlib-ng/actions/workflows/cmake.yml/badge.svg?branch=develop)](https://github.com/zlib-ng/zlib-ng/actions/workflows/cmake.yml?query=branch%3Adevelop)
[![Develop Configure](https://github.com/zlib-ng/zlib-ng/actions/workflows/configure.yml/badge.svg?branch=develop)](https://github.com/zlib-ng/zlib-ng/actions/workflows/configure.yml?query=branch%3Adevelop)
[![Develop NMake](https://github.com/zlib-ng/zlib-ng/actions/workflows/nmake.yml/badge.svg?branch=develop)](https://github.com/zlib-ng/zlib-ng/actions/workflows/nmake.yml?query=branch%3Adevelop) | +| CodeFactor | [![CodeFactor](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng/badge/stable)](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng/overview/stable) | [![CodeFactor](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng/badge/develop)](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng/overview/develop) | +| 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) | [![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) | +| Codecov | [![codecov](https://codecov.io/github/zlib-ng/zlib-ng/branch/stable/graph/badge.svg?token=uKsgK9LIuC)](https://codecov.io/github/zlib-ng/zlib-ng/tree/stable) | [![codecov](https://codecov.io/github/zlib-ng/zlib-ng/branch/develop/graph/badge.svg?token=uKsgK9LIuC)](https://codecov.io/github/zlib-ng/zlib-ng/tree/develop) | + +## zlib-ng +*zlib data compression library for the next generation systems* + +Maintained by Hans Kristian Rosbach + aka Dead2 (zlib-ng àt circlestorm dót org) + +Features +-------- + +* Zlib compatible API with support for dual-linking +* Modernized native API based on zlib API for ease of porting +* Modern C11 syntax and a clean code layout +* Deflate medium and quick algorithms based on Intel’s zlib fork +* Support for CPU intrinsics when available + * Adler32 implementation using SSSE3, AVX2, AVX512, AVX512-VNNI, Neon, VMX & VSX + * CRC32-B implementation using PCLMULQDQ, VPCLMULQDQ, ACLE, & IBM Z + * Slide hash implementations using SSE2, AVX2, ARMv6, Neon, VMX & VSX + * Compare256 implementations using SSE2, AVX2, Neon, POWER9 & RVV + * Inflate chunk copying using SSE2, SSSE3, AVX, Neon & VSX + * Support for hardware-accelerated deflate using IBM Z DFLTCC +* Unaligned memory read/writes and large bit buffer improvements +* Includes improvements from Cloudflare and Intel forks +* Configure, CMake, and NMake build system support +* Comprehensive set of CMake unit tests +* Code sanitizers, fuzzing, and coverage +* GitHub Actions continuous integration on Windows, macOS, and Linux + * Emulated CI for ARM, AARCH64, PPC, PPC64, RISCV, SPARC64, S390x using qemu + + +History +------- + +The motivation for this fork was seeing several 3rd party contributions with new optimizations not getting +implemented into the official zlib repository. + +Mark Adler has been maintaining zlib for a very long time, and he has done a great job and hopefully he will continue +for a long time yet. The idea of zlib-ng is not to replace zlib, but to co-exist as a drop-in replacement with a +lower threshold for code change. + +zlib has a long history and is incredibly portable, even supporting many systems that predate the Internet.
+That is great, but it can complicate further development and maintainability. The zlib code contains many workarounds +for really old compilers or to accommodate systems with limitations such as operating in a 16-bit environment. + +Many of these workarounds are only maintenance burdens, some of them are pretty huge code-wise. With many workarounds +cluttered throughout the code, it makes it harder for new programmers with an idea/interest for zlib to contribute. + +I decided to make a fork, merge all the Intel optimizations, some of the Cloudflare optimizations, plus a couple other +smaller patches. Then started cleaning out workarounds, various dead code, all contrib and example code.
+The result is a better performing and easier to maintain zlib-ng. + +A lot of improvements have gone into zlib-ng since its start, and numerous people and companies have contributed both +small and big improvements, or valuable testing. + + +Build +----- +Please read LICENSE.md, it is very simple and very liberal. + +There are two ways to build zlib-ng: + +### Cmake + +To build zlib-ng using the cross-platform makefile generator cmake. + +``` +cmake . +cmake --build . --config Release +ctest --verbose -C Release +``` + +Alternatively, you can use the cmake configuration GUI tool ccmake: + +``` +ccmake . +``` + +### Configure + +To build zlib-ng using the bash configure script: + +``` +./configure +make +make test +``` + +Build Options +------------- + +| CMake | configure | Description | Default | +|:---------------------------|:-------------------------|:------------------------------------------------------------------------------------|---------| +| ZLIB_COMPAT | --zlib-compat | Compile with zlib compatible API | OFF | +| ZLIB_ENABLE_TESTS | | Build test binaries | ON | +| WITH_GZFILEOP | --without-gzfileops | Compile with support for gzFile related functions | ON | +| WITH_OPTIM | --without-optimizations | Build with optimisations | ON | +| WITH_NEW_STRATEGIES | --without-new-strategies | Use new strategies | ON | +| WITH_NATIVE_INSTRUCTIONS | | Compiles with full instruction set supported on this host (gcc/clang -march=native) | OFF | +| WITH_RUNTIME_CPU_DETECTION | | Compiles with runtime CPU detection | ON | +| WITH_SANITIZER | | Build with sanitizer (memory, address, undefined) | OFF | +| WITH_GTEST | | Build gtest_zlib | ON | +| WITH_FUZZERS | | Build test/fuzz | OFF | +| WITH_BENCHMARKS | | Build test/benchmarks | OFF | +| WITH_MAINTAINER_WARNINGS | | Build with project maintainer warnings | OFF | +| WITH_CODE_COVERAGE | | Enable code coverage reporting | OFF | + + +Install +------- + +WARNING: We do not recommend manually installing unless you really know what you are doing, because this can +potentially override the system default zlib library, and any incompatibility or wrong configuration of zlib-ng +can make the whole system unusable, requiring recovery or reinstall. +If you still want a manual install, we recommend using the /opt/ path prefix. + +For Linux distros, an alternative way to use zlib-ng (if compiled in zlib-compat mode) instead of zlib, is through +the use of the _LD_PRELOAD_ environment variable. If the program is dynamically linked with zlib, then the program +will temporarily attempt to use zlib-ng instead, without risking system-wide instability. + +``` +LD_PRELOAD=/opt/zlib-ng/libz.so.1.2.13.zlib-ng /usr/bin/program +``` + +### Cmake + +To install zlib-ng system-wide using cmake: + +```sh or powershell +cmake --build . --target install +``` + +### Configure + +To install zlib-ng system-wide using the configure script: + +```sh +make install +``` + +### CPack + +After building with cmake, an installation package can be created using cpack. By default a tgz package is created, +but you can append `-G ` to each command to generate alternative packages types (TGZ, ZIP, RPM, DEB). To easily +create a rpm or deb package, you would use `-G RPM` or `-G DEB` respectively. + +```sh or powershell +cd build +cpack --config CPackConfig.cmake +cpack --config CPackSourceConfig.cmake +``` + +### Vcpkg + +Alternatively, you can build and install zlib-ng using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager: + +```sh or powershell +git clone https://github.com/Microsoft/vcpkg.git +cd vcpkg +./bootstrap-vcpkg.sh # "./bootstrap-vcpkg.bat" for powershell +./vcpkg integrate install +./vcpkg install zlib-ng +``` + +The zlib-ng port in vcpkg is kept up to date by Microsoft team members and community contributors. +If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. + +Contributing +------------ + +Zlib-ng is aiming to be open to contributions, and we would be delighted to receive pull requests on github. +Help with testing and reviewing pull requests etc is also very much appreciated. + +Please check the Wiki for more info: [Contributing](https://github.com/zlib-ng/zlib-ng/wiki/Contributing) + +Acknowledgments +---------------- + +Thanks go out to all the people and companies who have taken the time to contribute +code reviews, testing and/or patches. Zlib-ng would not have been nearly as good without you. + +The deflate format used by zlib was defined by Phil Katz.
+The deflate and zlib specifications were written by L. Peter Deutsch. + +zlib was originally created by Jean-loup Gailly (compression) and Mark Adler (decompression). + + +Advanced Build Options +---------------------- + +| CMake | configure | Description | Default | +|:--------------------------------|:----------------------|:--------------------------------------------------------------------|------------------------| +| FORCE_SSE2 | --force-sse2 | Skip runtime check for SSE2 instructions (Always on for x86_64) | OFF (x86) | +| WITH_AVX2 | | Build with AVX2 intrinsics | ON | +| WITH_AVX512 | | Build with AVX512 intrinsics | ON | +| WITH_AVX512VNNI | | Build with AVX512VNNI intrinsics | ON | +| WITH_SSE2 | | Build with SSE2 intrinsics | ON | +| WITH_SSSE3 | | Build with SSSE3 intrinsics | ON | +| WITH_SSE42 | | Build with SSE42 intrinsics | ON | +| WITH_PCLMULQDQ | | Build with PCLMULQDQ intrinsics | ON | +| WITH_VPCLMULQDQ | --without-vpclmulqdq | Build with VPCLMULQDQ intrinsics | ON | +| WITH_ACLE | --without-acle | Build with ACLE intrinsics | ON | +| WITH_NEON | --without-neon | Build with NEON intrinsics | ON | +| WITH_ARMV6 | --without-armv6 | Build with ARMv6 intrinsics | ON | +| WITH_ALTIVEC | --without-altivec | Build with AltiVec (VMX) intrinsics | ON | +| WITH_POWER8 | --without-power8 | Build with POWER8 optimisations | ON | +| WITH_RVV | | Build with RVV intrinsics | ON | +| WITH_CRC32_VX | --without-crc32-vx | Build with vectorized CRC32 on IBM Z | ON | +| WITH_DFLTCC_DEFLATE | --with-dfltcc-deflate | Build with DFLTCC intrinsics for compression on IBM Z | OFF | +| WITH_DFLTCC_INFLATE | --with-dfltcc-inflate | Build with DFLTCC intrinsics for decompression on IBM Z | OFF | +| WITH_UNALIGNED | --without-unaligned | Allow optimizations that use unaligned reads if safe on current arch| ON | +| WITH_INFLATE_STRICT | | Build with strict inflate distance checking | OFF | +| WITH_INFLATE_ALLOW_INVALID_DIST | | Build with zero fill for inflate invalid distances | OFF | +| INSTALL_UTILS | | Copy minigzip and minideflate during install | OFF | +| ZLIBNG_ENABLE_TESTS | | Test zlib-ng specific API | ON | + + +Related Projects +---------------- + +* Fork of the popular minizip https://github.com/zlib-ng/minizip-ng +* Python tool to benchmark minigzip/minideflate https://github.com/zlib-ng/deflatebench +* Python tool to benchmark pigz https://github.com/zlib-ng/pigzbench +* 3rd party patches for zlib-ng compatibility https://github.com/zlib-ng/patches diff --git a/internal-complibs/zlib-ng-2.0.7/adler32.c b/internal-complibs/zlib-ng-2.2.2/adler32.c similarity index 52% rename from internal-complibs/zlib-ng-2.0.7/adler32.c rename to internal-complibs/zlib-ng-2.2.2/adler32.c index 7b245fc84..1a643ed53 100644 --- a/internal-complibs/zlib-ng-2.0.7/adler32.c +++ b/internal-complibs/zlib-ng-2.2.2/adler32.c @@ -4,97 +4,27 @@ */ #include "zbuild.h" -#include "zutil.h" #include "functable.h" #include "adler32_p.h" -/* ========================================================================= */ -Z_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len) { - uint32_t sum2; - unsigned n; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (UNLIKELY(len == 1)) - return adler32_len_1(adler, buf, sum2); - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (UNLIKELY(buf == NULL)) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (UNLIKELY(len < 16)) - return adler32_len_16(adler, buf, len, sum2); - - /* do length NMAX blocks -- requires just one modulo operation */ - while (len >= NMAX) { - len -= NMAX; -#ifdef UNROLL_MORE - n = NMAX / 16; /* NMAX is divisible by 16 */ -#else - n = NMAX / 8; /* NMAX is divisible by 8 */ -#endif - do { -#ifdef UNROLL_MORE - DO16(adler, sum2, buf); /* 16 sums unrolled */ - buf += 16; -#else - DO8(adler, sum2, buf, 0); /* 8 sums unrolled */ - buf += 8; -#endif - } while (--n); - adler %= BASE; - sum2 %= BASE; - } - - /* do remaining bytes (less than NMAX, still just one modulo) */ - if (len) { /* avoid modulos if none remaining */ -#ifdef UNROLL_MORE - while (len >= 16) { - len -= 16; - DO16(adler, sum2, buf); - buf += 16; -#else - while (len >= 8) { - len -= 8; - DO8(adler, sum2, buf, 0); - buf += 8; -#endif - } - while (len) { - --len; - adler += *buf++; - sum2 += adler; - } - adler %= BASE; - sum2 %= BASE; - } - - /* return recombined sums */ - return adler | (sum2 << 16); -} - #ifdef ZLIB_COMPAT unsigned long Z_EXPORT PREFIX(adler32_z)(unsigned long adler, const unsigned char *buf, size_t len) { - return (unsigned long)functable.adler32((uint32_t)adler, buf, len); + return (unsigned long)FUNCTABLE_CALL(adler32)((uint32_t)adler, buf, len); } #else uint32_t Z_EXPORT PREFIX(adler32_z)(uint32_t adler, const unsigned char *buf, size_t len) { - return functable.adler32(adler, buf, len); + return FUNCTABLE_CALL(adler32)(adler, buf, len); } #endif /* ========================================================================= */ #ifdef ZLIB_COMPAT unsigned long Z_EXPORT PREFIX(adler32)(unsigned long adler, const unsigned char *buf, unsigned int len) { - return (unsigned long)functable.adler32((uint32_t)adler, buf, len); + return (unsigned long)FUNCTABLE_CALL(adler32)((uint32_t)adler, buf, len); } #else uint32_t Z_EXPORT PREFIX(adler32)(uint32_t adler, const unsigned char *buf, uint32_t len) { - return functable.adler32(adler, buf, len); + return FUNCTABLE_CALL(adler32)(adler, buf, len); } #endif diff --git a/internal-complibs/zlib-ng-2.0.7/adler32_p.h b/internal-complibs/zlib-ng-2.2.2/adler32_p.h similarity index 61% rename from internal-complibs/zlib-ng-2.0.7/adler32_p.h rename to internal-complibs/zlib-ng-2.2.2/adler32_p.h index 7f75c71e2..38ba2ad72 100644 --- a/internal-complibs/zlib-ng-2.0.7/adler32_p.h +++ b/internal-complibs/zlib-ng-2.2.2/adler32_p.h @@ -18,33 +18,50 @@ #define DO8(sum1, sum2, buf, i) {DO4(sum1, sum2, buf, i); DO4(sum1, sum2, buf, i+4);} #define DO16(sum1, sum2, buf) {DO8(sum1, sum2, buf, 0); DO8(sum1, sum2, buf, 8);} -static inline uint32_t adler32_len_1(uint32_t adler, const unsigned char *buf, uint32_t sum2) { +static inline uint32_t adler32_len_1(uint32_t adler, const uint8_t *buf, uint32_t sum2) { adler += buf[0]; - if (adler >= BASE) - adler -= BASE; + adler %= BASE; sum2 += adler; - if (sum2 >= BASE) - sum2 -= BASE; + sum2 %= BASE; return adler | (sum2 << 16); } -static inline uint32_t adler32_len_16(uint32_t adler, const unsigned char *buf, size_t len, uint32_t sum2) { +static inline uint32_t adler32_len_16(uint32_t adler, const uint8_t *buf, size_t len, uint32_t sum2) { while (len) { --len; adler += *buf++; sum2 += adler; } - if (adler >= BASE) - adler -= BASE; + adler %= BASE; sum2 %= BASE; /* only added so many BASE's */ + /* return recombined sums */ return adler | (sum2 << 16); } -static inline uint32_t adler32_len_64(uint32_t adler, const unsigned char *buf, size_t len, uint32_t sum2) { +static inline uint32_t adler32_copy_len_16(uint32_t adler, const uint8_t *buf, uint8_t *dst, size_t len, uint32_t sum2) { + while (len--) { + *dst = *buf++; + adler += *dst++; + sum2 += adler; + } + adler %= BASE; + sum2 %= BASE; /* only added so many BASE's */ + /* return recombined sums */ + return adler | (sum2 << 16); +} + +static inline uint32_t adler32_len_64(uint32_t adler, const uint8_t *buf, size_t len, uint32_t sum2) { +#ifdef UNROLL_MORE while (len >= 16) { len -= 16; DO16(adler, sum2, buf); buf += 16; +#else + while (len >= 8) { + len -= 8; + DO8(adler, sum2, buf, 0); + buf += 8; +#endif } /* Process tail (len < 16). */ return adler32_len_16(adler, buf, len, sum2); diff --git a/internal-complibs/zlib-ng-2.0.7/arch/arm/Makefile.in b/internal-complibs/zlib-ng-2.2.2/arch/arm/Makefile.in similarity index 58% rename from internal-complibs/zlib-ng-2.0.7/arch/arm/Makefile.in rename to internal-complibs/zlib-ng-2.2.2/arch/arm/Makefile.in index d383ba085..b6f0aaf21 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/arm/Makefile.in +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/Makefile.in @@ -10,6 +10,7 @@ SUFFIX= ACLEFLAG= NEONFLAG= +ARMV6FLAG= NOLTOFLAG= SRCDIR=. @@ -18,11 +19,12 @@ TOPDIR=$(SRCTOP) all: \ adler32_neon.o adler32_neon.lo \ - armfeature.o armfeature.lo \ + arm_features.o arm_features.lo \ chunkset_neon.o chunkset_neon.lo \ + compare256_neon.o compare256_neon.lo \ crc32_acle.o crc32_acle.lo \ - slide_neon.o slide_neon.lo \ - insert_string_acle.o insert_string_acle.lo + slide_hash_neon.o slide_hash_neon.lo \ + slide_hash_armv6.o slide_hash_armv6.lo \ adler32_neon.o: $(CC) $(CFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c @@ -30,11 +32,11 @@ adler32_neon.o: adler32_neon.lo: $(CC) $(SFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c -armfeature.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/armfeature.c +arm_features.o: + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/arm_features.c -armfeature.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/armfeature.c +arm_features.lo: + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/arm_features.c chunkset_neon.o: $(CC) $(CFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_neon.c @@ -42,23 +44,29 @@ chunkset_neon.o: chunkset_neon.lo: $(CC) $(SFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_neon.c +compare256_neon.o: + $(CC) $(CFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_neon.c + +compare256_neon.lo: + $(CC) $(SFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_neon.c + crc32_acle.o: $(CC) $(CFLAGS) $(ACLEFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_acle.c crc32_acle.lo: $(CC) $(SFLAGS) $(ACLEFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_acle.c -slide_neon.o: - $(CC) $(CFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_neon.c +slide_hash_neon.o: + $(CC) $(CFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_neon.c -slide_neon.lo: - $(CC) $(SFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_neon.c +slide_hash_neon.lo: + $(CC) $(SFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_neon.c -insert_string_acle.o: - $(CC) $(CFLAGS) $(ACLEFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c +slide_hash_armv6.o: + $(CC) $(CFLAGS) $(ARMV6FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_armv6.c -insert_string_acle.lo: - $(CC) $(SFLAGS) $(ACLEFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c +slide_hash_armv6.lo: + $(CC) $(SFLAGS) $(ARMV6FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_armv6.c mostlyclean: clean clean: @@ -66,5 +74,5 @@ clean: rm -rf objs rm -f *.gcda *.gcno *.gcov -distclean: +distclean: clean rm -f Makefile diff --git a/internal-complibs/zlib-ng-2.2.2/arch/arm/acle_intrins.h b/internal-complibs/zlib-ng-2.2.2/arch/arm/acle_intrins.h new file mode 100644 index 000000000..a67cf3aab --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/acle_intrins.h @@ -0,0 +1,35 @@ +#ifndef ARM_ACLE_INTRINS_H +#define ARM_ACLE_INTRINS_H + +#include +#ifdef _MSC_VER +# include +#elif defined(HAVE_ARM_ACLE_H) +# include +#endif + +#ifdef ARM_ACLE +#if defined(__aarch64__) +# define Z_TARGET_CRC Z_TARGET("+crc") +#else +# define Z_TARGET_CRC +#endif +#endif + +#ifdef ARM_SIMD +#ifdef _MSC_VER +typedef uint32_t uint16x2_t; + +#define __uqsub16 _arm_uqsub16 +#elif !defined(ARM_SIMD_INTRIN) +typedef uint32_t uint16x2_t; + +static inline uint16x2_t __uqsub16(uint16x2_t __a, uint16x2_t __b) { + uint16x2_t __c; + __asm__ __volatile__("uqsub16 %0, %1, %2" : "=r" (__c) : "r"(__a), "r"(__b)); + return __c; +} +#endif +#endif + +#endif // include guard ARM_ACLE_INTRINS_H diff --git a/internal-complibs/zlib-ng-2.2.2/arch/arm/adler32_neon.c b/internal-complibs/zlib-ng-2.2.2/arch/arm/adler32_neon.c new file mode 100644 index 000000000..8e46b3801 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/adler32_neon.c @@ -0,0 +1,215 @@ +/* Copyright (C) 1995-2011, 2016 Mark Adler + * Copyright (C) 2017 ARM Holdings Inc. + * Authors: + * Adenilson Cavalcanti + * Adam Stylinski + * For conditions of distribution and use, see copyright notice in zlib.h + */ +#ifdef ARM_NEON +#include "neon_intrins.h" +#include "zbuild.h" +#include "adler32_p.h" + +static void NEON_accum32(uint32_t *s, const uint8_t *buf, size_t len) { + static const uint16_t ALIGNED_(16) taps[64] = { + 64, 63, 62, 61, 60, 59, 58, 57, + 56, 55, 54, 53, 52, 51, 50, 49, + 48, 47, 46, 45, 44, 43, 42, 41, + 40, 39, 38, 37, 36, 35, 34, 33, + 32, 31, 30, 29, 28, 27, 26, 25, + 24, 23, 22, 21, 20, 19, 18, 17, + 16, 15, 14, 13, 12, 11, 10, 9, + 8, 7, 6, 5, 4, 3, 2, 1 }; + + uint32x4_t adacc = vdupq_n_u32(0); + uint32x4_t s2acc = vdupq_n_u32(0); + uint32x4_t s2acc_0 = vdupq_n_u32(0); + uint32x4_t s2acc_1 = vdupq_n_u32(0); + uint32x4_t s2acc_2 = vdupq_n_u32(0); + + adacc = vsetq_lane_u32(s[0], adacc, 0); + s2acc = vsetq_lane_u32(s[1], s2acc, 0); + + uint32x4_t s3acc = vdupq_n_u32(0); + uint32x4_t adacc_prev = adacc; + + uint16x8_t s2_0, s2_1, s2_2, s2_3; + s2_0 = s2_1 = s2_2 = s2_3 = vdupq_n_u16(0); + + uint16x8_t s2_4, s2_5, s2_6, s2_7; + s2_4 = s2_5 = s2_6 = s2_7 = vdupq_n_u16(0); + + size_t num_iter = len >> 2; + int rem = len & 3; + + for (size_t i = 0; i < num_iter; ++i) { + uint8x16x4_t d0_d3 = vld1q_u8_x4(buf); + + /* Unfortunately it doesn't look like there's a direct sum 8 bit to 32 + * bit instruction, we'll have to make due summing to 16 bits first */ + uint16x8x2_t hsum, hsum_fold; + hsum.val[0] = vpaddlq_u8(d0_d3.val[0]); + hsum.val[1] = vpaddlq_u8(d0_d3.val[1]); + + hsum_fold.val[0] = vpadalq_u8(hsum.val[0], d0_d3.val[2]); + hsum_fold.val[1] = vpadalq_u8(hsum.val[1], d0_d3.val[3]); + + adacc = vpadalq_u16(adacc, hsum_fold.val[0]); + s3acc = vaddq_u32(s3acc, adacc_prev); + adacc = vpadalq_u16(adacc, hsum_fold.val[1]); + + /* If we do straight widening additions to the 16 bit values, we don't incur + * the usual penalties of a pairwise add. We can defer the multiplications + * until the very end. These will not overflow because we are incurring at + * most 408 loop iterations (NMAX / 64), and a given lane is only going to be + * summed into once. This means for the maximum input size, the largest value + * we will see is 255 * 102 = 26010, safely under uint16 max */ + s2_0 = vaddw_u8(s2_0, vget_low_u8(d0_d3.val[0])); + s2_1 = vaddw_high_u8(s2_1, d0_d3.val[0]); + s2_2 = vaddw_u8(s2_2, vget_low_u8(d0_d3.val[1])); + s2_3 = vaddw_high_u8(s2_3, d0_d3.val[1]); + s2_4 = vaddw_u8(s2_4, vget_low_u8(d0_d3.val[2])); + s2_5 = vaddw_high_u8(s2_5, d0_d3.val[2]); + s2_6 = vaddw_u8(s2_6, vget_low_u8(d0_d3.val[3])); + s2_7 = vaddw_high_u8(s2_7, d0_d3.val[3]); + + adacc_prev = adacc; + buf += 64; + } + + s3acc = vshlq_n_u32(s3acc, 6); + + if (rem) { + uint32x4_t s3acc_0 = vdupq_n_u32(0); + while (rem--) { + uint8x16_t d0 = vld1q_u8(buf); + uint16x8_t adler; + adler = vpaddlq_u8(d0); + s2_6 = vaddw_u8(s2_6, vget_low_u8(d0)); + s2_7 = vaddw_high_u8(s2_7, d0); + adacc = vpadalq_u16(adacc, adler); + s3acc_0 = vaddq_u32(s3acc_0, adacc_prev); + adacc_prev = adacc; + buf += 16; + } + + s3acc_0 = vshlq_n_u32(s3acc_0, 4); + s3acc = vaddq_u32(s3acc_0, s3acc); + } + + uint16x8x4_t t0_t3 = vld1q_u16_x4(taps); + uint16x8x4_t t4_t7 = vld1q_u16_x4(taps + 32); + + s2acc = vmlal_high_u16(s2acc, t0_t3.val[0], s2_0); + s2acc_0 = vmlal_u16(s2acc_0, vget_low_u16(t0_t3.val[0]), vget_low_u16(s2_0)); + s2acc_1 = vmlal_high_u16(s2acc_1, t0_t3.val[1], s2_1); + s2acc_2 = vmlal_u16(s2acc_2, vget_low_u16(t0_t3.val[1]), vget_low_u16(s2_1)); + + s2acc = vmlal_high_u16(s2acc, t0_t3.val[2], s2_2); + s2acc_0 = vmlal_u16(s2acc_0, vget_low_u16(t0_t3.val[2]), vget_low_u16(s2_2)); + s2acc_1 = vmlal_high_u16(s2acc_1, t0_t3.val[3], s2_3); + s2acc_2 = vmlal_u16(s2acc_2, vget_low_u16(t0_t3.val[3]), vget_low_u16(s2_3)); + + s2acc = vmlal_high_u16(s2acc, t4_t7.val[0], s2_4); + s2acc_0 = vmlal_u16(s2acc_0, vget_low_u16(t4_t7.val[0]), vget_low_u16(s2_4)); + s2acc_1 = vmlal_high_u16(s2acc_1, t4_t7.val[1], s2_5); + s2acc_2 = vmlal_u16(s2acc_2, vget_low_u16(t4_t7.val[1]), vget_low_u16(s2_5)); + + s2acc = vmlal_high_u16(s2acc, t4_t7.val[2], s2_6); + s2acc_0 = vmlal_u16(s2acc_0, vget_low_u16(t4_t7.val[2]), vget_low_u16(s2_6)); + s2acc_1 = vmlal_high_u16(s2acc_1, t4_t7.val[3], s2_7); + s2acc_2 = vmlal_u16(s2acc_2, vget_low_u16(t4_t7.val[3]), vget_low_u16(s2_7)); + + s2acc = vaddq_u32(s2acc_0, s2acc); + s2acc_2 = vaddq_u32(s2acc_1, s2acc_2); + s2acc = vaddq_u32(s2acc, s2acc_2); + + uint32x2_t adacc2, s2acc2, as; + s2acc = vaddq_u32(s2acc, s3acc); + adacc2 = vpadd_u32(vget_low_u32(adacc), vget_high_u32(adacc)); + s2acc2 = vpadd_u32(vget_low_u32(s2acc), vget_high_u32(s2acc)); + as = vpadd_u32(adacc2, s2acc2); + s[0] = vget_lane_u32(as, 0); + s[1] = vget_lane_u32(as, 1); +} + +static void NEON_handle_tail(uint32_t *pair, const uint8_t *buf, size_t len) { + unsigned int i; + for (i = 0; i < len; ++i) { + pair[0] += buf[i]; + pair[1] += pair[0]; + } +} + +Z_INTERNAL uint32_t adler32_neon(uint32_t adler, const uint8_t *buf, size_t len) { + /* split Adler-32 into component sums */ + uint32_t sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (len == 1) + return adler32_len_1(adler, buf, sum2); + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (buf == NULL) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (len < 16) + return adler32_len_16(adler, buf, len, sum2); + + uint32_t pair[2]; + int n = NMAX; + unsigned int done = 0; + + /* Split Adler-32 into component sums, it can be supplied by + * the caller sites (e.g. in a PNG file). + */ + pair[0] = adler; + pair[1] = sum2; + + /* If memory is not SIMD aligned, do scalar sums to an aligned + * offset, provided that doing so doesn't completely eliminate + * SIMD operation. Aligned loads are still faster on ARM, even + * though there's no explicit aligned load instruction */ + unsigned int align_offset = ((uintptr_t)buf & 15); + unsigned int align_adj = (align_offset) ? 16 - align_offset : 0; + + if (align_offset && len >= (16 + align_adj)) { + NEON_handle_tail(pair, buf, align_adj); + n -= align_adj; + done += align_adj; + + } else { + /* If here, we failed the len criteria test, it wouldn't be + * worthwhile to do scalar aligning sums */ + align_adj = 0; + } + + while (done < len) { + int remaining = (int)(len - done); + n = MIN(remaining, (done == align_adj) ? n : NMAX); + + if (n < 16) + break; + + NEON_accum32(pair, buf + done, n >> 4); + pair[0] %= BASE; + pair[1] %= BASE; + + int actual_nsums = (n >> 4) << 4; + done += actual_nsums; + } + + /* Handle the tail elements. */ + if (done < len) { + NEON_handle_tail(pair, (buf + done), len - done); + pair[0] %= BASE; + pair[1] %= BASE; + } + + /* D = B * 65536 + A, see: https://en.wikipedia.org/wiki/Adler-32. */ + return (pair[1] << 16) | pair[0]; +} + +#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/arm/armfeature.c b/internal-complibs/zlib-ng-2.2.2/arch/arm/arm_features.c similarity index 52% rename from internal-complibs/zlib-ng-2.0.7/arch/arm/armfeature.c rename to internal-complibs/zlib-ng-2.2.2/arch/arm/arm_features.c index 978c98722..d0d49764f 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/arm/armfeature.c +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/arm_features.c @@ -1,6 +1,7 @@ -#include "../../zutil.h" +#include "zbuild.h" +#include "arm_features.h" -#if defined(__linux__) +#if defined(__linux__) && defined(HAVE_SYS_AUXV_H) # include # ifdef ARM_ASM_HWCAP # include @@ -10,13 +11,18 @@ # ifndef ID_AA64ISAR0_CRC32_VAL # define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32 # endif +#elif defined(__OpenBSD__) && defined(__aarch64__) +# include +# include +# include +# include #elif defined(__APPLE__) # if !defined(_DARWIN_C_SOURCE) # define _DARWIN_C_SOURCE /* enable types aliases (eg u_int) */ # endif # include #elif defined(_WIN32) -# include +# include #endif static int arm_has_crc32() { @@ -29,11 +35,23 @@ static int arm_has_crc32() { #elif defined(__FreeBSD__) && defined(__aarch64__) return getenv("QEMU_EMULATING") == NULL && ID_AA64ISAR0_CRC32_VAL(READ_SPECIALREG(id_aa64isar0_el1)) >= ID_AA64ISAR0_CRC32_BASE; +#elif defined(__OpenBSD__) && defined(__aarch64__) + int hascrc32 = 0; + int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 }; + uint64_t isar0 = 0; + size_t len = sizeof(isar0); + if (sysctl(isar0_mib, 2, &isar0, &len, NULL, 0) != -1) { + if (ID_AA64ISAR0_CRC32(isar0) >= ID_AA64ISAR0_CRC32_BASE) + hascrc32 = 1; + } + return hascrc32; #elif defined(__APPLE__) int hascrc32; size_t size = sizeof(hascrc32); return sysctlbyname("hw.optional.armv8_crc32", &hascrc32, &size, NULL, 0) == 0 && hascrc32 == 1; +#elif defined(_WIN32) + return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE); #elif defined(ARM_NOCHECK_ACLE) return 1; #else @@ -42,7 +60,7 @@ static int arm_has_crc32() { } /* AArch64 has neon. */ -#if !defined(__aarch64__) && !defined(_M_ARM64) +#if !defined(__aarch64__) && !defined(_M_ARM64) && !defined(_M_ARM64EC) static inline int arm_has_neon() { #if defined(__linux__) && defined(ARM_AUXV_HAS_NEON) # ifdef HWCAP_ARM_NEON @@ -69,14 +87,29 @@ static inline int arm_has_neon() { } #endif -Z_INTERNAL int arm_cpu_has_neon; -Z_INTERNAL int arm_cpu_has_crc32; +/* AArch64 does not have ARMv6 SIMD. */ +#if !defined(__aarch64__) && !defined(_M_ARM64) && !defined(_M_ARM64EC) +static inline int arm_has_simd() { +#if defined(__linux__) && defined(HAVE_SYS_AUXV_H) + const char *platform = (const char *)getauxval(AT_PLATFORM); + return strncmp(platform, "v6l", 3) == 0 + || strncmp(platform, "v7l", 3) == 0 + || strncmp(platform, "v8l", 3) == 0; +#elif defined(ARM_NOCHECK_SIMD) + return 1; +#else + return 0; +#endif +} +#endif -void Z_INTERNAL arm_check_features(void) { -#if defined(__aarch64__) || defined(_M_ARM64) - arm_cpu_has_neon = 1; /* always available */ +void Z_INTERNAL arm_check_features(struct arm_cpu_features *features) { +#if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) + features->has_simd = 0; /* never available */ + features->has_neon = 1; /* always available */ #else - arm_cpu_has_neon = arm_has_neon(); + features->has_simd = arm_has_simd(); + features->has_neon = arm_has_neon(); #endif - arm_cpu_has_crc32 = arm_has_crc32(); + features->has_crc32 = arm_has_crc32(); } diff --git a/internal-complibs/zlib-ng-2.2.2/arch/arm/arm_features.h b/internal-complibs/zlib-ng-2.2.2/arch/arm/arm_features.h new file mode 100644 index 000000000..d968e02fb --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/arm_features.h @@ -0,0 +1,16 @@ +/* arm_features.h -- check for ARM features. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef ARM_FEATURES_H_ +#define ARM_FEATURES_H_ + +struct arm_cpu_features { + int has_simd; + int has_neon; + int has_crc32; +}; + +void Z_INTERNAL arm_check_features(struct arm_cpu_features *features); + +#endif /* ARM_FEATURES_H_ */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/arm/arm_functions.h b/internal-complibs/zlib-ng-2.2.2/arch/arm/arm_functions.h new file mode 100644 index 000000000..61c682710 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/arm_functions.h @@ -0,0 +1,65 @@ +/* arm_functions.h -- ARM implementations for arch-specific functions. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef ARM_FUNCTIONS_H_ +#define ARM_FUNCTIONS_H_ + +#ifdef ARM_NEON +uint32_t adler32_neon(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t chunksize_neon(void); +uint8_t* chunkmemset_safe_neon(uint8_t *out, unsigned dist, unsigned len, unsigned left); + +# ifdef HAVE_BUILTIN_CTZLL +uint32_t compare256_neon(const uint8_t *src0, const uint8_t *src1); +uint32_t longest_match_neon(deflate_state *const s, Pos cur_match); +uint32_t longest_match_slow_neon(deflate_state *const s, Pos cur_match); +# endif +void slide_hash_neon(deflate_state *s); +void inflate_fast_neon(PREFIX3(stream) *strm, uint32_t start); +#endif + +#ifdef ARM_ACLE +uint32_t crc32_acle(uint32_t crc, const uint8_t *buf, size_t len); +#endif + +#ifdef ARM_SIMD +void slide_hash_armv6(deflate_state *s); +#endif + + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +// ARM - SIMD +# if (defined(ARM_SIMD) && defined(__ARM_FEATURE_SIMD32)) || defined(ARM_NOCHECK_SIMD) +# undef native_slide_hash +# define native_slide_hash slide_hash_armv6 +# endif +// ARM - NEON +# if (defined(ARM_NEON) && (defined(__ARM_NEON__) || defined(__ARM_NEON))) || ARM_NOCHECK_NEON +# undef native_adler32 +# define native_adler32 adler32_neon +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_neon +# undef native_chunksize +# define native_chunksize chunksize_neon +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_neon +# undef native_slide_hash +# define native_slide_hash slide_hash_neon +# ifdef HAVE_BUILTIN_CTZLL +# undef native_compare256 +# define native_compare256 compare256_neon +# undef native_longest_match +# define native_longest_match longest_match_neon +# undef native_longest_match_slow +# define native_longest_match_slow longest_match_slow_neon +# endif +# endif +// ARM - ACLE +# if defined(ARM_ACLE) && defined(__ARM_ACLE) && defined(__ARM_FEATURE_CRC32) +# undef native_crc32 +# define native_crc32 crc32_acle +# endif +#endif + +#endif /* ARM_FUNCTIONS_H_ */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/arm/chunkset_neon.c b/internal-complibs/zlib-ng-2.2.2/arch/arm/chunkset_neon.c new file mode 100644 index 000000000..0016f7f22 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/chunkset_neon.c @@ -0,0 +1,101 @@ +/* chunkset_neon.c -- NEON inline functions to copy small data chunks. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef ARM_NEON +#include "neon_intrins.h" +#include "zbuild.h" +#include "arch/generic/chunk_permute_table.h" + +typedef uint8x16_t chunk_t; + +#define CHUNK_SIZE 16 + +#define HAVE_CHUNKMEMSET_2 +#define HAVE_CHUNKMEMSET_4 +#define HAVE_CHUNKMEMSET_8 +#define HAVE_CHUNK_MAG + +static const lut_rem_pair perm_idx_lut[13] = { + {0, 1}, /* 3 */ + {0, 0}, /* don't care */ + {1 * 32, 1}, /* 5 */ + {2 * 32, 4}, /* 6 */ + {3 * 32, 2}, /* 7 */ + {0 * 32, 0}, /* don't care */ + {4 * 32, 7}, /* 9 */ + {5 * 32, 6}, /* 10 */ + {6 * 32, 5}, /* 11 */ + {7 * 32, 4}, /* 12 */ + {8 * 32, 3}, /* 13 */ + {9 * 32, 2}, /* 14 */ + {10 * 32, 1},/* 15 */ +}; + +static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { + uint16_t tmp; + memcpy(&tmp, from, sizeof(tmp)); + *chunk = vreinterpretq_u8_u16(vdupq_n_u16(tmp)); +} + +static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { + uint32_t tmp; + memcpy(&tmp, from, sizeof(tmp)); + *chunk = vreinterpretq_u8_u32(vdupq_n_u32(tmp)); +} + +static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { + uint64_t tmp; + memcpy(&tmp, from, sizeof(tmp)); + *chunk = vreinterpretq_u8_u64(vdupq_n_u64(tmp)); +} + +#define CHUNKSIZE chunksize_neon +#define CHUNKCOPY chunkcopy_neon +#define CHUNKUNROLL chunkunroll_neon +#define CHUNKMEMSET chunkmemset_neon +#define CHUNKMEMSET_SAFE chunkmemset_safe_neon + +static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { + *chunk = vld1q_u8(s); +} + +static inline void storechunk(uint8_t *out, chunk_t *chunk) { + vst1q_u8(out, *chunk); +} + +static inline chunk_t GET_CHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) { + lut_rem_pair lut_rem = perm_idx_lut[dist - 3]; + *chunk_rem = lut_rem.remval; + + /* See note in chunkset_ssse3.c for why this is ok */ + __msan_unpoison(buf + dist, 16 - dist); + + /* This version of table is only available on aarch64 */ +#if defined(_M_ARM64) || defined(_M_ARM64EC) || defined(__aarch64__) + uint8x16_t ret_vec = vld1q_u8(buf); + + uint8x16_t perm_vec = vld1q_u8(permute_table + lut_rem.idx); + return vqtbl1q_u8(ret_vec, perm_vec); +#else + uint8x8_t ret0, ret1, a, b, perm_vec0, perm_vec1; + perm_vec0 = vld1_u8(permute_table + lut_rem.idx); + perm_vec1 = vld1_u8(permute_table + lut_rem.idx + 8); + a = vld1_u8(buf); + b = vld1_u8(buf + 8); + ret0 = vtbl1_u8(a, perm_vec0); + uint8x8x2_t ab; + ab.val[0] = a; + ab.val[1] = b; + ret1 = vtbl2_u8(ab, perm_vec1); + return vcombine_u8(ret0, ret1); +#endif +} + +#include "chunkset_tpl.h" + +#define INFLATE_FAST inflate_fast_neon + +#include "inffast_tpl.h" + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/arm/compare256_neon.c b/internal-complibs/zlib-ng-2.2.2/arch/arm/compare256_neon.c new file mode 100644 index 000000000..87d14c89c --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/compare256_neon.c @@ -0,0 +1,60 @@ +/* compare256_neon.c - NEON version of compare256 + * Copyright (C) 2022 Nathan Moinvaziri + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" +#include "fallback_builtins.h" + +#if defined(ARM_NEON) && defined(HAVE_BUILTIN_CTZLL) +#include "neon_intrins.h" + +static inline uint32_t compare256_neon_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + + do { + uint8x16_t a, b, cmp; + uint64_t lane; + + a = vld1q_u8(src0); + b = vld1q_u8(src1); + + cmp = veorq_u8(a, b); + + lane = vgetq_lane_u64(vreinterpretq_u64_u8(cmp), 0); + if (lane) { + uint32_t match_byte = (uint32_t)__builtin_ctzll(lane) / 8; + return len + match_byte; + } + len += 8; + lane = vgetq_lane_u64(vreinterpretq_u64_u8(cmp), 1); + if (lane) { + uint32_t match_byte = (uint32_t)__builtin_ctzll(lane) / 8; + return len + match_byte; + } + len += 8; + + src0 += 16, src1 += 16; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_neon(const uint8_t *src0, const uint8_t *src1) { + return compare256_neon_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_neon +#define COMPARE256 compare256_neon_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_neon +#define COMPARE256 compare256_neon_static + +#include "match_tpl.h" + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/arm/crc32_acle.c b/internal-complibs/zlib-ng-2.2.2/arch/arm/crc32_acle.c new file mode 100644 index 000000000..116bcab1c --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/crc32_acle.c @@ -0,0 +1,78 @@ +/* crc32_acle.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler + * Copyright (C) 2016 Yang Zhang + * For conditions of distribution and use, see copyright notice in zlib.h + * +*/ + +#ifdef ARM_ACLE +#include "acle_intrins.h" +#include "zbuild.h" + +Z_INTERNAL Z_TARGET_CRC uint32_t crc32_acle(uint32_t crc, const uint8_t *buf, size_t len) { + Z_REGISTER uint32_t c; + Z_REGISTER const uint16_t *buf2; + Z_REGISTER const uint32_t *buf4; + Z_REGISTER const uint64_t *buf8; + + c = ~crc; + + if (UNLIKELY(len == 1)) { + c = __crc32b(c, *buf); + c = ~c; + return c; + } + + if ((ptrdiff_t)buf & (sizeof(uint64_t) - 1)) { + if (len && ((ptrdiff_t)buf & 1)) { + c = __crc32b(c, *buf++); + len--; + } + + if ((len >= sizeof(uint16_t)) && ((ptrdiff_t)buf & sizeof(uint16_t))) { + buf2 = (const uint16_t *) buf; + c = __crc32h(c, *buf2++); + len -= sizeof(uint16_t); + buf4 = (const uint32_t *) buf2; + } else { + buf4 = (const uint32_t *) buf; + } + + if ((len >= sizeof(uint32_t)) && ((ptrdiff_t)buf & sizeof(uint32_t))) { + c = __crc32w(c, *buf4++); + len -= sizeof(uint32_t); + } + + buf8 = (const uint64_t *) buf4; + } else { + buf8 = (const uint64_t *) buf; + } + + while (len >= sizeof(uint64_t)) { + c = __crc32d(c, *buf8++); + len -= sizeof(uint64_t); + } + + if (len >= sizeof(uint32_t)) { + buf4 = (const uint32_t *) buf8; + c = __crc32w(c, *buf4++); + len -= sizeof(uint32_t); + buf2 = (const uint16_t *) buf4; + } else { + buf2 = (const uint16_t *) buf8; + } + + if (len >= sizeof(uint16_t)) { + c = __crc32h(c, *buf2++); + len -= sizeof(uint16_t); + } + + buf = (const unsigned char *) buf2; + if (len) { + c = __crc32b(c, *buf); + } + + c = ~c; + return c; +} +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/arm/neon_intrins.h b/internal-complibs/zlib-ng-2.2.2/arch/arm/neon_intrins.h new file mode 100644 index 000000000..5dc242d52 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/neon_intrins.h @@ -0,0 +1,65 @@ +#ifndef ARM_NEON_INTRINS_H +#define ARM_NEON_INTRINS_H + +#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC)) +/* arm64_neon.h is MSVC specific */ +# include +#else +# include +#endif + +#if defined(ARM_NEON) && !defined(__aarch64__) && !defined(_M_ARM64) && !defined(_M_ARM64EC) +/* Compatibility shim for the _high family of functions */ +#define vmull_high_u8(a, b) vmull_u8(vget_high_u8(a), vget_high_u8(b)) +#define vmlal_high_u8(a, b, c) vmlal_u8(a, vget_high_u8(b), vget_high_u8(c)) +#define vmlal_high_u16(a, b, c) vmlal_u16(a, vget_high_u16(b), vget_high_u16(c)) +#define vaddw_high_u8(a, b) vaddw_u8(a, vget_high_u8(b)) +#endif + +#ifdef ARM_NEON + +#define vqsubq_u16_x4_x1(out, a, b) do { \ + out.val[0] = vqsubq_u16(a.val[0], b); \ + out.val[1] = vqsubq_u16(a.val[1], b); \ + out.val[2] = vqsubq_u16(a.val[2], b); \ + out.val[3] = vqsubq_u16(a.val[3], b); \ +} while (0) + +# if defined(__clang__) && defined(__arm__) && defined(__ANDROID__) +/* Clang for 32-bit Android has too strict alignment requirement (:256) for x4 NEON intrinsics */ +# undef ARM_NEON_HASLD4 +# undef vld1q_u16_x4 +# undef vld1q_u8_x4 +# undef vst1q_u16_x4 +# endif + +# ifndef ARM_NEON_HASLD4 + +static inline uint16x8x4_t vld1q_u16_x4(uint16_t const *a) { + uint16x8x4_t ret; + ret.val[0] = vld1q_u16(a); + ret.val[1] = vld1q_u16(a+8); + ret.val[2] = vld1q_u16(a+16); + ret.val[3] = vld1q_u16(a+24); + return ret; +} + +static inline uint8x16x4_t vld1q_u8_x4(uint8_t const *a) { + uint8x16x4_t ret; + ret.val[0] = vld1q_u8(a); + ret.val[1] = vld1q_u8(a+16); + ret.val[2] = vld1q_u8(a+32); + ret.val[3] = vld1q_u8(a+48); + return ret; +} + +static inline void vst1q_u16_x4(uint16_t *p, uint16x8x4_t a) { + vst1q_u16(p, a.val[0]); + vst1q_u16(p + 8, a.val[1]); + vst1q_u16(p + 16, a.val[2]); + vst1q_u16(p + 24, a.val[3]); +} +# endif // HASLD4 check +#endif + +#endif // include guard ARM_NEON_INTRINS_H diff --git a/internal-complibs/zlib-ng-2.2.2/arch/arm/slide_hash_armv6.c b/internal-complibs/zlib-ng-2.2.2/arch/arm/slide_hash_armv6.c new file mode 100644 index 000000000..da4f51e0a --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/slide_hash_armv6.c @@ -0,0 +1,48 @@ +/* slide_hash_armv6.c -- Optimized hash table shifting for ARMv6 with support for SIMD instructions + * Copyright (C) 2023 Cameron Cawley + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#if defined(ARM_SIMD) +#include "acle_intrins.h" +#include "zbuild.h" +#include "deflate.h" + +/* SIMD version of hash_chain rebase */ +static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize) { + Z_REGISTER uint16x2_t v; + uint16x2_t p0, p1, p2, p3; + Z_REGISTER size_t n; + + size_t size = entries*sizeof(table[0]); + Assert((size % (sizeof(uint16x2_t) * 4) == 0), "hash table size err"); + + Assert(sizeof(Pos) == 2, "Wrong Pos size"); + v = wsize | (wsize << 16); + + n = size / (sizeof(uint16x2_t) * 4); + do { + p0 = *((const uint16x2_t *)(table)); + p1 = *((const uint16x2_t *)(table+2)); + p2 = *((const uint16x2_t *)(table+4)); + p3 = *((const uint16x2_t *)(table+6)); + p0 = __uqsub16(p0, v); + p1 = __uqsub16(p1, v); + p2 = __uqsub16(p2, v); + p3 = __uqsub16(p3, v); + *((uint16x2_t *)(table)) = p0; + *((uint16x2_t *)(table+2)) = p1; + *((uint16x2_t *)(table+4)) = p2; + *((uint16x2_t *)(table+6)) = p3; + table += 8; + } while (--n); +} + +Z_INTERNAL void slide_hash_armv6(deflate_state *s) { + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); + uint16_t wsize = (uint16_t)s->w_size; + + slide_hash_chain(s->head, HASH_SIZE, wsize); + slide_hash_chain(s->prev, wsize, wsize); +} +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/arm/slide_hash_neon.c b/internal-complibs/zlib-ng-2.2.2/arch/arm/slide_hash_neon.c new file mode 100644 index 000000000..f319f9879 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/arm/slide_hash_neon.c @@ -0,0 +1,47 @@ +/* slide_hash_neon.c -- Optimized hash table shifting for ARM with support for NEON instructions + * Copyright (C) 2017-2020 Mika T. Lindqvist + * + * Authors: + * Mika T. Lindqvist + * Jun He + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef ARM_NEON +#include "neon_intrins.h" +#include "zbuild.h" +#include "deflate.h" + +/* SIMD version of hash_chain rebase */ +static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize) { + Z_REGISTER uint16x8_t v; + uint16x8x4_t p0, p1; + Z_REGISTER size_t n; + + size_t size = entries*sizeof(table[0]); + Assert((size % sizeof(uint16x8_t) * 8 == 0), "hash table size err"); + + Assert(sizeof(Pos) == 2, "Wrong Pos size"); + v = vdupq_n_u16(wsize); + + n = size / (sizeof(uint16x8_t) * 8); + do { + p0 = vld1q_u16_x4(table); + p1 = vld1q_u16_x4(table+32); + vqsubq_u16_x4_x1(p0, p0, v); + vqsubq_u16_x4_x1(p1, p1, v); + vst1q_u16_x4(table, p0); + vst1q_u16_x4(table+32, p1); + table += 64; + } while (--n); +} + +Z_INTERNAL void slide_hash_neon(deflate_state *s) { + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); + uint16_t wsize = (uint16_t)s->w_size; + + slide_hash_chain(s->head, HASH_SIZE, wsize); + slide_hash_chain(s->prev, wsize, wsize); +} +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/generic/Makefile.in b/internal-complibs/zlib-ng-2.2.2/arch/generic/Makefile.in new file mode 100644 index 000000000..32c8242d0 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/generic/Makefile.in @@ -0,0 +1,75 @@ +# Makefile for zlib-ng +# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler +# Copyright (C) 2024 Hans Kristian Rosbach +# For conditions of distribution and use, see copyright notice in zlib.h + +CC= +CFLAGS= +SFLAGS= +INCLUDES= + +SRCDIR=. +SRCTOP=../.. +TOPDIR=$(SRCTOP) + +all: \ + adler32_c.o adler32_c.lo \ + adler32_fold_c.o adler32_fold_c.lo \ + chunkset_c.o chunkset_c.lo \ + compare256_c.o compare256_c.lo \ + crc32_braid_c.o crc32_braid_c.lo \ + crc32_fold_c.o crc32_fold_c.lo \ + slide_hash_c.o slide_hash_c.lo + + +adler32_c.o: $(SRCDIR)/adler32_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/adler32_p.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_c.c + +adler32_c.lo: $(SRCDIR)/adler32_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/adler32_p.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_c.c + +adler32_fold_c.o: $(SRCDIR)/adler32_fold_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/functable.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_fold_c.c + +adler32_fold_c.lo: $(SRCDIR)/adler32_fold_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/functable.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_fold_c.c + +chunkset_c.o: $(SRCDIR)/chunkset_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/chunkset_tpl.h $(SRCTOP)/inffast_tpl.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_c.c + +chunkset_c.lo: $(SRCDIR)/chunkset_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/chunkset_tpl.h $(SRCTOP)/inffast_tpl.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_c.c + +compare256_c.o: $(SRCDIR)/compare256_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/zutil_p.h $(SRCTOP)/deflate.h $(SRCTOP)/fallback_builtins.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_c.c + +compare256_c.lo: $(SRCDIR)/compare256_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/zutil_p.h $(SRCTOP)/deflate.h $(SRCTOP)/fallback_builtins.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_c.c + +crc32_braid_c.o: $(SRCDIR)/crc32_braid_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/crc32_braid_p.h $(SRCTOP)/crc32_braid_tbl.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_braid_c.c + +crc32_braid_c.lo: $(SRCDIR)/crc32_braid_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/crc32_braid_p.h $(SRCTOP)/crc32_braid_tbl.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_braid_c.c + +crc32_fold_c.o: $(SRCDIR)/crc32_fold_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/functable.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_fold_c.c + +crc32_fold_c.lo: $(SRCDIR)/crc32_fold_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/functable.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_fold_c.c + +slide_hash_c.o: $(SRCDIR)/slide_hash_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/deflate.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_c.c + +slide_hash_c.lo: $(SRCDIR)/slide_hash_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/deflate.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_c.c + + +mostlyclean: clean +clean: + rm -f *.o *.lo *~ + rm -rf objs + rm -f *.gcda *.gcno *.gcov + +distclean: clean + rm -f Makefile diff --git a/internal-complibs/zlib-ng-2.2.2/arch/generic/adler32_c.c b/internal-complibs/zlib-ng-2.2.2/arch/generic/adler32_c.c new file mode 100644 index 000000000..64258c89b --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/generic/adler32_c.c @@ -0,0 +1,54 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2011, 2016 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "functable.h" +#include "adler32_p.h" + +/* ========================================================================= */ +Z_INTERNAL uint32_t adler32_c(uint32_t adler, const uint8_t *buf, size_t len) { + uint32_t sum2; + unsigned n; + + /* split Adler-32 into component sums */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (UNLIKELY(len == 1)) + return adler32_len_1(adler, buf, sum2); + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (UNLIKELY(buf == NULL)) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (UNLIKELY(len < 16)) + return adler32_len_16(adler, buf, len, sum2); + + /* do length NMAX blocks -- requires just one modulo operation */ + while (len >= NMAX) { + len -= NMAX; +#ifdef UNROLL_MORE + n = NMAX / 16; /* NMAX is divisible by 16 */ +#else + n = NMAX / 8; /* NMAX is divisible by 8 */ +#endif + do { +#ifdef UNROLL_MORE + DO16(adler, sum2, buf); /* 16 sums unrolled */ + buf += 16; +#else + DO8(adler, sum2, buf, 0); /* 8 sums unrolled */ + buf += 8; +#endif + } while (--n); + adler %= BASE; + sum2 %= BASE; + } + + /* do remaining bytes (less than NMAX, still just one modulo) */ + return adler32_len_64(adler, buf, len, sum2); +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/generic/adler32_fold_c.c b/internal-complibs/zlib-ng-2.2.2/arch/generic/adler32_fold_c.c new file mode 100644 index 000000000..397dd1040 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/generic/adler32_fold_c.c @@ -0,0 +1,15 @@ +/* adler32_fold.c -- adler32 folding interface + * Copyright (C) 2022 Adam Stylinski + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "functable.h" + +#include + +Z_INTERNAL uint32_t adler32_fold_copy_c(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) { + adler = FUNCTABLE_CALL(adler32)(adler, src, len); + memcpy(dst, src, len); + return adler; +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/generic/chunk_permute_table.h b/internal-complibs/zlib-ng-2.2.2/arch/generic/chunk_permute_table.h new file mode 100644 index 000000000..bad66ccc7 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/generic/chunk_permute_table.h @@ -0,0 +1,53 @@ +/* chunk_permute_table.h - shared AVX/SSSE3 permutation table for use with chunkmemset family of functions. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef CHUNK_PERMUTE_TABLE_H_ +#define CHUNK_PERMUTE_TABLE_H_ + +#include "zbuild.h" + +/* Need entries for all numbers not an even modulus for 1, 2, 4, 8, 16 & 32 */ +static const ALIGNED_(32) uint8_t permute_table[26*32] = { + 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, /* dist 3 */ + 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, /* dist 5 */ + 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, /* dist 6 */ + 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, /* dist 7 */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, /* dist 9 */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, /* dist 10 */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* dist 11 */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, /* dist 12 */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 2, 3, 4, 5, /* dist 13 */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 1, 2, 3, /* dist 14 */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, /* dist 15 */ + + /* Beyond dists of 15 means we have to permute from a vector > len(m128i). Because AVX couldn't permute + * beyond 128 bit lanes until AVX512 for sub 4-byte sequences, we have to do some math here for an eventual + * blend with a comparison. That means we need to wrap the indices with yet another derived table. For simplicity, + * we'll use absolute indexing here to derive a blend vector. This is actually a lot simpler with ARM's TBL, but, + * this is what we're dealt. + */ + + 16, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, /* dist 17 */ + 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, /* dist 18 */ + 16, 17, 18, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, /* dist 19 */ + 16, 17, 18, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, /* dist 20 */ + 16, 17, 18, 19, 20, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, /* dist 21 */ + 16, 17, 18, 19, 20, 21, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* dist 22 */ + 16, 17, 18, 19, 20, 21, 22, 0, 1, 2, 3, 4, 5, 6, 7, 8, /* dist 23 */ + 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7, /* dist 24 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 1, 2, 3, 4, 5, 6, /* dist 25 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 1, 2, 3, 4, 5, /* dist 26 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 1, 2, 3, 4, /* dist 27 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 0, 1, 2, 3, /* dist 28 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 0, 1, 2, /* dist 29 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 1, /* dist 30 */ + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 0, /* dist 31 */ +}; + +typedef struct lut_rem_pair_s { + uint16_t idx; + uint16_t remval; +} lut_rem_pair; + +#endif diff --git a/internal-complibs/zlib-ng-2.0.7/chunkset.c b/internal-complibs/zlib-ng-2.2.2/arch/generic/chunkset_c.c similarity index 78% rename from internal-complibs/zlib-ng-2.0.7/chunkset.c rename to internal-complibs/zlib-ng-2.2.2/arch/generic/chunkset_c.c index 59e30fc13..7b2bb7ba3 100644 --- a/internal-complibs/zlib-ng-2.0.7/chunkset.c +++ b/internal-complibs/zlib-ng-2.2.2/arch/generic/chunkset_c.c @@ -3,16 +3,8 @@ */ #include "zbuild.h" -#include "zutil.h" -// We need sizeof(chunk_t) to be 8, no matter what. -#if defined(UNALIGNED64_OK) typedef uint64_t chunk_t; -#elif defined(UNALIGNED_OK) -typedef struct chunk_t { uint32_t u32[2]; } chunk_t; -#else -typedef struct chunk_t { uint8_t u8[8]; } chunk_t; -#endif #define CHUNK_SIZE 8 @@ -39,9 +31,12 @@ static inline void storechunk(uint8_t *out, chunk_t *chunk) { #define CHUNKSIZE chunksize_c #define CHUNKCOPY chunkcopy_c -#define CHUNKCOPY_SAFE chunkcopy_safe_c #define CHUNKUNROLL chunkunroll_c #define CHUNKMEMSET chunkmemset_c #define CHUNKMEMSET_SAFE chunkmemset_safe_c #include "chunkset_tpl.h" + +#define INFLATE_FAST inflate_fast_c + +#include "inffast_tpl.h" diff --git a/internal-complibs/zlib-ng-2.2.2/arch/generic/compare256_c.c b/internal-complibs/zlib-ng-2.2.2/arch/generic/compare256_c.c new file mode 100644 index 000000000..0c12cb3a4 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/generic/compare256_c.c @@ -0,0 +1,181 @@ +/* compare256.c -- 256 byte memory comparison with match length return + * Copyright (C) 2020 Nathan Moinvaziri + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" +#include "fallback_builtins.h" + +/* ALIGNED, byte comparison */ +static inline uint32_t compare256_c_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + + do { + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1) { + return compare256_c_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_c +#define COMPARE256 compare256_c_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_c +#define COMPARE256 compare256_c_static + +#include "match_tpl.h" + +#if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN +/* 16-bit unaligned integer comparison */ +static inline uint32_t compare256_unaligned_16_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + + do { + if (zng_memcmp_2(src0, src1) != 0) + return len + (*src0 == *src1); + src0 += 2, src1 += 2, len += 2; + + if (zng_memcmp_2(src0, src1) != 0) + return len + (*src0 == *src1); + src0 += 2, src1 += 2, len += 2; + + if (zng_memcmp_2(src0, src1) != 0) + return len + (*src0 == *src1); + src0 += 2, src1 += 2, len += 2; + + if (zng_memcmp_2(src0, src1) != 0) + return len + (*src0 == *src1); + src0 += 2, src1 += 2, len += 2; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_unaligned_16(const uint8_t *src0, const uint8_t *src1) { + return compare256_unaligned_16_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_unaligned_16 +#define COMPARE256 compare256_unaligned_16_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_unaligned_16 +#define COMPARE256 compare256_unaligned_16_static + +#include "match_tpl.h" + +#ifdef HAVE_BUILTIN_CTZ +/* 32-bit unaligned integer comparison */ +static inline uint32_t compare256_unaligned_32_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + + do { + uint32_t sv, mv, diff; + + memcpy(&sv, src0, sizeof(sv)); + memcpy(&mv, src1, sizeof(mv)); + + diff = sv ^ mv; + if (diff) { + uint32_t match_byte = __builtin_ctz(diff) / 8; + return len + match_byte; + } + + src0 += 4, src1 += 4, len += 4; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_unaligned_32(const uint8_t *src0, const uint8_t *src1) { + return compare256_unaligned_32_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_unaligned_32 +#define COMPARE256 compare256_unaligned_32_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_unaligned_32 +#define COMPARE256 compare256_unaligned_32_static + +#include "match_tpl.h" + +#endif + +#if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) +/* UNALIGNED64_OK, 64-bit integer comparison */ +static inline uint32_t compare256_unaligned_64_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + + do { + uint64_t sv, mv, diff; + + memcpy(&sv, src0, sizeof(sv)); + memcpy(&mv, src1, sizeof(mv)); + + diff = sv ^ mv; + if (diff) { + uint64_t match_byte = __builtin_ctzll(diff) / 8; + return len + (uint32_t)match_byte; + } + + src0 += 8, src1 += 8, len += 8; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_unaligned_64(const uint8_t *src0, const uint8_t *src1) { + return compare256_unaligned_64_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_unaligned_64 +#define COMPARE256 compare256_unaligned_64_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_unaligned_64 +#define COMPARE256 compare256_unaligned_64_static + +#include "match_tpl.h" + +#endif + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/generic/crc32_braid_c.c b/internal-complibs/zlib-ng-2.2.2/arch/generic/crc32_braid_c.c new file mode 100644 index 000000000..f80071042 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/generic/crc32_braid_c.c @@ -0,0 +1,216 @@ +/* crc32_braid.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2022 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * This interleaved implementation of a CRC makes use of pipelined multiple + * arithmetic-logic units, commonly found in modern CPU cores. It is due to + * Kadatch and Jenkins (2010). See doc/crc-doc.1.0.pdf in this distribution. + */ + +#include "zbuild.h" +#include "crc32_braid_p.h" +#include "crc32_braid_tbl.h" + +/* + A CRC of a message is computed on N braids of words in the message, where + each word consists of W bytes (4 or 8). If N is 3, for example, then three + running sparse CRCs are calculated respectively on each braid, at these + indices in the array of words: 0, 3, 6, ..., 1, 4, 7, ..., and 2, 5, 8, ... + This is done starting at a word boundary, and continues until as many blocks + of N * W bytes as are available have been processed. The results are combined + into a single CRC at the end. For this code, N must be in the range 1..6 and + W must be 4 or 8. The upper limit on N can be increased if desired by adding + more #if blocks, extending the patterns apparent in the code. In addition, + crc32 tables would need to be regenerated, if the maximum N value is increased. + + N and W are chosen empirically by benchmarking the execution time on a given + processor. The choices for N and W below were based on testing on Intel Kaby + Lake i7, AMD Ryzen 7, ARM Cortex-A57, Sparc64-VII, PowerPC POWER9, and MIPS64 + Octeon II processors. The Intel, AMD, and ARM processors were all fastest + with N=5, W=8. The Sparc, PowerPC, and MIPS64 were all fastest at N=5, W=4. + They were all tested with either gcc or clang, all using the -O3 optimization + level. Your mileage may vary. +*/ + +/* ========================================================================= */ +#ifdef W +/* + Return the CRC of the W bytes in the word_t data, taking the + least-significant byte of the word as the first byte of data, without any pre + or post conditioning. This is used to combine the CRCs of each braid. + */ +#if BYTE_ORDER == LITTLE_ENDIAN +static uint32_t crc_word(z_word_t data) { + int k; + for (k = 0; k < W; k++) + data = (data >> 8) ^ crc_table[data & 0xff]; + return (uint32_t)data; +} +#elif BYTE_ORDER == BIG_ENDIAN +static z_word_t crc_word(z_word_t data) { + int k; + for (k = 0; k < W; k++) + data = (data << 8) ^ + crc_big_table[(data >> ((W - 1) << 3)) & 0xff]; + return data; +} +#endif /* BYTE_ORDER */ + +#endif /* W */ + +/* ========================================================================= */ +Z_INTERNAL uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, size_t len) { + uint32_t c; + + /* Pre-condition the CRC */ + c = (~crc) & 0xffffffff; + +#ifdef W + /* If provided enough bytes, do a braided CRC calculation. */ + if (len >= N * W + W - 1) { + size_t blks; + z_word_t const *words; + int k; + + /* Compute the CRC up to a z_word_t boundary. */ + while (len && ((uintptr_t)buf & (W - 1)) != 0) { + len--; + DO1; + } + + /* Compute the CRC on as many N z_word_t blocks as are available. */ + blks = len / (N * W); + len -= blks * N * W; + words = (z_word_t const *)buf; + + z_word_t crc0, word0, comb; +#if N > 1 + z_word_t crc1, word1; +#if N > 2 + z_word_t crc2, word2; +#if N > 3 + z_word_t crc3, word3; +#if N > 4 + z_word_t crc4, word4; +#if N > 5 + z_word_t crc5, word5; +#endif +#endif +#endif +#endif +#endif + /* Initialize the CRC for each braid. */ + crc0 = ZSWAPWORD(c); +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif + /* Process the first blks-1 blocks, computing the CRCs on each braid independently. */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should get unrolled. */ + crc0 = BRAID_TABLE[0][word0 & 0xff]; +#if N > 1 + crc1 = BRAID_TABLE[0][word1 & 0xff]; +#if N > 2 + crc2 = BRAID_TABLE[0][word2 & 0xff]; +#if N > 3 + crc3 = BRAID_TABLE[0][word3 & 0xff]; +#if N > 4 + crc4 = BRAID_TABLE[0][word4 & 0xff]; +#if N > 5 + crc5 = BRAID_TABLE[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= BRAID_TABLE[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= BRAID_TABLE[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= BRAID_TABLE[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= BRAID_TABLE[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= BRAID_TABLE[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= BRAID_TABLE[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } + + /* Process the last block, combining the CRCs of the N braids at the same time. */ + comb = crc_word(crc0 ^ words[0]); +#if N > 1 + comb = crc_word(crc1 ^ words[1] ^ comb); +#if N > 2 + comb = crc_word(crc2 ^ words[2] ^ comb); +#if N > 3 + comb = crc_word(crc3 ^ words[3] ^ comb); +#if N > 4 + comb = crc_word(crc4 ^ words[4] ^ comb); +#if N > 5 + comb = crc_word(crc5 ^ words[5] ^ comb); +#endif +#endif +#endif +#endif +#endif + words += N; + Assert(comb <= UINT32_MAX, "comb should fit in uint32_t"); + c = (uint32_t)ZSWAPWORD(comb); + + /* Update the pointer to the remaining bytes to process. */ + buf = (const unsigned char *)words; + } + +#endif /* W */ + + /* Complete the computation of the CRC on any remaining bytes. */ + while (len >= 8) { + len -= 8; + DO8; + } + while (len) { + len--; + DO1; + } + + /* Return the CRC, post-conditioned. */ + return c ^ 0xffffffff; +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/generic/crc32_fold_c.c b/internal-complibs/zlib-ng-2.2.2/arch/generic/crc32_fold_c.c new file mode 100644 index 000000000..43930e97c --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/generic/crc32_fold_c.c @@ -0,0 +1,31 @@ +/* crc32_fold.c -- crc32 folding interface + * Copyright (C) 2021 Nathan Moinvaziri + * For conditions of distribution and use, see copyright notice in zlib.h + */ +#include "zbuild.h" +#include "zutil.h" +#include "functable.h" +#include "crc32.h" + +Z_INTERNAL uint32_t crc32_fold_reset_c(crc32_fold *crc) { + crc->value = CRC32_INITIAL_VALUE; + return crc->value; +} + +Z_INTERNAL void crc32_fold_copy_c(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len) { + crc->value = FUNCTABLE_CALL(crc32)(crc->value, src, len); + memcpy(dst, src, len); +} + +Z_INTERNAL void crc32_fold_c(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc) { + /* Note: while this is basically the same thing as the vanilla CRC function, we still need + * a functable entry for it so that we can generically dispatch to this function with the + * same arguments for the versions that _do_ do a folding CRC but we don't want a copy. The + * init_crc is an unused argument in this context */ + Z_UNUSED(init_crc); + crc->value = FUNCTABLE_CALL(crc32)(crc->value, src, len); +} + +Z_INTERNAL uint32_t crc32_fold_final_c(crc32_fold *crc) { + return crc->value; +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/generic/generic_functions.h b/internal-complibs/zlib-ng-2.2.2/arch/generic/generic_functions.h new file mode 100644 index 000000000..997dd4d01 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/generic/generic_functions.h @@ -0,0 +1,106 @@ +/* generic_functions.h -- generic C implementations for arch-specific functions. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef GENERIC_FUNCTIONS_H_ +#define GENERIC_FUNCTIONS_H_ + +#include "zendian.h" + +Z_INTERNAL uint32_t crc32_fold_reset_c(crc32_fold *crc); +Z_INTERNAL void crc32_fold_copy_c(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len); +Z_INTERNAL void crc32_fold_c(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc); +Z_INTERNAL uint32_t crc32_fold_final_c(crc32_fold *crc); + +Z_INTERNAL uint32_t adler32_fold_copy_c(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); + + +typedef uint32_t (*adler32_func)(uint32_t adler, const uint8_t *buf, size_t len); +typedef uint32_t (*compare256_func)(const uint8_t *src0, const uint8_t *src1); +typedef uint32_t (*crc32_func)(uint32_t crc32, const uint8_t *buf, size_t len); + +uint32_t adler32_c(uint32_t adler, const uint8_t *buf, size_t len); + +uint32_t chunksize_c(void); +uint8_t* chunkmemset_safe_c(uint8_t *out, unsigned dist, unsigned len, unsigned left); +void inflate_fast_c(PREFIX3(stream) *strm, uint32_t start); + +uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, size_t len); + +uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1); +#if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN +uint32_t compare256_unaligned_16(const uint8_t *src0, const uint8_t *src1); +# ifdef HAVE_BUILTIN_CTZ + uint32_t compare256_unaligned_32(const uint8_t *src0, const uint8_t *src1); +# endif +# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) + uint32_t compare256_unaligned_64(const uint8_t *src0, const uint8_t *src1); +# endif +#endif + +typedef void (*slide_hash_func)(deflate_state *s); + +void slide_hash_c(deflate_state *s); + +uint32_t longest_match_c(deflate_state *const s, Pos cur_match); +# if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN + uint32_t longest_match_unaligned_16(deflate_state *const s, Pos cur_match); +# ifdef HAVE_BUILTIN_CTZ + uint32_t longest_match_unaligned_32(deflate_state *const s, Pos cur_match); +# endif +# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) + uint32_t longest_match_unaligned_64(deflate_state *const s, Pos cur_match); +# endif +# endif + +uint32_t longest_match_slow_c(deflate_state *const s, Pos cur_match); +# if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN + uint32_t longest_match_slow_unaligned_16(deflate_state *const s, Pos cur_match); + uint32_t longest_match_slow_unaligned_32(deflate_state *const s, Pos cur_match); +# ifdef UNALIGNED64_OK + uint32_t longest_match_slow_unaligned_64(deflate_state *const s, Pos cur_match); +# endif +# endif + + +// Select generic implementation for longest_match, longest_match_slow, longest_match_slow functions. +#if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN +# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) +# define longest_match_generic longest_match_unaligned_64 +# define longest_match_slow_generic longest_match_slow_unaligned_64 +# define compare256_generic compare256_unaligned_64 +# elif defined(HAVE_BUILTIN_CTZ) +# define longest_match_generic longest_match_unaligned_32 +# define longest_match_slow_generic longest_match_slow_unaligned_32 +# define compare256_generic compare256_unaligned_32 +# else +# define longest_match_generic longest_match_unaligned_16 +# define longest_match_slow_generic longest_match_slow_unaligned_16 +# define compare256_generic compare256_unaligned_16 +# endif +#else +# define longest_match_generic longest_match_c +# define longest_match_slow_generic longest_match_slow_c +# define compare256_generic compare256_c +#endif + + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +// Generic code +# define native_adler32 adler32_c +# define native_adler32_fold_copy adler32_fold_copy_c +# define native_chunkmemset_safe chunkmemset_safe_c +# define native_chunksize chunksize_c +# define native_crc32 PREFIX(crc32_braid) +# define native_crc32_fold crc32_fold_c +# define native_crc32_fold_copy crc32_fold_copy_c +# define native_crc32_fold_final crc32_fold_final_c +# define native_crc32_fold_reset crc32_fold_reset_c +# define native_inflate_fast inflate_fast_c +# define native_slide_hash slide_hash_c +# define native_longest_match longest_match_generic +# define native_longest_match_slow longest_match_slow_generic +# define native_compare256 compare256_generic +#endif + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/generic/slide_hash_c.c b/internal-complibs/zlib-ng-2.2.2/arch/generic/slide_hash_c.c new file mode 100644 index 000000000..8345b9e36 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/generic/slide_hash_c.c @@ -0,0 +1,52 @@ +/* slide_hash.c -- slide hash table C implementation + * + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "deflate.h" + +/* =========================================================================== + * Slide the hash table when sliding the window down (could be avoided with 32 + * bit values at the expense of memory usage). We slide even when level == 0 to + * keep the hash table consistent if we switch back to level > 0 later. + */ +static inline void slide_hash_c_chain(Pos *table, uint32_t entries, uint16_t wsize) { +#ifdef NOT_TWEAK_COMPILER + table += entries; + do { + unsigned m; + m = *--table; + *table = (Pos)(m >= wsize ? m-wsize : 0); + /* If entries is not on any hash chain, prev[entries] is garbage but + * its value will never be used. + */ + } while (--entries); +#else + { + /* As of I make this change, gcc (4.8.*) isn't able to vectorize + * this hot loop using saturated-subtraction on x86-64 architecture. + * To avoid this defect, we can change the loop such that + * o. the pointer advance forward, and + * o. demote the variable 'm' to be local to the loop, and + * choose type "Pos" (instead of 'unsigned int') for the + * variable to avoid unnecessary zero-extension. + */ + unsigned int i; + Pos *q = table; + for (i = 0; i < entries; i++) { + Pos m = *q; + Pos t = (Pos)wsize; + *q++ = (Pos)(m >= t ? m-t: 0); + } + } +#endif /* NOT_TWEAK_COMPILER */ +} + +Z_INTERNAL void slide_hash_c(deflate_state *s) { + uint16_t wsize = (uint16_t)s->w_size; + + slide_hash_c_chain(s->head, HASH_SIZE, wsize); + slide_hash_c_chain(s->prev, wsize, wsize); +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/Makefile.in b/internal-complibs/zlib-ng-2.2.2/arch/power/Makefile.in new file mode 100644 index 000000000..e2bec5e51 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/Makefile.in @@ -0,0 +1,93 @@ +# Makefile for POWER-specific files +# Copyright (C) 2020 Matheus Castanho , IBM +# Copyright (C) 2021 Mika T. Lindqvist +# For conditions of distribution and use, see copyright notice in zlib.h + +CC= +CFLAGS= +SFLAGS= +INCLUDES= +SUFFIX= + +P8FLAGS=-mcpu=power8 +P9FLAGS=-mcpu=power9 +PPCFLAGS=-maltivec +NOLTOFLAG= + +SRCDIR=. +SRCTOP=../.. +TOPDIR=$(SRCTOP) + +all: power_features.o \ + power_features.lo \ + adler32_power8.o \ + adler32_power8.lo \ + adler32_vmx.o \ + adler32_vmx.lo \ + chunkset_power8.o \ + chunkset_power8.lo \ + compare256_power9.o \ + compare256_power9.lo \ + crc32_power8.o \ + crc32_power8.lo \ + slide_hash_power8.o \ + slide_hash_power8.lo \ + slide_hash_vmx.o \ + slide_hash_vmx.lo + +power_features.o: + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/power_features.c + +power_features.lo: + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/power_features.c + +adler32_power8.o: + $(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_power8.c + +adler32_power8.lo: + $(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_power8.c + +adler32_vmx.o: + $(CC) $(CFLAGS) $(PPCFLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_vmx.c + +adler32_vmx.lo: + $(CC) $(SFLAGS) $(PPCFLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_vmx.c + +chunkset_power8.o: + $(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_power8.c + +chunkset_power8.lo: + $(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_power8.c + +compare256_power9.o: + $(CC) $(CFLAGS) $(P9FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_power9.c + +compare256_power9.lo: + $(CC) $(SFLAGS) $(P9FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_power9.c + +crc32_power8.o: + $(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_power8.c + +crc32_power8.lo: + $(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_power8.c + +slide_hash_power8.o: + $(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_power8.c + +slide_hash_power8.lo: + $(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_power8.c + +slide_hash_vmx.o: + $(CC) $(CFLAGS) ${PPCFLAGS} $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_vmx.c + +slide_hash_vmx.lo: + $(CC) $(SFLAGS) ${PPCFLAGS} $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_vmx.c + +mostlyclean: clean +clean: + rm -f *.o *.lo *~ + rm -rf objs + rm -f *.gcda *.gcno *.gcov + +distclean: clean + rm -f Makefile diff --git a/internal-complibs/zlib-ng-2.0.7/arch/power/adler32_power8.c b/internal-complibs/zlib-ng-2.2.2/arch/power/adler32_power8.c similarity index 94% rename from internal-complibs/zlib-ng-2.0.7/arch/power/adler32_power8.c rename to internal-complibs/zlib-ng-2.2.2/arch/power/adler32_power8.c index cda51aa80..4aaea9f50 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/power/adler32_power8.c +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/adler32_power8.c @@ -36,15 +36,14 @@ * https://www.ietf.org/rfc/rfc1950.txt */ -#ifdef POWER8_VSX_ADLER32 +#ifdef POWER8_VSX #include #include "zbuild.h" -#include "zutil.h" #include "adler32_p.h" /* Vector across sum unsigned int (saturate). */ -inline vector unsigned int vec_sumsu(vector unsigned int __a, vector unsigned int __b) { +static inline vector unsigned int vec_sumsu(vector unsigned int __a, vector unsigned int __b) { __b = vec_sld(__a, __a, 8); __b = vec_add(__b, __a); __a = vec_sld(__b, __b, 4); @@ -53,7 +52,7 @@ inline vector unsigned int vec_sumsu(vector unsigned int __a, vector unsigned in return __a; } -uint32_t adler32_power8(uint32_t adler, const unsigned char* buf, size_t len) { +Z_INTERNAL uint32_t adler32_power8(uint32_t adler, const uint8_t *buf, size_t len) { uint32_t s1 = adler & 0xffff; uint32_t s2 = (adler >> 16) & 0xffff; @@ -147,8 +146,8 @@ uint32_t adler32_power8(uint32_t adler, const unsigned char* buf, size_t len) { s1 = vs1[0] % BASE; s2 = vs2[0] % BASE; - /* Process tail (len < 16).and return */ + /* Process tail (len < 16). */ return adler32_len_16(s1, buf, len, s2); } -#endif /* POWER8_VSX_ADLER32 */ +#endif /* POWER8_VSX */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/adler32_vmx.c b/internal-complibs/zlib-ng-2.2.2/arch/power/adler32_vmx.c new file mode 100644 index 000000000..3470c28a1 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/adler32_vmx.c @@ -0,0 +1,186 @@ +/* adler32_vmx.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2011 Mark Adler + * Copyright (C) 2017-2023 Mika T. Lindqvist + * Copyright (C) 2021 Adam Stylinski + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef PPC_VMX +#include +#include "zbuild.h" +#include "zendian.h" +#include "adler32_p.h" + +#define vmx_zero() (vec_splat_u32(0)) + +static inline void vmx_handle_head_or_tail(uint32_t *pair, const uint8_t *buf, size_t len) { + unsigned int i; + for (i = 0; i < len; ++i) { + pair[0] += buf[i]; + pair[1] += pair[0]; + } +} + +static void vmx_accum32(uint32_t *s, const uint8_t *buf, size_t len) { + /* Different taps for the separable components of sums */ + const vector unsigned char t0 = {64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49}; + const vector unsigned char t1 = {48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33}; + const vector unsigned char t2 = {32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17}; + const vector unsigned char t3 = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; + /* As silly and inefficient as it seems, creating 1 permutation vector to permute + * a 2 element vector from a single load + a subsequent shift is just barely faster + * than doing 2 indexed insertions into zero initialized vectors from unaligned memory. */ + const vector unsigned char s0_perm = {0, 1, 2, 3, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; + const vector unsigned char shift_vec = vec_sl(vec_splat_u8(8), vec_splat_u8(2)); + vector unsigned int adacc, s2acc; + vector unsigned int pair_vec = vec_ld(0, s); + adacc = vec_perm(pair_vec, pair_vec, s0_perm); +#if BYTE_ORDER == LITTLE_ENDIAN + s2acc = vec_sro(pair_vec, shift_vec); +#else + s2acc = vec_slo(pair_vec, shift_vec); +#endif + + vector unsigned int zero = vmx_zero(); + vector unsigned int s3acc = zero; + vector unsigned int s3acc_0 = zero; + vector unsigned int adacc_prev = adacc; + vector unsigned int adacc_prev_0 = zero; + + vector unsigned int s2acc_0 = zero; + vector unsigned int s2acc_1 = zero; + vector unsigned int s2acc_2 = zero; + + /* Maintain a running sum of a second half, this might help use break yet another + * data dependency bubble in the sum */ + vector unsigned int adacc_0 = zero; + + int num_iter = len / 4; + int rem = len & 3; + + for (int i = 0; i < num_iter; ++i) { + vector unsigned char d0 = vec_ld(0, buf); + vector unsigned char d1 = vec_ld(16, buf); + vector unsigned char d2 = vec_ld(32, buf); + vector unsigned char d3 = vec_ld(48, buf); + + /* The core operation of the loop, basically + * what is being unrolled below */ + adacc = vec_sum4s(d0, adacc); + s3acc = vec_add(s3acc, adacc_prev); + s3acc_0 = vec_add(s3acc_0, adacc_prev_0); + s2acc = vec_msum(t0, d0, s2acc); + + /* interleave dependent sums in here */ + adacc_0 = vec_sum4s(d1, adacc_0); + s2acc_0 = vec_msum(t1, d1, s2acc_0); + adacc = vec_sum4s(d2, adacc); + s2acc_1 = vec_msum(t2, d2, s2acc_1); + s2acc_2 = vec_msum(t3, d3, s2acc_2); + adacc_0 = vec_sum4s(d3, adacc_0); + + adacc_prev = adacc; + adacc_prev_0 = adacc_0; + buf += 64; + } + + adacc = vec_add(adacc, adacc_0); + s3acc = vec_add(s3acc, s3acc_0); + s3acc = vec_sl(s3acc, vec_splat_u32(6)); + + if (rem) { + adacc_prev = vec_add(adacc_prev_0, adacc_prev); + adacc_prev = vec_sl(adacc_prev, vec_splat_u32(4)); + while (rem--) { + vector unsigned char d0 = vec_ld(0, buf); + adacc = vec_sum4s(d0, adacc); + s3acc = vec_add(s3acc, adacc_prev); + s2acc = vec_msum(t3, d0, s2acc); + adacc_prev = vec_sl(adacc, vec_splat_u32(4)); + buf += 16; + } + } + + + /* Sum up independent second sums */ + s2acc = vec_add(s2acc, s2acc_0); + s2acc_2 = vec_add(s2acc_1, s2acc_2); + s2acc = vec_add(s2acc, s2acc_2); + + s2acc = vec_add(s2acc, s3acc); + + adacc = vec_add(adacc, vec_sld(adacc, adacc, 8)); + s2acc = vec_add(s2acc, vec_sld(s2acc, s2acc, 8)); + adacc = vec_add(adacc, vec_sld(adacc, adacc, 4)); + s2acc = vec_add(s2acc, vec_sld(s2acc, s2acc, 4)); + + vec_ste(adacc, 0, s); + vec_ste(s2acc, 0, s+1); +} + +Z_INTERNAL uint32_t adler32_vmx(uint32_t adler, const uint8_t *buf, size_t len) { + uint32_t sum2; + uint32_t pair[16] ALIGNED_(16); + memset(&pair[2], 0, 14); + int n = NMAX; + unsigned int done = 0, i; + + /* Split Adler-32 into component sums, it can be supplied by + * the caller sites (e.g. in a PNG file). + */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + pair[0] = adler; + pair[1] = sum2; + + /* in case user likes doing a byte at a time, keep it fast */ + if (UNLIKELY(len == 1)) + return adler32_len_1(adler, buf, sum2); + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (UNLIKELY(buf == NULL)) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (UNLIKELY(len < 16)) + return adler32_len_16(adler, buf, len, sum2); + + // Align buffer + unsigned int al = 0; + if ((uintptr_t)buf & 0xf) { + al = 16-((uintptr_t)buf & 0xf); + if (al > len) { + al=len; + } + vmx_handle_head_or_tail(pair, buf, al); + + done += al; + /* Rather than rebasing, we can reduce the max sums for the + * first round only */ + n -= al; + } + for (i = al; i < len; i += n) { + int remaining = (int)(len-i); + n = MIN(remaining, (i == al) ? n : NMAX); + + if (n < 16) + break; + + vmx_accum32(pair, buf + i, n / 16); + pair[0] %= BASE; + pair[1] %= BASE; + + done += (n / 16) * 16; + } + + /* Handle the tail elements. */ + if (done < len) { + vmx_handle_head_or_tail(pair, (buf + done), len - done); + pair[0] %= BASE; + pair[1] %= BASE; + } + + /* D = B * 65536 + A, see: https://en.wikipedia.org/wiki/Adler-32. */ + return (pair[1] << 16) | pair[0]; +} +#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/arm/chunkset_neon.c b/internal-complibs/zlib-ng-2.2.2/arch/power/chunkset_power8.c similarity index 50% rename from internal-complibs/zlib-ng-2.0.7/arch/arm/chunkset_neon.c rename to internal-complibs/zlib-ng-2.2.2/arch/power/chunkset_power8.c index 51dcf0933..aef197327 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/arm/chunkset_neon.c +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/chunkset_power8.c @@ -1,17 +1,12 @@ -/* chunkset_neon.c -- NEON inline functions to copy small data chunks. +/* chunkset_power8.c -- VSX inline functions to copy small data chunks. * For conditions of distribution and use, see copyright notice in zlib.h */ -#ifdef ARM_NEON_CHUNKSET -#ifdef _M_ARM64 -# include -#else -# include -#endif -#include "../../zbuild.h" -#include "../../zutil.h" +#ifdef POWER8_VSX +#include +#include "zbuild.h" -typedef uint8x16_t chunk_t; +typedef vector unsigned char chunk_t; #define CHUNK_SIZE 16 @@ -22,36 +17,39 @@ typedef uint8x16_t chunk_t; static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { uint16_t tmp; memcpy(&tmp, from, sizeof(tmp)); - *chunk = vreinterpretq_u8_u16(vdupq_n_u16(tmp)); + *chunk = (vector unsigned char)vec_splats(tmp); } static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { uint32_t tmp; memcpy(&tmp, from, sizeof(tmp)); - *chunk = vreinterpretq_u8_u32(vdupq_n_u32(tmp)); + *chunk = (vector unsigned char)vec_splats(tmp); } static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { uint64_t tmp; memcpy(&tmp, from, sizeof(tmp)); - *chunk = vreinterpretq_u8_u64(vdupq_n_u64(tmp)); + *chunk = (vector unsigned char)vec_splats((unsigned long long)tmp); } -#define CHUNKSIZE chunksize_neon -#define CHUNKCOPY chunkcopy_neon -#define CHUNKCOPY_SAFE chunkcopy_safe_neon -#define CHUNKUNROLL chunkunroll_neon -#define CHUNKMEMSET chunkmemset_neon -#define CHUNKMEMSET_SAFE chunkmemset_safe_neon - static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { - *chunk = vld1q_u8(s); + *chunk = vec_xl(0, s); } static inline void storechunk(uint8_t *out, chunk_t *chunk) { - vst1q_u8(out, *chunk); + vec_xst(*chunk, 0, out); } +#define CHUNKSIZE chunksize_power8 +#define CHUNKCOPY chunkcopy_power8 +#define CHUNKUNROLL chunkunroll_power8 +#define CHUNKMEMSET chunkmemset_power8 +#define CHUNKMEMSET_SAFE chunkmemset_safe_power8 + #include "chunkset_tpl.h" +#define INFLATE_FAST inflate_fast_power8 + +#include "inffast_tpl.h" + #endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/compare256_power9.c b/internal-complibs/zlib-ng-2.2.2/arch/power/compare256_power9.c new file mode 100644 index 000000000..c8be498e4 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/compare256_power9.c @@ -0,0 +1,66 @@ +/* compare256_power9.c - Power9 version of compare256 + * Copyright (C) 2019 Matheus Castanho , IBM + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef POWER9 +#include +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" +#include "zendian.h" + +/* Older versions of GCC misimplemented semantics for these bit counting builtins. + * https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=3f30f2d1dbb3228b8468b26239fe60c2974ce2ac */ +#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 12) +#if BYTE_ORDER == LITTLE_ENDIAN +# define zng_vec_vctzlsbb(vc, len) len = __builtin_vec_vctzlsbb(vc) +#else +# define zng_vec_vctzlsbb(vc, len) len = __builtin_vec_vclzlsbb(vc) +#endif +#else +# define zng_vec_vctzlsbb(vc, len) len = vec_cntlz_lsbb(vc) +#endif + +static inline uint32_t compare256_power9_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0, cmplen; + + do { + vector unsigned char vsrc0, vsrc1, vc; + + vsrc0 = *((vector unsigned char *)src0); + vsrc1 = *((vector unsigned char *)src1); + + /* Compare 16 bytes at a time. Each byte of vc will be either + * all ones or all zeroes, depending on the result of the comparison. */ + vc = (vector unsigned char)vec_cmpne(vsrc0, vsrc1); + + /* Since the index of matching bytes will contain only zeroes + * on vc (since we used cmpne), counting the number of consecutive + * bytes where LSB == 0 is the same as counting the length of the match. */ + zng_vec_vctzlsbb(vc, cmplen); + if (cmplen != 16) + return len + cmplen; + + src0 += 16, src1 += 16, len += 16; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_power9(const uint8_t *src0, const uint8_t *src1) { + return compare256_power9_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_power9 +#define COMPARE256 compare256_power9_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_power9 +#define COMPARE256 compare256_power9_static + +#include "match_tpl.h" + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/crc32_constants.h b/internal-complibs/zlib-ng-2.2.2/arch/power/crc32_constants.h new file mode 100644 index 000000000..8c8f2153b --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/crc32_constants.h @@ -0,0 +1,1123 @@ +/* Constants table used by crc32_power8.c + * Copyright (C) 2021 IBM Corporation + * + * This file was automatically generated, DO NOT EDIT IT MANUALLY. + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zendian.h" +#include "zbuild.h" + +/* Reduce 262144 kbits to 1024 bits */ +static const __vector unsigned long long vcrc_const[255] ALIGNED_(16) = { +#if BYTE_ORDER == LITTLE_ENDIAN + /* x^261120 mod p(x)` << 1, x^261184 mod p(x)` << 1 */ + { 0x0000000099ea94a8, 0x00000001651797d2 }, + /* x^260096 mod p(x)` << 1, x^260160 mod p(x)` << 1 */ + { 0x00000000945a8420, 0x0000000021e0d56c }, + /* x^259072 mod p(x)` << 1, x^259136 mod p(x)` << 1 */ + { 0x0000000030762706, 0x000000000f95ecaa }, + /* x^258048 mod p(x)` << 1, x^258112 mod p(x)` << 1 */ + { 0x00000001a52fc582, 0x00000001ebd224ac }, + /* x^257024 mod p(x)` << 1, x^257088 mod p(x)` << 1 */ + { 0x00000001a4a7167a, 0x000000000ccb97ca }, + /* x^256000 mod p(x)` << 1, x^256064 mod p(x)` << 1 */ + { 0x000000000c18249a, 0x00000001006ec8a8 }, + /* x^254976 mod p(x)` << 1, x^255040 mod p(x)` << 1 */ + { 0x00000000a924ae7c, 0x000000014f58f196 }, + /* x^253952 mod p(x)` << 1, x^254016 mod p(x)` << 1 */ + { 0x00000001e12ccc12, 0x00000001a7192ca6 }, + /* x^252928 mod p(x)` << 1, x^252992 mod p(x)` << 1 */ + { 0x00000000a0b9d4ac, 0x000000019a64bab2 }, + /* x^251904 mod p(x)` << 1, x^251968 mod p(x)` << 1 */ + { 0x0000000095e8ddfe, 0x0000000014f4ed2e }, + /* x^250880 mod p(x)` << 1, x^250944 mod p(x)` << 1 */ + { 0x00000000233fddc4, 0x000000011092b6a2 }, + /* x^249856 mod p(x)` << 1, x^249920 mod p(x)` << 1 */ + { 0x00000001b4529b62, 0x00000000c8a1629c }, + /* x^248832 mod p(x)` << 1, x^248896 mod p(x)` << 1 */ + { 0x00000001a7fa0e64, 0x000000017bf32e8e }, + /* x^247808 mod p(x)` << 1, x^247872 mod p(x)` << 1 */ + { 0x00000001b5334592, 0x00000001f8cc6582 }, + /* x^246784 mod p(x)` << 1, x^246848 mod p(x)` << 1 */ + { 0x000000011f8ee1b4, 0x000000008631ddf0 }, + /* x^245760 mod p(x)` << 1, x^245824 mod p(x)` << 1 */ + { 0x000000006252e632, 0x000000007e5a76d0 }, + /* x^244736 mod p(x)` << 1, x^244800 mod p(x)` << 1 */ + { 0x00000000ab973e84, 0x000000002b09b31c }, + /* x^243712 mod p(x)` << 1, x^243776 mod p(x)` << 1 */ + { 0x000000007734f5ec, 0x00000001b2df1f84 }, + /* x^242688 mod p(x)` << 1, x^242752 mod p(x)` << 1 */ + { 0x000000007c547798, 0x00000001d6f56afc }, + /* x^241664 mod p(x)` << 1, x^241728 mod p(x)` << 1 */ + { 0x000000007ec40210, 0x00000001b9b5e70c }, + /* x^240640 mod p(x)` << 1, x^240704 mod p(x)` << 1 */ + { 0x00000001ab1695a8, 0x0000000034b626d2 }, + /* x^239616 mod p(x)` << 1, x^239680 mod p(x)` << 1 */ + { 0x0000000090494bba, 0x000000014c53479a }, + /* x^238592 mod p(x)` << 1, x^238656 mod p(x)` << 1 */ + { 0x00000001123fb816, 0x00000001a6d179a4 }, + /* x^237568 mod p(x)` << 1, x^237632 mod p(x)` << 1 */ + { 0x00000001e188c74c, 0x000000015abd16b4 }, + /* x^236544 mod p(x)` << 1, x^236608 mod p(x)` << 1 */ + { 0x00000001c2d3451c, 0x00000000018f9852 }, + /* x^235520 mod p(x)` << 1, x^235584 mod p(x)` << 1 */ + { 0x00000000f55cf1ca, 0x000000001fb3084a }, + /* x^234496 mod p(x)` << 1, x^234560 mod p(x)` << 1 */ + { 0x00000001a0531540, 0x00000000c53dfb04 }, + /* x^233472 mod p(x)` << 1, x^233536 mod p(x)` << 1 */ + { 0x0000000132cd7ebc, 0x00000000e10c9ad6 }, + /* x^232448 mod p(x)` << 1, x^232512 mod p(x)` << 1 */ + { 0x0000000073ab7f36, 0x0000000025aa994a }, + /* x^231424 mod p(x)` << 1, x^231488 mod p(x)` << 1 */ + { 0x0000000041aed1c2, 0x00000000fa3a74c4 }, + /* x^230400 mod p(x)` << 1, x^230464 mod p(x)` << 1 */ + { 0x0000000136c53800, 0x0000000033eb3f40 }, + /* x^229376 mod p(x)` << 1, x^229440 mod p(x)` << 1 */ + { 0x0000000126835a30, 0x000000017193f296 }, + /* x^228352 mod p(x)` << 1, x^228416 mod p(x)` << 1 */ + { 0x000000006241b502, 0x0000000043f6c86a }, + /* x^227328 mod p(x)` << 1, x^227392 mod p(x)` << 1 */ + { 0x00000000d5196ad4, 0x000000016b513ec6 }, + /* x^226304 mod p(x)` << 1, x^226368 mod p(x)` << 1 */ + { 0x000000009cfa769a, 0x00000000c8f25b4e }, + /* x^225280 mod p(x)` << 1, x^225344 mod p(x)` << 1 */ + { 0x00000000920e5df4, 0x00000001a45048ec }, + /* x^224256 mod p(x)` << 1, x^224320 mod p(x)` << 1 */ + { 0x0000000169dc310e, 0x000000000c441004 }, + /* x^223232 mod p(x)` << 1, x^223296 mod p(x)` << 1 */ + { 0x0000000009fc331c, 0x000000000e17cad6 }, + /* x^222208 mod p(x)` << 1, x^222272 mod p(x)` << 1 */ + { 0x000000010d94a81e, 0x00000001253ae964 }, + /* x^221184 mod p(x)` << 1, x^221248 mod p(x)` << 1 */ + { 0x0000000027a20ab2, 0x00000001d7c88ebc }, + /* x^220160 mod p(x)` << 1, x^220224 mod p(x)` << 1 */ + { 0x0000000114f87504, 0x00000001e7ca913a }, + /* x^219136 mod p(x)` << 1, x^219200 mod p(x)` << 1 */ + { 0x000000004b076d96, 0x0000000033ed078a }, + /* x^218112 mod p(x)` << 1, x^218176 mod p(x)` << 1 */ + { 0x00000000da4d1e74, 0x00000000e1839c78 }, + /* x^217088 mod p(x)` << 1, x^217152 mod p(x)` << 1 */ + { 0x000000001b81f672, 0x00000001322b267e }, + /* x^216064 mod p(x)` << 1, x^216128 mod p(x)` << 1 */ + { 0x000000009367c988, 0x00000000638231b6 }, + /* x^215040 mod p(x)` << 1, x^215104 mod p(x)` << 1 */ + { 0x00000001717214ca, 0x00000001ee7f16f4 }, + /* x^214016 mod p(x)` << 1, x^214080 mod p(x)` << 1 */ + { 0x000000009f47d820, 0x0000000117d9924a }, + /* x^212992 mod p(x)` << 1, x^213056 mod p(x)` << 1 */ + { 0x000000010d9a47d2, 0x00000000e1a9e0c4 }, + /* x^211968 mod p(x)` << 1, x^212032 mod p(x)` << 1 */ + { 0x00000000a696c58c, 0x00000001403731dc }, + /* x^210944 mod p(x)` << 1, x^211008 mod p(x)` << 1 */ + { 0x000000002aa28ec6, 0x00000001a5ea9682 }, + /* x^209920 mod p(x)` << 1, x^209984 mod p(x)` << 1 */ + { 0x00000001fe18fd9a, 0x0000000101c5c578 }, + /* x^208896 mod p(x)` << 1, x^208960 mod p(x)` << 1 */ + { 0x000000019d4fc1ae, 0x00000000dddf6494 }, + /* x^207872 mod p(x)` << 1, x^207936 mod p(x)` << 1 */ + { 0x00000001ba0e3dea, 0x00000000f1c3db28 }, + /* x^206848 mod p(x)` << 1, x^206912 mod p(x)` << 1 */ + { 0x0000000074b59a5e, 0x000000013112fb9c }, + /* x^205824 mod p(x)` << 1, x^205888 mod p(x)` << 1 */ + { 0x00000000f2b5ea98, 0x00000000b680b906 }, + /* x^204800 mod p(x)` << 1, x^204864 mod p(x)` << 1 */ + { 0x0000000187132676, 0x000000001a282932 }, + /* x^203776 mod p(x)` << 1, x^203840 mod p(x)` << 1 */ + { 0x000000010a8c6ad4, 0x0000000089406e7e }, + /* x^202752 mod p(x)` << 1, x^202816 mod p(x)` << 1 */ + { 0x00000001e21dfe70, 0x00000001def6be8c }, + /* x^201728 mod p(x)` << 1, x^201792 mod p(x)` << 1 */ + { 0x00000001da0050e4, 0x0000000075258728 }, + /* x^200704 mod p(x)` << 1, x^200768 mod p(x)` << 1 */ + { 0x00000000772172ae, 0x000000019536090a }, + /* x^199680 mod p(x)` << 1, x^199744 mod p(x)` << 1 */ + { 0x00000000e47724aa, 0x00000000f2455bfc }, + /* x^198656 mod p(x)` << 1, x^198720 mod p(x)` << 1 */ + { 0x000000003cd63ac4, 0x000000018c40baf4 }, + /* x^197632 mod p(x)` << 1, x^197696 mod p(x)` << 1 */ + { 0x00000001bf47d352, 0x000000004cd390d4 }, + /* x^196608 mod p(x)` << 1, x^196672 mod p(x)` << 1 */ + { 0x000000018dc1d708, 0x00000001e4ece95a }, + /* x^195584 mod p(x)` << 1, x^195648 mod p(x)` << 1 */ + { 0x000000002d4620a4, 0x000000001a3ee918 }, + /* x^194560 mod p(x)` << 1, x^194624 mod p(x)` << 1 */ + { 0x0000000058fd1740, 0x000000007c652fb8 }, + /* x^193536 mod p(x)` << 1, x^193600 mod p(x)` << 1 */ + { 0x00000000dadd9bfc, 0x000000011c67842c }, + /* x^192512 mod p(x)` << 1, x^192576 mod p(x)` << 1 */ + { 0x00000001ea2140be, 0x00000000254f759c }, + /* x^191488 mod p(x)` << 1, x^191552 mod p(x)` << 1 */ + { 0x000000009de128ba, 0x000000007ece94ca }, + /* x^190464 mod p(x)` << 1, x^190528 mod p(x)` << 1 */ + { 0x000000013ac3aa8e, 0x0000000038f258c2 }, + /* x^189440 mod p(x)` << 1, x^189504 mod p(x)` << 1 */ + { 0x0000000099980562, 0x00000001cdf17b00 }, + /* x^188416 mod p(x)` << 1, x^188480 mod p(x)` << 1 */ + { 0x00000001c1579c86, 0x000000011f882c16 }, + /* x^187392 mod p(x)` << 1, x^187456 mod p(x)` << 1 */ + { 0x0000000068dbbf94, 0x0000000100093fc8 }, + /* x^186368 mod p(x)` << 1, x^186432 mod p(x)` << 1 */ + { 0x000000004509fb04, 0x00000001cd684f16 }, + /* x^185344 mod p(x)` << 1, x^185408 mod p(x)` << 1 */ + { 0x00000001202f6398, 0x000000004bc6a70a }, + /* x^184320 mod p(x)` << 1, x^184384 mod p(x)` << 1 */ + { 0x000000013aea243e, 0x000000004fc7e8e4 }, + /* x^183296 mod p(x)` << 1, x^183360 mod p(x)` << 1 */ + { 0x00000001b4052ae6, 0x0000000130103f1c }, + /* x^182272 mod p(x)` << 1, x^182336 mod p(x)` << 1 */ + { 0x00000001cd2a0ae8, 0x0000000111b0024c }, + /* x^181248 mod p(x)` << 1, x^181312 mod p(x)` << 1 */ + { 0x00000001fe4aa8b4, 0x000000010b3079da }, + /* x^180224 mod p(x)` << 1, x^180288 mod p(x)` << 1 */ + { 0x00000001d1559a42, 0x000000010192bcc2 }, + /* x^179200 mod p(x)` << 1, x^179264 mod p(x)` << 1 */ + { 0x00000001f3e05ecc, 0x0000000074838d50 }, + /* x^178176 mod p(x)` << 1, x^178240 mod p(x)` << 1 */ + { 0x0000000104ddd2cc, 0x000000001b20f520 }, + /* x^177152 mod p(x)` << 1, x^177216 mod p(x)` << 1 */ + { 0x000000015393153c, 0x0000000050c3590a }, + /* x^176128 mod p(x)` << 1, x^176192 mod p(x)` << 1 */ + { 0x0000000057e942c6, 0x00000000b41cac8e }, + /* x^175104 mod p(x)` << 1, x^175168 mod p(x)` << 1 */ + { 0x000000012c633850, 0x000000000c72cc78 }, + /* x^174080 mod p(x)` << 1, x^174144 mod p(x)` << 1 */ + { 0x00000000ebcaae4c, 0x0000000030cdb032 }, + /* x^173056 mod p(x)` << 1, x^173120 mod p(x)` << 1 */ + { 0x000000013ee532a6, 0x000000013e09fc32 }, + /* x^172032 mod p(x)` << 1, x^172096 mod p(x)` << 1 */ + { 0x00000001bf0cbc7e, 0x000000001ed624d2 }, + /* x^171008 mod p(x)` << 1, x^171072 mod p(x)` << 1 */ + { 0x00000000d50b7a5a, 0x00000000781aee1a }, + /* x^169984 mod p(x)` << 1, x^170048 mod p(x)` << 1 */ + { 0x0000000002fca6e8, 0x00000001c4d8348c }, + /* x^168960 mod p(x)` << 1, x^169024 mod p(x)` << 1 */ + { 0x000000007af40044, 0x0000000057a40336 }, + /* x^167936 mod p(x)` << 1, x^168000 mod p(x)` << 1 */ + { 0x0000000016178744, 0x0000000085544940 }, + /* x^166912 mod p(x)` << 1, x^166976 mod p(x)` << 1 */ + { 0x000000014c177458, 0x000000019cd21e80 }, + /* x^165888 mod p(x)` << 1, x^165952 mod p(x)` << 1 */ + { 0x000000011b6ddf04, 0x000000013eb95bc0 }, + /* x^164864 mod p(x)` << 1, x^164928 mod p(x)` << 1 */ + { 0x00000001f3e29ccc, 0x00000001dfc9fdfc }, + /* x^163840 mod p(x)` << 1, x^163904 mod p(x)` << 1 */ + { 0x0000000135ae7562, 0x00000000cd028bc2 }, + /* x^162816 mod p(x)` << 1, x^162880 mod p(x)` << 1 */ + { 0x0000000190ef812c, 0x0000000090db8c44 }, + /* x^161792 mod p(x)` << 1, x^161856 mod p(x)` << 1 */ + { 0x0000000067a2c786, 0x000000010010a4ce }, + /* x^160768 mod p(x)` << 1, x^160832 mod p(x)` << 1 */ + { 0x0000000048b9496c, 0x00000001c8f4c72c }, + /* x^159744 mod p(x)` << 1, x^159808 mod p(x)` << 1 */ + { 0x000000015a422de6, 0x000000001c26170c }, + /* x^158720 mod p(x)` << 1, x^158784 mod p(x)` << 1 */ + { 0x00000001ef0e3640, 0x00000000e3fccf68 }, + /* x^157696 mod p(x)` << 1, x^157760 mod p(x)` << 1 */ + { 0x00000001006d2d26, 0x00000000d513ed24 }, + /* x^156672 mod p(x)` << 1, x^156736 mod p(x)` << 1 */ + { 0x00000001170d56d6, 0x00000000141beada }, + /* x^155648 mod p(x)` << 1, x^155712 mod p(x)` << 1 */ + { 0x00000000a5fb613c, 0x000000011071aea0 }, + /* x^154624 mod p(x)` << 1, x^154688 mod p(x)` << 1 */ + { 0x0000000040bbf7fc, 0x000000012e19080a }, + /* x^153600 mod p(x)` << 1, x^153664 mod p(x)` << 1 */ + { 0x000000016ac3a5b2, 0x0000000100ecf826 }, + /* x^152576 mod p(x)` << 1, x^152640 mod p(x)` << 1 */ + { 0x00000000abf16230, 0x0000000069b09412 }, + /* x^151552 mod p(x)` << 1, x^151616 mod p(x)` << 1 */ + { 0x00000001ebe23fac, 0x0000000122297bac }, + /* x^150528 mod p(x)` << 1, x^150592 mod p(x)` << 1 */ + { 0x000000008b6a0894, 0x00000000e9e4b068 }, + /* x^149504 mod p(x)` << 1, x^149568 mod p(x)` << 1 */ + { 0x00000001288ea478, 0x000000004b38651a }, + /* x^148480 mod p(x)` << 1, x^148544 mod p(x)` << 1 */ + { 0x000000016619c442, 0x00000001468360e2 }, + /* x^147456 mod p(x)` << 1, x^147520 mod p(x)` << 1 */ + { 0x0000000086230038, 0x00000000121c2408 }, + /* x^146432 mod p(x)` << 1, x^146496 mod p(x)` << 1 */ + { 0x000000017746a756, 0x00000000da7e7d08 }, + /* x^145408 mod p(x)` << 1, x^145472 mod p(x)` << 1 */ + { 0x0000000191b8f8f8, 0x00000001058d7652 }, + /* x^144384 mod p(x)` << 1, x^144448 mod p(x)` << 1 */ + { 0x000000008e167708, 0x000000014a098a90 }, + /* x^143360 mod p(x)` << 1, x^143424 mod p(x)` << 1 */ + { 0x0000000148b22d54, 0x0000000020dbe72e }, + /* x^142336 mod p(x)` << 1, x^142400 mod p(x)` << 1 */ + { 0x0000000044ba2c3c, 0x000000011e7323e8 }, + /* x^141312 mod p(x)` << 1, x^141376 mod p(x)` << 1 */ + { 0x00000000b54d2b52, 0x00000000d5d4bf94 }, + /* x^140288 mod p(x)` << 1, x^140352 mod p(x)` << 1 */ + { 0x0000000005a4fd8a, 0x0000000199d8746c }, + /* x^139264 mod p(x)` << 1, x^139328 mod p(x)` << 1 */ + { 0x0000000139f9fc46, 0x00000000ce9ca8a0 }, + /* x^138240 mod p(x)` << 1, x^138304 mod p(x)` << 1 */ + { 0x000000015a1fa824, 0x00000000136edece }, + /* x^137216 mod p(x)` << 1, x^137280 mod p(x)` << 1 */ + { 0x000000000a61ae4c, 0x000000019b92a068 }, + /* x^136192 mod p(x)` << 1, x^136256 mod p(x)` << 1 */ + { 0x0000000145e9113e, 0x0000000071d62206 }, + /* x^135168 mod p(x)` << 1, x^135232 mod p(x)` << 1 */ + { 0x000000006a348448, 0x00000000dfc50158 }, + /* x^134144 mod p(x)` << 1, x^134208 mod p(x)` << 1 */ + { 0x000000004d80a08c, 0x00000001517626bc }, + /* x^133120 mod p(x)` << 1, x^133184 mod p(x)` << 1 */ + { 0x000000014b6837a0, 0x0000000148d1e4fa }, + /* x^132096 mod p(x)` << 1, x^132160 mod p(x)` << 1 */ + { 0x000000016896a7fc, 0x0000000094d8266e }, + /* x^131072 mod p(x)` << 1, x^131136 mod p(x)` << 1 */ + { 0x000000014f187140, 0x00000000606c5e34 }, + /* x^130048 mod p(x)` << 1, x^130112 mod p(x)` << 1 */ + { 0x000000019581b9da, 0x000000019766beaa }, + /* x^129024 mod p(x)` << 1, x^129088 mod p(x)` << 1 */ + { 0x00000001091bc984, 0x00000001d80c506c }, + /* x^128000 mod p(x)` << 1, x^128064 mod p(x)` << 1 */ + { 0x000000001067223c, 0x000000001e73837c }, + /* x^126976 mod p(x)` << 1, x^127040 mod p(x)` << 1 */ + { 0x00000001ab16ea02, 0x0000000064d587de }, + /* x^125952 mod p(x)` << 1, x^126016 mod p(x)` << 1 */ + { 0x000000013c4598a8, 0x00000000f4a507b0 }, + /* x^124928 mod p(x)` << 1, x^124992 mod p(x)` << 1 */ + { 0x00000000b3735430, 0x0000000040e342fc }, + /* x^123904 mod p(x)` << 1, x^123968 mod p(x)` << 1 */ + { 0x00000001bb3fc0c0, 0x00000001d5ad9c3a }, + /* x^122880 mod p(x)` << 1, x^122944 mod p(x)` << 1 */ + { 0x00000001570ae19c, 0x0000000094a691a4 }, + /* x^121856 mod p(x)` << 1, x^121920 mod p(x)` << 1 */ + { 0x00000001ea910712, 0x00000001271ecdfa }, + /* x^120832 mod p(x)` << 1, x^120896 mod p(x)` << 1 */ + { 0x0000000167127128, 0x000000009e54475a }, + /* x^119808 mod p(x)` << 1, x^119872 mod p(x)` << 1 */ + { 0x0000000019e790a2, 0x00000000c9c099ee }, + /* x^118784 mod p(x)` << 1, x^118848 mod p(x)` << 1 */ + { 0x000000003788f710, 0x000000009a2f736c }, + /* x^117760 mod p(x)` << 1, x^117824 mod p(x)` << 1 */ + { 0x00000001682a160e, 0x00000000bb9f4996 }, + /* x^116736 mod p(x)` << 1, x^116800 mod p(x)` << 1 */ + { 0x000000007f0ebd2e, 0x00000001db688050 }, + /* x^115712 mod p(x)` << 1, x^115776 mod p(x)` << 1 */ + { 0x000000002b032080, 0x00000000e9b10af4 }, + /* x^114688 mod p(x)` << 1, x^114752 mod p(x)` << 1 */ + { 0x00000000cfd1664a, 0x000000012d4545e4 }, + /* x^113664 mod p(x)` << 1, x^113728 mod p(x)` << 1 */ + { 0x00000000aa1181c2, 0x000000000361139c }, + /* x^112640 mod p(x)` << 1, x^112704 mod p(x)` << 1 */ + { 0x00000000ddd08002, 0x00000001a5a1a3a8 }, + /* x^111616 mod p(x)` << 1, x^111680 mod p(x)` << 1 */ + { 0x00000000e8dd0446, 0x000000006844e0b0 }, + /* x^110592 mod p(x)` << 1, x^110656 mod p(x)` << 1 */ + { 0x00000001bbd94a00, 0x00000000c3762f28 }, + /* x^109568 mod p(x)` << 1, x^109632 mod p(x)` << 1 */ + { 0x00000000ab6cd180, 0x00000001d26287a2 }, + /* x^108544 mod p(x)` << 1, x^108608 mod p(x)` << 1 */ + { 0x0000000031803ce2, 0x00000001f6f0bba8 }, + /* x^107520 mod p(x)` << 1, x^107584 mod p(x)` << 1 */ + { 0x0000000024f40b0c, 0x000000002ffabd62 }, + /* x^106496 mod p(x)` << 1, x^106560 mod p(x)` << 1 */ + { 0x00000001ba1d9834, 0x00000000fb4516b8 }, + /* x^105472 mod p(x)` << 1, x^105536 mod p(x)` << 1 */ + { 0x0000000104de61aa, 0x000000018cfa961c }, + /* x^104448 mod p(x)` << 1, x^104512 mod p(x)` << 1 */ + { 0x0000000113e40d46, 0x000000019e588d52 }, + /* x^103424 mod p(x)` << 1, x^103488 mod p(x)` << 1 */ + { 0x00000001415598a0, 0x00000001180f0bbc }, + /* x^102400 mod p(x)` << 1, x^102464 mod p(x)` << 1 */ + { 0x00000000bf6c8c90, 0x00000000e1d9177a }, + /* x^101376 mod p(x)` << 1, x^101440 mod p(x)` << 1 */ + { 0x00000001788b0504, 0x0000000105abc27c }, + /* x^100352 mod p(x)` << 1, x^100416 mod p(x)` << 1 */ + { 0x0000000038385d02, 0x00000000972e4a58 }, + /* x^99328 mod p(x)` << 1, x^99392 mod p(x)` << 1 */ + { 0x00000001b6c83844, 0x0000000183499a5e }, + /* x^98304 mod p(x)` << 1, x^98368 mod p(x)` << 1 */ + { 0x0000000051061a8a, 0x00000001c96a8cca }, + /* x^97280 mod p(x)` << 1, x^97344 mod p(x)` << 1 */ + { 0x000000017351388a, 0x00000001a1a5b60c }, + /* x^96256 mod p(x)` << 1, x^96320 mod p(x)` << 1 */ + { 0x0000000132928f92, 0x00000000e4b6ac9c }, + /* x^95232 mod p(x)` << 1, x^95296 mod p(x)` << 1 */ + { 0x00000000e6b4f48a, 0x00000001807e7f5a }, + /* x^94208 mod p(x)` << 1, x^94272 mod p(x)` << 1 */ + { 0x0000000039d15e90, 0x000000017a7e3bc8 }, + /* x^93184 mod p(x)` << 1, x^93248 mod p(x)` << 1 */ + { 0x00000000312d6074, 0x00000000d73975da }, + /* x^92160 mod p(x)` << 1, x^92224 mod p(x)` << 1 */ + { 0x000000017bbb2cc4, 0x000000017375d038 }, + /* x^91136 mod p(x)` << 1, x^91200 mod p(x)` << 1 */ + { 0x000000016ded3e18, 0x00000000193680bc }, + /* x^90112 mod p(x)` << 1, x^90176 mod p(x)` << 1 */ + { 0x00000000f1638b16, 0x00000000999b06f6 }, + /* x^89088 mod p(x)` << 1, x^89152 mod p(x)` << 1 */ + { 0x00000001d38b9ecc, 0x00000001f685d2b8 }, + /* x^88064 mod p(x)` << 1, x^88128 mod p(x)` << 1 */ + { 0x000000018b8d09dc, 0x00000001f4ecbed2 }, + /* x^87040 mod p(x)` << 1, x^87104 mod p(x)` << 1 */ + { 0x00000000e7bc27d2, 0x00000000ba16f1a0 }, + /* x^86016 mod p(x)` << 1, x^86080 mod p(x)` << 1 */ + { 0x00000000275e1e96, 0x0000000115aceac4 }, + /* x^84992 mod p(x)` << 1, x^85056 mod p(x)` << 1 */ + { 0x00000000e2e3031e, 0x00000001aeff6292 }, + /* x^83968 mod p(x)` << 1, x^84032 mod p(x)` << 1 */ + { 0x00000001041c84d8, 0x000000009640124c }, + /* x^82944 mod p(x)` << 1, x^83008 mod p(x)` << 1 */ + { 0x00000000706ce672, 0x0000000114f41f02 }, + /* x^81920 mod p(x)` << 1, x^81984 mod p(x)` << 1 */ + { 0x000000015d5070da, 0x000000009c5f3586 }, + /* x^80896 mod p(x)` << 1, x^80960 mod p(x)` << 1 */ + { 0x0000000038f9493a, 0x00000001878275fa }, + /* x^79872 mod p(x)` << 1, x^79936 mod p(x)` << 1 */ + { 0x00000000a3348a76, 0x00000000ddc42ce8 }, + /* x^78848 mod p(x)` << 1, x^78912 mod p(x)` << 1 */ + { 0x00000001ad0aab92, 0x0000000181d2c73a }, + /* x^77824 mod p(x)` << 1, x^77888 mod p(x)` << 1 */ + { 0x000000019e85f712, 0x0000000141c9320a }, + /* x^76800 mod p(x)` << 1, x^76864 mod p(x)` << 1 */ + { 0x000000005a871e76, 0x000000015235719a }, + /* x^75776 mod p(x)` << 1, x^75840 mod p(x)` << 1 */ + { 0x000000017249c662, 0x00000000be27d804 }, + /* x^74752 mod p(x)` << 1, x^74816 mod p(x)` << 1 */ + { 0x000000003a084712, 0x000000006242d45a }, + /* x^73728 mod p(x)` << 1, x^73792 mod p(x)` << 1 */ + { 0x00000000ed438478, 0x000000009a53638e }, + /* x^72704 mod p(x)` << 1, x^72768 mod p(x)` << 1 */ + { 0x00000000abac34cc, 0x00000001001ecfb6 }, + /* x^71680 mod p(x)` << 1, x^71744 mod p(x)` << 1 */ + { 0x000000005f35ef3e, 0x000000016d7c2d64 }, + /* x^70656 mod p(x)` << 1, x^70720 mod p(x)` << 1 */ + { 0x0000000047d6608c, 0x00000001d0ce46c0 }, + /* x^69632 mod p(x)` << 1, x^69696 mod p(x)` << 1 */ + { 0x000000002d01470e, 0x0000000124c907b4 }, + /* x^68608 mod p(x)` << 1, x^68672 mod p(x)` << 1 */ + { 0x0000000158bbc7b0, 0x0000000018a555ca }, + /* x^67584 mod p(x)` << 1, x^67648 mod p(x)` << 1 */ + { 0x00000000c0a23e8e, 0x000000006b0980bc }, + /* x^66560 mod p(x)` << 1, x^66624 mod p(x)` << 1 */ + { 0x00000001ebd85c88, 0x000000008bbba964 }, + /* x^65536 mod p(x)` << 1, x^65600 mod p(x)` << 1 */ + { 0x000000019ee20bb2, 0x00000001070a5a1e }, + /* x^64512 mod p(x)` << 1, x^64576 mod p(x)` << 1 */ + { 0x00000001acabf2d6, 0x000000002204322a }, + /* x^63488 mod p(x)` << 1, x^63552 mod p(x)` << 1 */ + { 0x00000001b7963d56, 0x00000000a27524d0 }, + /* x^62464 mod p(x)` << 1, x^62528 mod p(x)` << 1 */ + { 0x000000017bffa1fe, 0x0000000020b1e4ba }, + /* x^61440 mod p(x)` << 1, x^61504 mod p(x)` << 1 */ + { 0x000000001f15333e, 0x0000000032cc27fc }, + /* x^60416 mod p(x)` << 1, x^60480 mod p(x)` << 1 */ + { 0x000000018593129e, 0x0000000044dd22b8 }, + /* x^59392 mod p(x)` << 1, x^59456 mod p(x)` << 1 */ + { 0x000000019cb32602, 0x00000000dffc9e0a }, + /* x^58368 mod p(x)` << 1, x^58432 mod p(x)` << 1 */ + { 0x0000000142b05cc8, 0x00000001b7a0ed14 }, + /* x^57344 mod p(x)` << 1, x^57408 mod p(x)` << 1 */ + { 0x00000001be49e7a4, 0x00000000c7842488 }, + /* x^56320 mod p(x)` << 1, x^56384 mod p(x)` << 1 */ + { 0x0000000108f69d6c, 0x00000001c02a4fee }, + /* x^55296 mod p(x)` << 1, x^55360 mod p(x)` << 1 */ + { 0x000000006c0971f0, 0x000000003c273778 }, + /* x^54272 mod p(x)` << 1, x^54336 mod p(x)` << 1 */ + { 0x000000005b16467a, 0x00000001d63f8894 }, + /* x^53248 mod p(x)` << 1, x^53312 mod p(x)` << 1 */ + { 0x00000001551a628e, 0x000000006be557d6 }, + /* x^52224 mod p(x)` << 1, x^52288 mod p(x)` << 1 */ + { 0x000000019e42ea92, 0x000000006a7806ea }, + /* x^51200 mod p(x)` << 1, x^51264 mod p(x)` << 1 */ + { 0x000000012fa83ff2, 0x000000016155aa0c }, + /* x^50176 mod p(x)` << 1, x^50240 mod p(x)` << 1 */ + { 0x000000011ca9cde0, 0x00000000908650ac }, + /* x^49152 mod p(x)` << 1, x^49216 mod p(x)` << 1 */ + { 0x00000000c8e5cd74, 0x00000000aa5a8084 }, + /* x^48128 mod p(x)` << 1, x^48192 mod p(x)` << 1 */ + { 0x0000000096c27f0c, 0x0000000191bb500a }, + /* x^47104 mod p(x)` << 1, x^47168 mod p(x)` << 1 */ + { 0x000000002baed926, 0x0000000064e9bed0 }, + /* x^46080 mod p(x)` << 1, x^46144 mod p(x)` << 1 */ + { 0x000000017c8de8d2, 0x000000009444f302 }, + /* x^45056 mod p(x)` << 1, x^45120 mod p(x)` << 1 */ + { 0x00000000d43d6068, 0x000000019db07d3c }, + /* x^44032 mod p(x)` << 1, x^44096 mod p(x)` << 1 */ + { 0x00000000cb2c4b26, 0x00000001359e3e6e }, + /* x^43008 mod p(x)` << 1, x^43072 mod p(x)` << 1 */ + { 0x0000000145b8da26, 0x00000001e4f10dd2 }, + /* x^41984 mod p(x)` << 1, x^42048 mod p(x)` << 1 */ + { 0x000000018fff4b08, 0x0000000124f5735e }, + /* x^40960 mod p(x)` << 1, x^41024 mod p(x)` << 1 */ + { 0x0000000150b58ed0, 0x0000000124760a4c }, + /* x^39936 mod p(x)` << 1, x^40000 mod p(x)` << 1 */ + { 0x00000001549f39bc, 0x000000000f1fc186 }, + /* x^38912 mod p(x)` << 1, x^38976 mod p(x)` << 1 */ + { 0x00000000ef4d2f42, 0x00000000150e4cc4 }, + /* x^37888 mod p(x)` << 1, x^37952 mod p(x)` << 1 */ + { 0x00000001b1468572, 0x000000002a6204e8 }, + /* x^36864 mod p(x)` << 1, x^36928 mod p(x)` << 1 */ + { 0x000000013d7403b2, 0x00000000beb1d432 }, + /* x^35840 mod p(x)` << 1, x^35904 mod p(x)` << 1 */ + { 0x00000001a4681842, 0x0000000135f3f1f0 }, + /* x^34816 mod p(x)` << 1, x^34880 mod p(x)` << 1 */ + { 0x0000000167714492, 0x0000000074fe2232 }, + /* x^33792 mod p(x)` << 1, x^33856 mod p(x)` << 1 */ + { 0x00000001e599099a, 0x000000001ac6e2ba }, + /* x^32768 mod p(x)` << 1, x^32832 mod p(x)` << 1 */ + { 0x00000000fe128194, 0x0000000013fca91e }, + /* x^31744 mod p(x)` << 1, x^31808 mod p(x)` << 1 */ + { 0x0000000077e8b990, 0x0000000183f4931e }, + /* x^30720 mod p(x)` << 1, x^30784 mod p(x)` << 1 */ + { 0x00000001a267f63a, 0x00000000b6d9b4e4 }, + /* x^29696 mod p(x)` << 1, x^29760 mod p(x)` << 1 */ + { 0x00000001945c245a, 0x00000000b5188656 }, + /* x^28672 mod p(x)` << 1, x^28736 mod p(x)` << 1 */ + { 0x0000000149002e76, 0x0000000027a81a84 }, + /* x^27648 mod p(x)` << 1, x^27712 mod p(x)` << 1 */ + { 0x00000001bb8310a4, 0x0000000125699258 }, + /* x^26624 mod p(x)` << 1, x^26688 mod p(x)` << 1 */ + { 0x000000019ec60bcc, 0x00000001b23de796 }, + /* x^25600 mod p(x)` << 1, x^25664 mod p(x)` << 1 */ + { 0x000000012d8590ae, 0x00000000fe4365dc }, + /* x^24576 mod p(x)` << 1, x^24640 mod p(x)` << 1 */ + { 0x0000000065b00684, 0x00000000c68f497a }, + /* x^23552 mod p(x)` << 1, x^23616 mod p(x)` << 1 */ + { 0x000000015e5aeadc, 0x00000000fbf521ee }, + /* x^22528 mod p(x)` << 1, x^22592 mod p(x)` << 1 */ + { 0x00000000b77ff2b0, 0x000000015eac3378 }, + /* x^21504 mod p(x)` << 1, x^21568 mod p(x)` << 1 */ + { 0x0000000188da2ff6, 0x0000000134914b90 }, + /* x^20480 mod p(x)` << 1, x^20544 mod p(x)` << 1 */ + { 0x0000000063da929a, 0x0000000016335cfe }, + /* x^19456 mod p(x)` << 1, x^19520 mod p(x)` << 1 */ + { 0x00000001389caa80, 0x000000010372d10c }, + /* x^18432 mod p(x)` << 1, x^18496 mod p(x)` << 1 */ + { 0x000000013db599d2, 0x000000015097b908 }, + /* x^17408 mod p(x)` << 1, x^17472 mod p(x)` << 1 */ + { 0x0000000122505a86, 0x00000001227a7572 }, + /* x^16384 mod p(x)` << 1, x^16448 mod p(x)` << 1 */ + { 0x000000016bd72746, 0x000000009a8f75c0 }, + /* x^15360 mod p(x)` << 1, x^15424 mod p(x)` << 1 */ + { 0x00000001c3faf1d4, 0x00000000682c77a2 }, + /* x^14336 mod p(x)` << 1, x^14400 mod p(x)` << 1 */ + { 0x00000001111c826c, 0x00000000231f091c }, + /* x^13312 mod p(x)` << 1, x^13376 mod p(x)` << 1 */ + { 0x00000000153e9fb2, 0x000000007d4439f2 }, + /* x^12288 mod p(x)` << 1, x^12352 mod p(x)` << 1 */ + { 0x000000002b1f7b60, 0x000000017e221efc }, + /* x^11264 mod p(x)` << 1, x^11328 mod p(x)` << 1 */ + { 0x00000000b1dba570, 0x0000000167457c38 }, + /* x^10240 mod p(x)` << 1, x^10304 mod p(x)` << 1 */ + { 0x00000001f6397b76, 0x00000000bdf081c4 }, + /* x^9216 mod p(x)` << 1, x^9280 mod p(x)` << 1 */ + { 0x0000000156335214, 0x000000016286d6b0 }, + /* x^8192 mod p(x)` << 1, x^8256 mod p(x)` << 1 */ + { 0x00000001d70e3986, 0x00000000c84f001c }, + /* x^7168 mod p(x)` << 1, x^7232 mod p(x)` << 1 */ + { 0x000000003701a774, 0x0000000064efe7c0 }, + /* x^6144 mod p(x)` << 1, x^6208 mod p(x)` << 1 */ + { 0x00000000ac81ef72, 0x000000000ac2d904 }, + /* x^5120 mod p(x)` << 1, x^5184 mod p(x)` << 1 */ + { 0x0000000133212464, 0x00000000fd226d14 }, + /* x^4096 mod p(x)` << 1, x^4160 mod p(x)` << 1 */ + { 0x00000000e4e45610, 0x000000011cfd42e0 }, + /* x^3072 mod p(x)` << 1, x^3136 mod p(x)` << 1 */ + { 0x000000000c1bd370, 0x000000016e5a5678 }, + /* x^2048 mod p(x)` << 1, x^2112 mod p(x)` << 1 */ + { 0x00000001a7b9e7a6, 0x00000001d888fe22 }, + /* x^1024 mod p(x)` << 1, x^1088 mod p(x)` << 1 */ + { 0x000000007d657a10, 0x00000001af77fcd4 } +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + /* x^261120 mod p(x)` << 1, x^261184 mod p(x)` << 1 */ + { 0x00000001651797d2, 0x0000000099ea94a8 }, + /* x^260096 mod p(x)` << 1, x^260160 mod p(x)` << 1 */ + { 0x0000000021e0d56c, 0x00000000945a8420 }, + /* x^259072 mod p(x)` << 1, x^259136 mod p(x)` << 1 */ + { 0x000000000f95ecaa, 0x0000000030762706 }, + /* x^258048 mod p(x)` << 1, x^258112 mod p(x)` << 1 */ + { 0x00000001ebd224ac, 0x00000001a52fc582 }, + /* x^257024 mod p(x)` << 1, x^257088 mod p(x)` << 1 */ + { 0x000000000ccb97ca, 0x00000001a4a7167a }, + /* x^256000 mod p(x)` << 1, x^256064 mod p(x)` << 1 */ + { 0x00000001006ec8a8, 0x000000000c18249a }, + /* x^254976 mod p(x)` << 1, x^255040 mod p(x)` << 1 */ + { 0x000000014f58f196, 0x00000000a924ae7c }, + /* x^253952 mod p(x)` << 1, x^254016 mod p(x)` << 1 */ + { 0x00000001a7192ca6, 0x00000001e12ccc12 }, + /* x^252928 mod p(x)` << 1, x^252992 mod p(x)` << 1 */ + { 0x000000019a64bab2, 0x00000000a0b9d4ac }, + /* x^251904 mod p(x)` << 1, x^251968 mod p(x)` << 1 */ + { 0x0000000014f4ed2e, 0x0000000095e8ddfe }, + /* x^250880 mod p(x)` << 1, x^250944 mod p(x)` << 1 */ + { 0x000000011092b6a2, 0x00000000233fddc4 }, + /* x^249856 mod p(x)` << 1, x^249920 mod p(x)` << 1 */ + { 0x00000000c8a1629c, 0x00000001b4529b62 }, + /* x^248832 mod p(x)` << 1, x^248896 mod p(x)` << 1 */ + { 0x000000017bf32e8e, 0x00000001a7fa0e64 }, + /* x^247808 mod p(x)` << 1, x^247872 mod p(x)` << 1 */ + { 0x00000001f8cc6582, 0x00000001b5334592 }, + /* x^246784 mod p(x)` << 1, x^246848 mod p(x)` << 1 */ + { 0x000000008631ddf0, 0x000000011f8ee1b4 }, + /* x^245760 mod p(x)` << 1, x^245824 mod p(x)` << 1 */ + { 0x000000007e5a76d0, 0x000000006252e632 }, + /* x^244736 mod p(x)` << 1, x^244800 mod p(x)` << 1 */ + { 0x000000002b09b31c, 0x00000000ab973e84 }, + /* x^243712 mod p(x)` << 1, x^243776 mod p(x)` << 1 */ + { 0x00000001b2df1f84, 0x000000007734f5ec }, + /* x^242688 mod p(x)` << 1, x^242752 mod p(x)` << 1 */ + { 0x00000001d6f56afc, 0x000000007c547798 }, + /* x^241664 mod p(x)` << 1, x^241728 mod p(x)` << 1 */ + { 0x00000001b9b5e70c, 0x000000007ec40210 }, + /* x^240640 mod p(x)` << 1, x^240704 mod p(x)` << 1 */ + { 0x0000000034b626d2, 0x00000001ab1695a8 }, + /* x^239616 mod p(x)` << 1, x^239680 mod p(x)` << 1 */ + { 0x000000014c53479a, 0x0000000090494bba }, + /* x^238592 mod p(x)` << 1, x^238656 mod p(x)` << 1 */ + { 0x00000001a6d179a4, 0x00000001123fb816 }, + /* x^237568 mod p(x)` << 1, x^237632 mod p(x)` << 1 */ + { 0x000000015abd16b4, 0x00000001e188c74c }, + /* x^236544 mod p(x)` << 1, x^236608 mod p(x)` << 1 */ + { 0x00000000018f9852, 0x00000001c2d3451c }, + /* x^235520 mod p(x)` << 1, x^235584 mod p(x)` << 1 */ + { 0x000000001fb3084a, 0x00000000f55cf1ca }, + /* x^234496 mod p(x)` << 1, x^234560 mod p(x)` << 1 */ + { 0x00000000c53dfb04, 0x00000001a0531540 }, + /* x^233472 mod p(x)` << 1, x^233536 mod p(x)` << 1 */ + { 0x00000000e10c9ad6, 0x0000000132cd7ebc }, + /* x^232448 mod p(x)` << 1, x^232512 mod p(x)` << 1 */ + { 0x0000000025aa994a, 0x0000000073ab7f36 }, + /* x^231424 mod p(x)` << 1, x^231488 mod p(x)` << 1 */ + { 0x00000000fa3a74c4, 0x0000000041aed1c2 }, + /* x^230400 mod p(x)` << 1, x^230464 mod p(x)` << 1 */ + { 0x0000000033eb3f40, 0x0000000136c53800 }, + /* x^229376 mod p(x)` << 1, x^229440 mod p(x)` << 1 */ + { 0x000000017193f296, 0x0000000126835a30 }, + /* x^228352 mod p(x)` << 1, x^228416 mod p(x)` << 1 */ + { 0x0000000043f6c86a, 0x000000006241b502 }, + /* x^227328 mod p(x)` << 1, x^227392 mod p(x)` << 1 */ + { 0x000000016b513ec6, 0x00000000d5196ad4 }, + /* x^226304 mod p(x)` << 1, x^226368 mod p(x)` << 1 */ + { 0x00000000c8f25b4e, 0x000000009cfa769a }, + /* x^225280 mod p(x)` << 1, x^225344 mod p(x)` << 1 */ + { 0x00000001a45048ec, 0x00000000920e5df4 }, + /* x^224256 mod p(x)` << 1, x^224320 mod p(x)` << 1 */ + { 0x000000000c441004, 0x0000000169dc310e }, + /* x^223232 mod p(x)` << 1, x^223296 mod p(x)` << 1 */ + { 0x000000000e17cad6, 0x0000000009fc331c }, + /* x^222208 mod p(x)` << 1, x^222272 mod p(x)` << 1 */ + { 0x00000001253ae964, 0x000000010d94a81e }, + /* x^221184 mod p(x)` << 1, x^221248 mod p(x)` << 1 */ + { 0x00000001d7c88ebc, 0x0000000027a20ab2 }, + /* x^220160 mod p(x)` << 1, x^220224 mod p(x)` << 1 */ + { 0x00000001e7ca913a, 0x0000000114f87504 }, + /* x^219136 mod p(x)` << 1, x^219200 mod p(x)` << 1 */ + { 0x0000000033ed078a, 0x000000004b076d96 }, + /* x^218112 mod p(x)` << 1, x^218176 mod p(x)` << 1 */ + { 0x00000000e1839c78, 0x00000000da4d1e74 }, + /* x^217088 mod p(x)` << 1, x^217152 mod p(x)` << 1 */ + { 0x00000001322b267e, 0x000000001b81f672 }, + /* x^216064 mod p(x)` << 1, x^216128 mod p(x)` << 1 */ + { 0x00000000638231b6, 0x000000009367c988 }, + /* x^215040 mod p(x)` << 1, x^215104 mod p(x)` << 1 */ + { 0x00000001ee7f16f4, 0x00000001717214ca }, + /* x^214016 mod p(x)` << 1, x^214080 mod p(x)` << 1 */ + { 0x0000000117d9924a, 0x000000009f47d820 }, + /* x^212992 mod p(x)` << 1, x^213056 mod p(x)` << 1 */ + { 0x00000000e1a9e0c4, 0x000000010d9a47d2 }, + /* x^211968 mod p(x)` << 1, x^212032 mod p(x)` << 1 */ + { 0x00000001403731dc, 0x00000000a696c58c }, + /* x^210944 mod p(x)` << 1, x^211008 mod p(x)` << 1 */ + { 0x00000001a5ea9682, 0x000000002aa28ec6 }, + /* x^209920 mod p(x)` << 1, x^209984 mod p(x)` << 1 */ + { 0x0000000101c5c578, 0x00000001fe18fd9a }, + /* x^208896 mod p(x)` << 1, x^208960 mod p(x)` << 1 */ + { 0x00000000dddf6494, 0x000000019d4fc1ae }, + /* x^207872 mod p(x)` << 1, x^207936 mod p(x)` << 1 */ + { 0x00000000f1c3db28, 0x00000001ba0e3dea }, + /* x^206848 mod p(x)` << 1, x^206912 mod p(x)` << 1 */ + { 0x000000013112fb9c, 0x0000000074b59a5e }, + /* x^205824 mod p(x)` << 1, x^205888 mod p(x)` << 1 */ + { 0x00000000b680b906, 0x00000000f2b5ea98 }, + /* x^204800 mod p(x)` << 1, x^204864 mod p(x)` << 1 */ + { 0x000000001a282932, 0x0000000187132676 }, + /* x^203776 mod p(x)` << 1, x^203840 mod p(x)` << 1 */ + { 0x0000000089406e7e, 0x000000010a8c6ad4 }, + /* x^202752 mod p(x)` << 1, x^202816 mod p(x)` << 1 */ + { 0x00000001def6be8c, 0x00000001e21dfe70 }, + /* x^201728 mod p(x)` << 1, x^201792 mod p(x)` << 1 */ + { 0x0000000075258728, 0x00000001da0050e4 }, + /* x^200704 mod p(x)` << 1, x^200768 mod p(x)` << 1 */ + { 0x000000019536090a, 0x00000000772172ae }, + /* x^199680 mod p(x)` << 1, x^199744 mod p(x)` << 1 */ + { 0x00000000f2455bfc, 0x00000000e47724aa }, + /* x^198656 mod p(x)` << 1, x^198720 mod p(x)` << 1 */ + { 0x000000018c40baf4, 0x000000003cd63ac4 }, + /* x^197632 mod p(x)` << 1, x^197696 mod p(x)` << 1 */ + { 0x000000004cd390d4, 0x00000001bf47d352 }, + /* x^196608 mod p(x)` << 1, x^196672 mod p(x)` << 1 */ + { 0x00000001e4ece95a, 0x000000018dc1d708 }, + /* x^195584 mod p(x)` << 1, x^195648 mod p(x)` << 1 */ + { 0x000000001a3ee918, 0x000000002d4620a4 }, + /* x^194560 mod p(x)` << 1, x^194624 mod p(x)` << 1 */ + { 0x000000007c652fb8, 0x0000000058fd1740 }, + /* x^193536 mod p(x)` << 1, x^193600 mod p(x)` << 1 */ + { 0x000000011c67842c, 0x00000000dadd9bfc }, + /* x^192512 mod p(x)` << 1, x^192576 mod p(x)` << 1 */ + { 0x00000000254f759c, 0x00000001ea2140be }, + /* x^191488 mod p(x)` << 1, x^191552 mod p(x)` << 1 */ + { 0x000000007ece94ca, 0x000000009de128ba }, + /* x^190464 mod p(x)` << 1, x^190528 mod p(x)` << 1 */ + { 0x0000000038f258c2, 0x000000013ac3aa8e }, + /* x^189440 mod p(x)` << 1, x^189504 mod p(x)` << 1 */ + { 0x00000001cdf17b00, 0x0000000099980562 }, + /* x^188416 mod p(x)` << 1, x^188480 mod p(x)` << 1 */ + { 0x000000011f882c16, 0x00000001c1579c86 }, + /* x^187392 mod p(x)` << 1, x^187456 mod p(x)` << 1 */ + { 0x0000000100093fc8, 0x0000000068dbbf94 }, + /* x^186368 mod p(x)` << 1, x^186432 mod p(x)` << 1 */ + { 0x00000001cd684f16, 0x000000004509fb04 }, + /* x^185344 mod p(x)` << 1, x^185408 mod p(x)` << 1 */ + { 0x000000004bc6a70a, 0x00000001202f6398 }, + /* x^184320 mod p(x)` << 1, x^184384 mod p(x)` << 1 */ + { 0x000000004fc7e8e4, 0x000000013aea243e }, + /* x^183296 mod p(x)` << 1, x^183360 mod p(x)` << 1 */ + { 0x0000000130103f1c, 0x00000001b4052ae6 }, + /* x^182272 mod p(x)` << 1, x^182336 mod p(x)` << 1 */ + { 0x0000000111b0024c, 0x00000001cd2a0ae8 }, + /* x^181248 mod p(x)` << 1, x^181312 mod p(x)` << 1 */ + { 0x000000010b3079da, 0x00000001fe4aa8b4 }, + /* x^180224 mod p(x)` << 1, x^180288 mod p(x)` << 1 */ + { 0x000000010192bcc2, 0x00000001d1559a42 }, + /* x^179200 mod p(x)` << 1, x^179264 mod p(x)` << 1 */ + { 0x0000000074838d50, 0x00000001f3e05ecc }, + /* x^178176 mod p(x)` << 1, x^178240 mod p(x)` << 1 */ + { 0x000000001b20f520, 0x0000000104ddd2cc }, + /* x^177152 mod p(x)` << 1, x^177216 mod p(x)` << 1 */ + { 0x0000000050c3590a, 0x000000015393153c }, + /* x^176128 mod p(x)` << 1, x^176192 mod p(x)` << 1 */ + { 0x00000000b41cac8e, 0x0000000057e942c6 }, + /* x^175104 mod p(x)` << 1, x^175168 mod p(x)` << 1 */ + { 0x000000000c72cc78, 0x000000012c633850 }, + /* x^174080 mod p(x)` << 1, x^174144 mod p(x)` << 1 */ + { 0x0000000030cdb032, 0x00000000ebcaae4c }, + /* x^173056 mod p(x)` << 1, x^173120 mod p(x)` << 1 */ + { 0x000000013e09fc32, 0x000000013ee532a6 }, + /* x^172032 mod p(x)` << 1, x^172096 mod p(x)` << 1 */ + { 0x000000001ed624d2, 0x00000001bf0cbc7e }, + /* x^171008 mod p(x)` << 1, x^171072 mod p(x)` << 1 */ + { 0x00000000781aee1a, 0x00000000d50b7a5a }, + /* x^169984 mod p(x)` << 1, x^170048 mod p(x)` << 1 */ + { 0x00000001c4d8348c, 0x0000000002fca6e8 }, + /* x^168960 mod p(x)` << 1, x^169024 mod p(x)` << 1 */ + { 0x0000000057a40336, 0x000000007af40044 }, + /* x^167936 mod p(x)` << 1, x^168000 mod p(x)` << 1 */ + { 0x0000000085544940, 0x0000000016178744 }, + /* x^166912 mod p(x)` << 1, x^166976 mod p(x)` << 1 */ + { 0x000000019cd21e80, 0x000000014c177458 }, + /* x^165888 mod p(x)` << 1, x^165952 mod p(x)` << 1 */ + { 0x000000013eb95bc0, 0x000000011b6ddf04 }, + /* x^164864 mod p(x)` << 1, x^164928 mod p(x)` << 1 */ + { 0x00000001dfc9fdfc, 0x00000001f3e29ccc }, + /* x^163840 mod p(x)` << 1, x^163904 mod p(x)` << 1 */ + { 0x00000000cd028bc2, 0x0000000135ae7562 }, + /* x^162816 mod p(x)` << 1, x^162880 mod p(x)` << 1 */ + { 0x0000000090db8c44, 0x0000000190ef812c }, + /* x^161792 mod p(x)` << 1, x^161856 mod p(x)` << 1 */ + { 0x000000010010a4ce, 0x0000000067a2c786 }, + /* x^160768 mod p(x)` << 1, x^160832 mod p(x)` << 1 */ + { 0x00000001c8f4c72c, 0x0000000048b9496c }, + /* x^159744 mod p(x)` << 1, x^159808 mod p(x)` << 1 */ + { 0x000000001c26170c, 0x000000015a422de6 }, + /* x^158720 mod p(x)` << 1, x^158784 mod p(x)` << 1 */ + { 0x00000000e3fccf68, 0x00000001ef0e3640 }, + /* x^157696 mod p(x)` << 1, x^157760 mod p(x)` << 1 */ + { 0x00000000d513ed24, 0x00000001006d2d26 }, + /* x^156672 mod p(x)` << 1, x^156736 mod p(x)` << 1 */ + { 0x00000000141beada, 0x00000001170d56d6 }, + /* x^155648 mod p(x)` << 1, x^155712 mod p(x)` << 1 */ + { 0x000000011071aea0, 0x00000000a5fb613c }, + /* x^154624 mod p(x)` << 1, x^154688 mod p(x)` << 1 */ + { 0x000000012e19080a, 0x0000000040bbf7fc }, + /* x^153600 mod p(x)` << 1, x^153664 mod p(x)` << 1 */ + { 0x0000000100ecf826, 0x000000016ac3a5b2 }, + /* x^152576 mod p(x)` << 1, x^152640 mod p(x)` << 1 */ + { 0x0000000069b09412, 0x00000000abf16230 }, + /* x^151552 mod p(x)` << 1, x^151616 mod p(x)` << 1 */ + { 0x0000000122297bac, 0x00000001ebe23fac }, + /* x^150528 mod p(x)` << 1, x^150592 mod p(x)` << 1 */ + { 0x00000000e9e4b068, 0x000000008b6a0894 }, + /* x^149504 mod p(x)` << 1, x^149568 mod p(x)` << 1 */ + { 0x000000004b38651a, 0x00000001288ea478 }, + /* x^148480 mod p(x)` << 1, x^148544 mod p(x)` << 1 */ + { 0x00000001468360e2, 0x000000016619c442 }, + /* x^147456 mod p(x)` << 1, x^147520 mod p(x)` << 1 */ + { 0x00000000121c2408, 0x0000000086230038 }, + /* x^146432 mod p(x)` << 1, x^146496 mod p(x)` << 1 */ + { 0x00000000da7e7d08, 0x000000017746a756 }, + /* x^145408 mod p(x)` << 1, x^145472 mod p(x)` << 1 */ + { 0x00000001058d7652, 0x0000000191b8f8f8 }, + /* x^144384 mod p(x)` << 1, x^144448 mod p(x)` << 1 */ + { 0x000000014a098a90, 0x000000008e167708 }, + /* x^143360 mod p(x)` << 1, x^143424 mod p(x)` << 1 */ + { 0x0000000020dbe72e, 0x0000000148b22d54 }, + /* x^142336 mod p(x)` << 1, x^142400 mod p(x)` << 1 */ + { 0x000000011e7323e8, 0x0000000044ba2c3c }, + /* x^141312 mod p(x)` << 1, x^141376 mod p(x)` << 1 */ + { 0x00000000d5d4bf94, 0x00000000b54d2b52 }, + /* x^140288 mod p(x)` << 1, x^140352 mod p(x)` << 1 */ + { 0x0000000199d8746c, 0x0000000005a4fd8a }, + /* x^139264 mod p(x)` << 1, x^139328 mod p(x)` << 1 */ + { 0x00000000ce9ca8a0, 0x0000000139f9fc46 }, + /* x^138240 mod p(x)` << 1, x^138304 mod p(x)` << 1 */ + { 0x00000000136edece, 0x000000015a1fa824 }, + /* x^137216 mod p(x)` << 1, x^137280 mod p(x)` << 1 */ + { 0x000000019b92a068, 0x000000000a61ae4c }, + /* x^136192 mod p(x)` << 1, x^136256 mod p(x)` << 1 */ + { 0x0000000071d62206, 0x0000000145e9113e }, + /* x^135168 mod p(x)` << 1, x^135232 mod p(x)` << 1 */ + { 0x00000000dfc50158, 0x000000006a348448 }, + /* x^134144 mod p(x)` << 1, x^134208 mod p(x)` << 1 */ + { 0x00000001517626bc, 0x000000004d80a08c }, + /* x^133120 mod p(x)` << 1, x^133184 mod p(x)` << 1 */ + { 0x0000000148d1e4fa, 0x000000014b6837a0 }, + /* x^132096 mod p(x)` << 1, x^132160 mod p(x)` << 1 */ + { 0x0000000094d8266e, 0x000000016896a7fc }, + /* x^131072 mod p(x)` << 1, x^131136 mod p(x)` << 1 */ + { 0x00000000606c5e34, 0x000000014f187140 }, + /* x^130048 mod p(x)` << 1, x^130112 mod p(x)` << 1 */ + { 0x000000019766beaa, 0x000000019581b9da }, + /* x^129024 mod p(x)` << 1, x^129088 mod p(x)` << 1 */ + { 0x00000001d80c506c, 0x00000001091bc984 }, + /* x^128000 mod p(x)` << 1, x^128064 mod p(x)` << 1 */ + { 0x000000001e73837c, 0x000000001067223c }, + /* x^126976 mod p(x)` << 1, x^127040 mod p(x)` << 1 */ + { 0x0000000064d587de, 0x00000001ab16ea02 }, + /* x^125952 mod p(x)` << 1, x^126016 mod p(x)` << 1 */ + { 0x00000000f4a507b0, 0x000000013c4598a8 }, + /* x^124928 mod p(x)` << 1, x^124992 mod p(x)` << 1 */ + { 0x0000000040e342fc, 0x00000000b3735430 }, + /* x^123904 mod p(x)` << 1, x^123968 mod p(x)` << 1 */ + { 0x00000001d5ad9c3a, 0x00000001bb3fc0c0 }, + /* x^122880 mod p(x)` << 1, x^122944 mod p(x)` << 1 */ + { 0x0000000094a691a4, 0x00000001570ae19c }, + /* x^121856 mod p(x)` << 1, x^121920 mod p(x)` << 1 */ + { 0x00000001271ecdfa, 0x00000001ea910712 }, + /* x^120832 mod p(x)` << 1, x^120896 mod p(x)` << 1 */ + { 0x000000009e54475a, 0x0000000167127128 }, + /* x^119808 mod p(x)` << 1, x^119872 mod p(x)` << 1 */ + { 0x00000000c9c099ee, 0x0000000019e790a2 }, + /* x^118784 mod p(x)` << 1, x^118848 mod p(x)` << 1 */ + { 0x000000009a2f736c, 0x000000003788f710 }, + /* x^117760 mod p(x)` << 1, x^117824 mod p(x)` << 1 */ + { 0x00000000bb9f4996, 0x00000001682a160e }, + /* x^116736 mod p(x)` << 1, x^116800 mod p(x)` << 1 */ + { 0x00000001db688050, 0x000000007f0ebd2e }, + /* x^115712 mod p(x)` << 1, x^115776 mod p(x)` << 1 */ + { 0x00000000e9b10af4, 0x000000002b032080 }, + /* x^114688 mod p(x)` << 1, x^114752 mod p(x)` << 1 */ + { 0x000000012d4545e4, 0x00000000cfd1664a }, + /* x^113664 mod p(x)` << 1, x^113728 mod p(x)` << 1 */ + { 0x000000000361139c, 0x00000000aa1181c2 }, + /* x^112640 mod p(x)` << 1, x^112704 mod p(x)` << 1 */ + { 0x00000001a5a1a3a8, 0x00000000ddd08002 }, + /* x^111616 mod p(x)` << 1, x^111680 mod p(x)` << 1 */ + { 0x000000006844e0b0, 0x00000000e8dd0446 }, + /* x^110592 mod p(x)` << 1, x^110656 mod p(x)` << 1 */ + { 0x00000000c3762f28, 0x00000001bbd94a00 }, + /* x^109568 mod p(x)` << 1, x^109632 mod p(x)` << 1 */ + { 0x00000001d26287a2, 0x00000000ab6cd180 }, + /* x^108544 mod p(x)` << 1, x^108608 mod p(x)` << 1 */ + { 0x00000001f6f0bba8, 0x0000000031803ce2 }, + /* x^107520 mod p(x)` << 1, x^107584 mod p(x)` << 1 */ + { 0x000000002ffabd62, 0x0000000024f40b0c }, + /* x^106496 mod p(x)` << 1, x^106560 mod p(x)` << 1 */ + { 0x00000000fb4516b8, 0x00000001ba1d9834 }, + /* x^105472 mod p(x)` << 1, x^105536 mod p(x)` << 1 */ + { 0x000000018cfa961c, 0x0000000104de61aa }, + /* x^104448 mod p(x)` << 1, x^104512 mod p(x)` << 1 */ + { 0x000000019e588d52, 0x0000000113e40d46 }, + /* x^103424 mod p(x)` << 1, x^103488 mod p(x)` << 1 */ + { 0x00000001180f0bbc, 0x00000001415598a0 }, + /* x^102400 mod p(x)` << 1, x^102464 mod p(x)` << 1 */ + { 0x00000000e1d9177a, 0x00000000bf6c8c90 }, + /* x^101376 mod p(x)` << 1, x^101440 mod p(x)` << 1 */ + { 0x0000000105abc27c, 0x00000001788b0504 }, + /* x^100352 mod p(x)` << 1, x^100416 mod p(x)` << 1 */ + { 0x00000000972e4a58, 0x0000000038385d02 }, + /* x^99328 mod p(x)` << 1, x^99392 mod p(x)` << 1 */ + { 0x0000000183499a5e, 0x00000001b6c83844 }, + /* x^98304 mod p(x)` << 1, x^98368 mod p(x)` << 1 */ + { 0x00000001c96a8cca, 0x0000000051061a8a }, + /* x^97280 mod p(x)` << 1, x^97344 mod p(x)` << 1 */ + { 0x00000001a1a5b60c, 0x000000017351388a }, + /* x^96256 mod p(x)` << 1, x^96320 mod p(x)` << 1 */ + { 0x00000000e4b6ac9c, 0x0000000132928f92 }, + /* x^95232 mod p(x)` << 1, x^95296 mod p(x)` << 1 */ + { 0x00000001807e7f5a, 0x00000000e6b4f48a }, + /* x^94208 mod p(x)` << 1, x^94272 mod p(x)` << 1 */ + { 0x000000017a7e3bc8, 0x0000000039d15e90 }, + /* x^93184 mod p(x)` << 1, x^93248 mod p(x)` << 1 */ + { 0x00000000d73975da, 0x00000000312d6074 }, + /* x^92160 mod p(x)` << 1, x^92224 mod p(x)` << 1 */ + { 0x000000017375d038, 0x000000017bbb2cc4 }, + /* x^91136 mod p(x)` << 1, x^91200 mod p(x)` << 1 */ + { 0x00000000193680bc, 0x000000016ded3e18 }, + /* x^90112 mod p(x)` << 1, x^90176 mod p(x)` << 1 */ + { 0x00000000999b06f6, 0x00000000f1638b16 }, + /* x^89088 mod p(x)` << 1, x^89152 mod p(x)` << 1 */ + { 0x00000001f685d2b8, 0x00000001d38b9ecc }, + /* x^88064 mod p(x)` << 1, x^88128 mod p(x)` << 1 */ + { 0x00000001f4ecbed2, 0x000000018b8d09dc }, + /* x^87040 mod p(x)` << 1, x^87104 mod p(x)` << 1 */ + { 0x00000000ba16f1a0, 0x00000000e7bc27d2 }, + /* x^86016 mod p(x)` << 1, x^86080 mod p(x)` << 1 */ + { 0x0000000115aceac4, 0x00000000275e1e96 }, + /* x^84992 mod p(x)` << 1, x^85056 mod p(x)` << 1 */ + { 0x00000001aeff6292, 0x00000000e2e3031e }, + /* x^83968 mod p(x)` << 1, x^84032 mod p(x)` << 1 */ + { 0x000000009640124c, 0x00000001041c84d8 }, + /* x^82944 mod p(x)` << 1, x^83008 mod p(x)` << 1 */ + { 0x0000000114f41f02, 0x00000000706ce672 }, + /* x^81920 mod p(x)` << 1, x^81984 mod p(x)` << 1 */ + { 0x000000009c5f3586, 0x000000015d5070da }, + /* x^80896 mod p(x)` << 1, x^80960 mod p(x)` << 1 */ + { 0x00000001878275fa, 0x0000000038f9493a }, + /* x^79872 mod p(x)` << 1, x^79936 mod p(x)` << 1 */ + { 0x00000000ddc42ce8, 0x00000000a3348a76 }, + /* x^78848 mod p(x)` << 1, x^78912 mod p(x)` << 1 */ + { 0x0000000181d2c73a, 0x00000001ad0aab92 }, + /* x^77824 mod p(x)` << 1, x^77888 mod p(x)` << 1 */ + { 0x0000000141c9320a, 0x000000019e85f712 }, + /* x^76800 mod p(x)` << 1, x^76864 mod p(x)` << 1 */ + { 0x000000015235719a, 0x000000005a871e76 }, + /* x^75776 mod p(x)` << 1, x^75840 mod p(x)` << 1 */ + { 0x00000000be27d804, 0x000000017249c662 }, + /* x^74752 mod p(x)` << 1, x^74816 mod p(x)` << 1 */ + { 0x000000006242d45a, 0x000000003a084712 }, + /* x^73728 mod p(x)` << 1, x^73792 mod p(x)` << 1 */ + { 0x000000009a53638e, 0x00000000ed438478 }, + /* x^72704 mod p(x)` << 1, x^72768 mod p(x)` << 1 */ + { 0x00000001001ecfb6, 0x00000000abac34cc }, + /* x^71680 mod p(x)` << 1, x^71744 mod p(x)` << 1 */ + { 0x000000016d7c2d64, 0x000000005f35ef3e }, + /* x^70656 mod p(x)` << 1, x^70720 mod p(x)` << 1 */ + { 0x00000001d0ce46c0, 0x0000000047d6608c }, + /* x^69632 mod p(x)` << 1, x^69696 mod p(x)` << 1 */ + { 0x0000000124c907b4, 0x000000002d01470e }, + /* x^68608 mod p(x)` << 1, x^68672 mod p(x)` << 1 */ + { 0x0000000018a555ca, 0x0000000158bbc7b0 }, + /* x^67584 mod p(x)` << 1, x^67648 mod p(x)` << 1 */ + { 0x000000006b0980bc, 0x00000000c0a23e8e }, + /* x^66560 mod p(x)` << 1, x^66624 mod p(x)` << 1 */ + { 0x000000008bbba964, 0x00000001ebd85c88 }, + /* x^65536 mod p(x)` << 1, x^65600 mod p(x)` << 1 */ + { 0x00000001070a5a1e, 0x000000019ee20bb2 }, + /* x^64512 mod p(x)` << 1, x^64576 mod p(x)` << 1 */ + { 0x000000002204322a, 0x00000001acabf2d6 }, + /* x^63488 mod p(x)` << 1, x^63552 mod p(x)` << 1 */ + { 0x00000000a27524d0, 0x00000001b7963d56 }, + /* x^62464 mod p(x)` << 1, x^62528 mod p(x)` << 1 */ + { 0x0000000020b1e4ba, 0x000000017bffa1fe }, + /* x^61440 mod p(x)` << 1, x^61504 mod p(x)` << 1 */ + { 0x0000000032cc27fc, 0x000000001f15333e }, + /* x^60416 mod p(x)` << 1, x^60480 mod p(x)` << 1 */ + { 0x0000000044dd22b8, 0x000000018593129e }, + /* x^59392 mod p(x)` << 1, x^59456 mod p(x)` << 1 */ + { 0x00000000dffc9e0a, 0x000000019cb32602 }, + /* x^58368 mod p(x)` << 1, x^58432 mod p(x)` << 1 */ + { 0x00000001b7a0ed14, 0x0000000142b05cc8 }, + /* x^57344 mod p(x)` << 1, x^57408 mod p(x)` << 1 */ + { 0x00000000c7842488, 0x00000001be49e7a4 }, + /* x^56320 mod p(x)` << 1, x^56384 mod p(x)` << 1 */ + { 0x00000001c02a4fee, 0x0000000108f69d6c }, + /* x^55296 mod p(x)` << 1, x^55360 mod p(x)` << 1 */ + { 0x000000003c273778, 0x000000006c0971f0 }, + /* x^54272 mod p(x)` << 1, x^54336 mod p(x)` << 1 */ + { 0x00000001d63f8894, 0x000000005b16467a }, + /* x^53248 mod p(x)` << 1, x^53312 mod p(x)` << 1 */ + { 0x000000006be557d6, 0x00000001551a628e }, + /* x^52224 mod p(x)` << 1, x^52288 mod p(x)` << 1 */ + { 0x000000006a7806ea, 0x000000019e42ea92 }, + /* x^51200 mod p(x)` << 1, x^51264 mod p(x)` << 1 */ + { 0x000000016155aa0c, 0x000000012fa83ff2 }, + /* x^50176 mod p(x)` << 1, x^50240 mod p(x)` << 1 */ + { 0x00000000908650ac, 0x000000011ca9cde0 }, + /* x^49152 mod p(x)` << 1, x^49216 mod p(x)` << 1 */ + { 0x00000000aa5a8084, 0x00000000c8e5cd74 }, + /* x^48128 mod p(x)` << 1, x^48192 mod p(x)` << 1 */ + { 0x0000000191bb500a, 0x0000000096c27f0c }, + /* x^47104 mod p(x)` << 1, x^47168 mod p(x)` << 1 */ + { 0x0000000064e9bed0, 0x000000002baed926 }, + /* x^46080 mod p(x)` << 1, x^46144 mod p(x)` << 1 */ + { 0x000000009444f302, 0x000000017c8de8d2 }, + /* x^45056 mod p(x)` << 1, x^45120 mod p(x)` << 1 */ + { 0x000000019db07d3c, 0x00000000d43d6068 }, + /* x^44032 mod p(x)` << 1, x^44096 mod p(x)` << 1 */ + { 0x00000001359e3e6e, 0x00000000cb2c4b26 }, + /* x^43008 mod p(x)` << 1, x^43072 mod p(x)` << 1 */ + { 0x00000001e4f10dd2, 0x0000000145b8da26 }, + /* x^41984 mod p(x)` << 1, x^42048 mod p(x)` << 1 */ + { 0x0000000124f5735e, 0x000000018fff4b08 }, + /* x^40960 mod p(x)` << 1, x^41024 mod p(x)` << 1 */ + { 0x0000000124760a4c, 0x0000000150b58ed0 }, + /* x^39936 mod p(x)` << 1, x^40000 mod p(x)` << 1 */ + { 0x000000000f1fc186, 0x00000001549f39bc }, + /* x^38912 mod p(x)` << 1, x^38976 mod p(x)` << 1 */ + { 0x00000000150e4cc4, 0x00000000ef4d2f42 }, + /* x^37888 mod p(x)` << 1, x^37952 mod p(x)` << 1 */ + { 0x000000002a6204e8, 0x00000001b1468572 }, + /* x^36864 mod p(x)` << 1, x^36928 mod p(x)` << 1 */ + { 0x00000000beb1d432, 0x000000013d7403b2 }, + /* x^35840 mod p(x)` << 1, x^35904 mod p(x)` << 1 */ + { 0x0000000135f3f1f0, 0x00000001a4681842 }, + /* x^34816 mod p(x)` << 1, x^34880 mod p(x)` << 1 */ + { 0x0000000074fe2232, 0x0000000167714492 }, + /* x^33792 mod p(x)` << 1, x^33856 mod p(x)` << 1 */ + { 0x000000001ac6e2ba, 0x00000001e599099a }, + /* x^32768 mod p(x)` << 1, x^32832 mod p(x)` << 1 */ + { 0x0000000013fca91e, 0x00000000fe128194 }, + /* x^31744 mod p(x)` << 1, x^31808 mod p(x)` << 1 */ + { 0x0000000183f4931e, 0x0000000077e8b990 }, + /* x^30720 mod p(x)` << 1, x^30784 mod p(x)` << 1 */ + { 0x00000000b6d9b4e4, 0x00000001a267f63a }, + /* x^29696 mod p(x)` << 1, x^29760 mod p(x)` << 1 */ + { 0x00000000b5188656, 0x00000001945c245a }, + /* x^28672 mod p(x)` << 1, x^28736 mod p(x)` << 1 */ + { 0x0000000027a81a84, 0x0000000149002e76 }, + /* x^27648 mod p(x)` << 1, x^27712 mod p(x)` << 1 */ + { 0x0000000125699258, 0x00000001bb8310a4 }, + /* x^26624 mod p(x)` << 1, x^26688 mod p(x)` << 1 */ + { 0x00000001b23de796, 0x000000019ec60bcc }, + /* x^25600 mod p(x)` << 1, x^25664 mod p(x)` << 1 */ + { 0x00000000fe4365dc, 0x000000012d8590ae }, + /* x^24576 mod p(x)` << 1, x^24640 mod p(x)` << 1 */ + { 0x00000000c68f497a, 0x0000000065b00684 }, + /* x^23552 mod p(x)` << 1, x^23616 mod p(x)` << 1 */ + { 0x00000000fbf521ee, 0x000000015e5aeadc }, + /* x^22528 mod p(x)` << 1, x^22592 mod p(x)` << 1 */ + { 0x000000015eac3378, 0x00000000b77ff2b0 }, + /* x^21504 mod p(x)` << 1, x^21568 mod p(x)` << 1 */ + { 0x0000000134914b90, 0x0000000188da2ff6 }, + /* x^20480 mod p(x)` << 1, x^20544 mod p(x)` << 1 */ + { 0x0000000016335cfe, 0x0000000063da929a }, + /* x^19456 mod p(x)` << 1, x^19520 mod p(x)` << 1 */ + { 0x000000010372d10c, 0x00000001389caa80 }, + /* x^18432 mod p(x)` << 1, x^18496 mod p(x)` << 1 */ + { 0x000000015097b908, 0x000000013db599d2 }, + /* x^17408 mod p(x)` << 1, x^17472 mod p(x)` << 1 */ + { 0x00000001227a7572, 0x0000000122505a86 }, + /* x^16384 mod p(x)` << 1, x^16448 mod p(x)` << 1 */ + { 0x000000009a8f75c0, 0x000000016bd72746 }, + /* x^15360 mod p(x)` << 1, x^15424 mod p(x)` << 1 */ + { 0x00000000682c77a2, 0x00000001c3faf1d4 }, + /* x^14336 mod p(x)` << 1, x^14400 mod p(x)` << 1 */ + { 0x00000000231f091c, 0x00000001111c826c }, + /* x^13312 mod p(x)` << 1, x^13376 mod p(x)` << 1 */ + { 0x000000007d4439f2, 0x00000000153e9fb2 }, + /* x^12288 mod p(x)` << 1, x^12352 mod p(x)` << 1 */ + { 0x000000017e221efc, 0x000000002b1f7b60 }, + /* x^11264 mod p(x)` << 1, x^11328 mod p(x)` << 1 */ + { 0x0000000167457c38, 0x00000000b1dba570 }, + /* x^10240 mod p(x)` << 1, x^10304 mod p(x)` << 1 */ + { 0x00000000bdf081c4, 0x00000001f6397b76 }, + /* x^9216 mod p(x)` << 1, x^9280 mod p(x)` << 1 */ + { 0x000000016286d6b0, 0x0000000156335214 }, + /* x^8192 mod p(x)` << 1, x^8256 mod p(x)` << 1 */ + { 0x00000000c84f001c, 0x00000001d70e3986 }, + /* x^7168 mod p(x)` << 1, x^7232 mod p(x)` << 1 */ + { 0x0000000064efe7c0, 0x000000003701a774 }, + /* x^6144 mod p(x)` << 1, x^6208 mod p(x)` << 1 */ + { 0x000000000ac2d904, 0x00000000ac81ef72 }, + /* x^5120 mod p(x)` << 1, x^5184 mod p(x)` << 1 */ + { 0x00000000fd226d14, 0x0000000133212464 }, + /* x^4096 mod p(x)` << 1, x^4160 mod p(x)` << 1 */ + { 0x000000011cfd42e0, 0x00000000e4e45610 }, + /* x^3072 mod p(x)` << 1, x^3136 mod p(x)` << 1 */ + { 0x000000016e5a5678, 0x000000000c1bd370 }, + /* x^2048 mod p(x)` << 1, x^2112 mod p(x)` << 1 */ + { 0x00000001d888fe22, 0x00000001a7b9e7a6 }, + /* x^1024 mod p(x)` << 1, x^1088 mod p(x)` << 1 */ + { 0x00000001af77fcd4, 0x000000007d657a10 } +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ +}; + +/* Reduce final 1024-2048 bits to 64 bits, shifting 32 bits to include the trailing 32 bits of zeros */ + +static const __vector unsigned long long vcrc_short_const[16] ALIGNED_(16) = { +#if BYTE_ORDER == LITTLE_ENDIAN + /* x^1952 mod p(x) , x^1984 mod p(x) , x^2016 mod p(x) , x^2048 mod p(x) */ + { 0x99168a18ec447f11, 0xed837b2613e8221e }, + /* x^1824 mod p(x) , x^1856 mod p(x) , x^1888 mod p(x) , x^1920 mod p(x) */ + { 0xe23e954e8fd2cd3c, 0xc8acdd8147b9ce5a }, + /* x^1696 mod p(x) , x^1728 mod p(x) , x^1760 mod p(x) , x^1792 mod p(x) */ + { 0x92f8befe6b1d2b53, 0xd9ad6d87d4277e25 }, + /* x^1568 mod p(x) , x^1600 mod p(x) , x^1632 mod p(x) , x^1664 mod p(x) */ + { 0xf38a3556291ea462, 0xc10ec5e033fbca3b }, + /* x^1440 mod p(x) , x^1472 mod p(x) , x^1504 mod p(x) , x^1536 mod p(x) */ + { 0x974ac56262b6ca4b, 0xc0b55b0e82e02e2f }, + /* x^1312 mod p(x) , x^1344 mod p(x) , x^1376 mod p(x) , x^1408 mod p(x) */ + { 0x855712b3784d2a56, 0x71aa1df0e172334d }, + /* x^1184 mod p(x) , x^1216 mod p(x) , x^1248 mod p(x) , x^1280 mod p(x) */ + { 0xa5abe9f80eaee722, 0xfee3053e3969324d }, + /* x^1056 mod p(x) , x^1088 mod p(x) , x^1120 mod p(x) , x^1152 mod p(x) */ + { 0x1fa0943ddb54814c, 0xf44779b93eb2bd08 }, + /* x^928 mod p(x) , x^960 mod p(x) , x^992 mod p(x) , x^1024 mod p(x) */ + { 0xa53ff440d7bbfe6a, 0xf5449b3f00cc3374 }, + /* x^800 mod p(x) , x^832 mod p(x) , x^864 mod p(x) , x^896 mod p(x) */ + { 0xebe7e3566325605c, 0x6f8346e1d777606e }, + /* x^672 mod p(x) , x^704 mod p(x) , x^736 mod p(x) , x^768 mod p(x) */ + { 0xc65a272ce5b592b8, 0xe3ab4f2ac0b95347 }, + /* x^544 mod p(x) , x^576 mod p(x) , x^608 mod p(x) , x^640 mod p(x) */ + { 0x5705a9ca4721589f, 0xaa2215ea329ecc11 }, + /* x^416 mod p(x) , x^448 mod p(x) , x^480 mod p(x) , x^512 mod p(x) */ + { 0xe3720acb88d14467, 0x1ed8f66ed95efd26 }, + /* x^288 mod p(x) , x^320 mod p(x) , x^352 mod p(x) , x^384 mod p(x) */ + { 0xba1aca0315141c31, 0x78ed02d5a700e96a }, + /* x^160 mod p(x) , x^192 mod p(x) , x^224 mod p(x) , x^256 mod p(x) */ + { 0xad2a31b3ed627dae, 0xba8ccbe832b39da3 }, + /* x^32 mod p(x) , x^64 mod p(x) , x^96 mod p(x) , x^128 mod p(x) */ + { 0x6655004fa06a2517, 0xedb88320b1e6b092 } +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + /* x^1952 mod p(x) , x^1984 mod p(x) , x^2016 mod p(x) , x^2048 mod p(x) */ + { 0xed837b2613e8221e, 0x99168a18ec447f11 }, + /* x^1824 mod p(x) , x^1856 mod p(x) , x^1888 mod p(x) , x^1920 mod p(x) */ + { 0xc8acdd8147b9ce5a, 0xe23e954e8fd2cd3c }, + /* x^1696 mod p(x) , x^1728 mod p(x) , x^1760 mod p(x) , x^1792 mod p(x) */ + { 0xd9ad6d87d4277e25, 0x92f8befe6b1d2b53 }, + /* x^1568 mod p(x) , x^1600 mod p(x) , x^1632 mod p(x) , x^1664 mod p(x) */ + { 0xc10ec5e033fbca3b, 0xf38a3556291ea462 }, + /* x^1440 mod p(x) , x^1472 mod p(x) , x^1504 mod p(x) , x^1536 mod p(x) */ + { 0xc0b55b0e82e02e2f, 0x974ac56262b6ca4b }, + /* x^1312 mod p(x) , x^1344 mod p(x) , x^1376 mod p(x) , x^1408 mod p(x) */ + { 0x71aa1df0e172334d, 0x855712b3784d2a56 }, + /* x^1184 mod p(x) , x^1216 mod p(x) , x^1248 mod p(x) , x^1280 mod p(x) */ + { 0xfee3053e3969324d, 0xa5abe9f80eaee722 }, + /* x^1056 mod p(x) , x^1088 mod p(x) , x^1120 mod p(x) , x^1152 mod p(x) */ + { 0xf44779b93eb2bd08, 0x1fa0943ddb54814c }, + /* x^928 mod p(x) , x^960 mod p(x) , x^992 mod p(x) , x^1024 mod p(x) */ + { 0xf5449b3f00cc3374, 0xa53ff440d7bbfe6a }, + /* x^800 mod p(x) , x^832 mod p(x) , x^864 mod p(x) , x^896 mod p(x) */ + { 0x6f8346e1d777606e, 0xebe7e3566325605c }, + /* x^672 mod p(x) , x^704 mod p(x) , x^736 mod p(x) , x^768 mod p(x) */ + { 0xe3ab4f2ac0b95347, 0xc65a272ce5b592b8 }, + /* x^544 mod p(x) , x^576 mod p(x) , x^608 mod p(x) , x^640 mod p(x) */ + { 0xaa2215ea329ecc11, 0x5705a9ca4721589f }, + /* x^416 mod p(x) , x^448 mod p(x) , x^480 mod p(x) , x^512 mod p(x) */ + { 0x1ed8f66ed95efd26, 0xe3720acb88d14467 }, + /* x^288 mod p(x) , x^320 mod p(x) , x^352 mod p(x) , x^384 mod p(x) */ + { 0x78ed02d5a700e96a, 0xba1aca0315141c31 }, + /* x^160 mod p(x) , x^192 mod p(x) , x^224 mod p(x) , x^256 mod p(x) */ + { 0xba8ccbe832b39da3, 0xad2a31b3ed627dae }, + /* x^32 mod p(x) , x^64 mod p(x) , x^96 mod p(x) , x^128 mod p(x) */ + { 0xedb88320b1e6b092, 0x6655004fa06a2517 } +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ +}; + +/* Barrett constants */ +/* 33 bit reflected Barrett constant m - (4^32)/n */ + +static const __vector unsigned long long v_Barrett_const[2] ALIGNED_(16) = { + /* x^64 div p(x) */ +#if BYTE_ORDER == LITTLE_ENDIAN + { 0x00000001f7011641, 0x0000000000000000 }, + { 0x00000001db710641, 0x0000000000000000 } +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + { 0x0000000000000000, 0x00000001f7011641 }, + { 0x0000000000000000, 0x00000001db710641 } +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ +}; diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/crc32_power8.c b/internal-complibs/zlib-ng-2.2.2/arch/power/crc32_power8.c new file mode 100644 index 000000000..1cb5f299f --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/crc32_power8.c @@ -0,0 +1,589 @@ +/* crc32 for POWER8 using VSX instructions + * Copyright (C) 2021 IBM Corporation + * + * Author: Rogerio Alves + * + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Calculate the checksum of data that is 16 byte aligned and a multiple of + * 16 bytes. + * + * The first step is to reduce it to 1024 bits. We do this in 8 parallel + * chunks in order to mask the latency of the vpmsum instructions. If we + * have more than 32 kB of data to checksum we repeat this step multiple + * times, passing in the previous 1024 bits. + * + * The next step is to reduce the 1024 bits to 64 bits. This step adds + * 32 bits of 0s to the end - this matches what a CRC does. We just + * calculate constants that land the data in this 32 bits. + * + * We then use fixed point Barrett reduction to compute a mod n over GF(2) + * for n = CRC using POWER8 instructions. We use x = 32. + * + * http://en.wikipedia.org/wiki/Barrett_reduction + * + * This code uses gcc vector builtins instead using assembly directly. + */ + +#include +#include "zendian.h" +#include "zbuild.h" + +#include "crc32_constants.h" +#include "crc32_braid_tbl.h" + +#if defined (__clang__) +#include "fallback_builtins.h" +#endif + +#define MAX_SIZE 32768 +#define VMX_ALIGN 16 +#define VMX_ALIGN_MASK (VMX_ALIGN-1) + +static unsigned int crc32_align(unsigned int crc, const unsigned char *p, unsigned long len) { + while (len--) + crc = crc_table[(crc ^ *p++) & 0xff] ^ (crc >> 8); + return crc; +} + +static unsigned int ALIGNED_(32) __crc32_vpmsum(unsigned int crc, const void* p, unsigned long len); + +Z_INTERNAL uint32_t crc32_power8(uint32_t crc, const unsigned char *p, size_t _len) { + unsigned int prealign; + unsigned int tail; + + unsigned long len = (unsigned long) _len; + + if (p == (const unsigned char *) 0x0) + return 0; + + crc ^= 0xffffffff; + + if (len < VMX_ALIGN + VMX_ALIGN_MASK) { + crc = crc32_align(crc, p, len); + goto out; + } + + if ((unsigned long)p & VMX_ALIGN_MASK) { + prealign = VMX_ALIGN - ((unsigned long)p & VMX_ALIGN_MASK); + crc = crc32_align(crc, p, prealign); + len -= prealign; + p += prealign; + } + + crc = __crc32_vpmsum(crc, p, len & ~VMX_ALIGN_MASK); + + tail = len & VMX_ALIGN_MASK; + if (tail) { + p += len & ~VMX_ALIGN_MASK; + crc = crc32_align(crc, p, tail); + } + +out: + crc ^= 0xffffffff; + + return crc; +} + +/* When we have a load-store in a single-dispatch group and address overlap + * such that forward is not allowed (load-hit-store) the group must be flushed. + * A group ending NOP prevents the flush. + */ +#define GROUP_ENDING_NOP __asm__("ori 2,2,0" ::: "memory") + +#if BYTE_ORDER == BIG_ENDIAN +#define BYTESWAP_DATA +#endif + +#ifdef BYTESWAP_DATA +#define VEC_PERM(vr, va, vb, vc) vr = vec_perm(va, vb, (__vector unsigned char) vc) +#if BYTE_ORDER == LITTLE_ENDIAN +/* Byte reverse permute constant LE. */ +static const __vector unsigned long long vperm_const ALIGNED_(16) = { 0x08090A0B0C0D0E0FUL, 0x0001020304050607UL }; +#else +static const __vector unsigned long long vperm_const ALIGNED_(16) = { 0x0F0E0D0C0B0A0908UL, 0X0706050403020100UL }; +#endif +#else +#define VEC_PERM(vr, va, vb, vc) +#endif + +static unsigned int ALIGNED_(32) __crc32_vpmsum(unsigned int crc, const void* p, unsigned long len) { + + const __vector unsigned long long vzero = {0,0}; + const __vector unsigned long long vones = {0xffffffffffffffffUL, 0xffffffffffffffffUL}; + + const __vector unsigned long long vmask_32bit = + (__vector unsigned long long)vec_sld((__vector unsigned char)vzero, (__vector unsigned char)vones, 4); + + const __vector unsigned long long vmask_64bit = + (__vector unsigned long long)vec_sld((__vector unsigned char)vzero, (__vector unsigned char)vones, 8); + + __vector unsigned long long vcrc; + + __vector unsigned long long vconst1, vconst2; + + /* vdata0-vdata7 will contain our data (p). */ + __vector unsigned long long vdata0, vdata1, vdata2, vdata3, vdata4, vdata5, vdata6, vdata7; + + /* v0-v7 will contain our checksums */ + __vector unsigned long long v0 = {0,0}; + __vector unsigned long long v1 = {0,0}; + __vector unsigned long long v2 = {0,0}; + __vector unsigned long long v3 = {0,0}; + __vector unsigned long long v4 = {0,0}; + __vector unsigned long long v5 = {0,0}; + __vector unsigned long long v6 = {0,0}; + __vector unsigned long long v7 = {0,0}; + + + /* Vector auxiliary variables. */ + __vector unsigned long long va0, va1, va2, va3, va4, va5, va6, va7; + + unsigned int offset; /* Constant table offset. */ + + unsigned long i; /* Counter. */ + unsigned long chunks; + + unsigned long block_size; + int next_block = 0; + + /* Align by 128 bits. The last 128 bit block will be processed at end. */ + unsigned long length = len & 0xFFFFFFFFFFFFFF80UL; + + vcrc = (__vector unsigned long long)__builtin_pack_vector_int128(0UL, crc); + + /* Short version. */ + if (len < 256) { + /* Calculate where in the constant table we need to start. */ + offset = 256 - len; + + vconst1 = vec_ld(offset, vcrc_short_const); + vdata0 = vec_ld(0, (__vector unsigned long long*) p); + VEC_PERM(vdata0, vdata0, vconst1, vperm_const); + + /* xor initial value */ + vdata0 = vec_xor(vdata0, vcrc); + + vdata0 = (__vector unsigned long long) __builtin_crypto_vpmsumw( + (__vector unsigned int)vdata0, (__vector unsigned int)vconst1); + v0 = vec_xor(v0, vdata0); + + for (i = 16; i < len; i += 16) { + vconst1 = vec_ld(offset + i, vcrc_short_const); + vdata0 = vec_ld(i, (__vector unsigned long long*) p); + VEC_PERM(vdata0, vdata0, vconst1, vperm_const); + vdata0 = (__vector unsigned long long) __builtin_crypto_vpmsumw( + (__vector unsigned int)vdata0, (__vector unsigned int)vconst1); + v0 = vec_xor(v0, vdata0); + } + } else { + + /* Load initial values. */ + vdata0 = vec_ld(0, (__vector unsigned long long*) p); + vdata1 = vec_ld(16, (__vector unsigned long long*) p); + + VEC_PERM(vdata0, vdata0, vdata0, vperm_const); + VEC_PERM(vdata1, vdata1, vdata1, vperm_const); + + vdata2 = vec_ld(32, (__vector unsigned long long*) p); + vdata3 = vec_ld(48, (__vector unsigned long long*) p); + + VEC_PERM(vdata2, vdata2, vdata2, vperm_const); + VEC_PERM(vdata3, vdata3, vdata3, vperm_const); + + vdata4 = vec_ld(64, (__vector unsigned long long*) p); + vdata5 = vec_ld(80, (__vector unsigned long long*) p); + + VEC_PERM(vdata4, vdata4, vdata4, vperm_const); + VEC_PERM(vdata5, vdata5, vdata5, vperm_const); + + vdata6 = vec_ld(96, (__vector unsigned long long*) p); + vdata7 = vec_ld(112, (__vector unsigned long long*) p); + + VEC_PERM(vdata6, vdata6, vdata6, vperm_const); + VEC_PERM(vdata7, vdata7, vdata7, vperm_const); + + /* xor in initial value */ + vdata0 = vec_xor(vdata0, vcrc); + + p = (char *)p + 128; + + do { + /* Checksum in blocks of MAX_SIZE. */ + block_size = length; + if (block_size > MAX_SIZE) { + block_size = MAX_SIZE; + } + + length = length - block_size; + + /* + * Work out the offset into the constants table to start at. Each + * constant is 16 bytes, and it is used against 128 bytes of input + * data - 128 / 16 = 8 + */ + offset = (MAX_SIZE/8) - (block_size/8); + /* We reduce our final 128 bytes in a separate step */ + chunks = (block_size/128)-1; + + vconst1 = vec_ld(offset, vcrc_const); + + va0 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata0, + (__vector unsigned long long)vconst1); + va1 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata1, + (__vector unsigned long long)vconst1); + va2 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata2, + (__vector unsigned long long)vconst1); + va3 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata3, + (__vector unsigned long long)vconst1); + va4 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata4, + (__vector unsigned long long)vconst1); + va5 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata5, + (__vector unsigned long long)vconst1); + va6 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata6, + (__vector unsigned long long)vconst1); + va7 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata7, + (__vector unsigned long long)vconst1); + + if (chunks > 1) { + offset += 16; + vconst2 = vec_ld(offset, vcrc_const); + GROUP_ENDING_NOP; + + vdata0 = vec_ld(0, (__vector unsigned long long*) p); + VEC_PERM(vdata0, vdata0, vdata0, vperm_const); + + vdata1 = vec_ld(16, (__vector unsigned long long*) p); + VEC_PERM(vdata1, vdata1, vdata1, vperm_const); + + vdata2 = vec_ld(32, (__vector unsigned long long*) p); + VEC_PERM(vdata2, vdata2, vdata2, vperm_const); + + vdata3 = vec_ld(48, (__vector unsigned long long*) p); + VEC_PERM(vdata3, vdata3, vdata3, vperm_const); + + vdata4 = vec_ld(64, (__vector unsigned long long*) p); + VEC_PERM(vdata4, vdata4, vdata4, vperm_const); + + vdata5 = vec_ld(80, (__vector unsigned long long*) p); + VEC_PERM(vdata5, vdata5, vdata5, vperm_const); + + vdata6 = vec_ld(96, (__vector unsigned long long*) p); + VEC_PERM(vdata6, vdata6, vdata6, vperm_const); + + vdata7 = vec_ld(112, (__vector unsigned long long*) p); + VEC_PERM(vdata7, vdata7, vdata7, vperm_const); + + p = (char *)p + 128; + + /* + * main loop. Each iteration calculates the CRC for a 128-byte + * block. + */ + for (i = 0; i < chunks-2; i++) { + vconst1 = vec_ld(offset, vcrc_const); + offset += 16; + GROUP_ENDING_NOP; + + v0 = vec_xor(v0, va0); + va0 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata0, + (__vector unsigned long long)vconst2); + vdata0 = vec_ld(0, (__vector unsigned long long*) p); + VEC_PERM(vdata0, vdata0, vdata0, vperm_const); + GROUP_ENDING_NOP; + + v1 = vec_xor(v1, va1); + va1 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata1, + (__vector unsigned long long)vconst2); + vdata1 = vec_ld(16, (__vector unsigned long long*) p); + VEC_PERM(vdata1, vdata1, vdata1, vperm_const); + GROUP_ENDING_NOP; + + v2 = vec_xor(v2, va2); + va2 = __builtin_crypto_vpmsumd((__vector unsigned long long) + vdata2, (__vector unsigned long long)vconst2); + vdata2 = vec_ld(32, (__vector unsigned long long*) p); + VEC_PERM(vdata2, vdata2, vdata2, vperm_const); + GROUP_ENDING_NOP; + + v3 = vec_xor(v3, va3); + va3 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata3, + (__vector unsigned long long)vconst2); + vdata3 = vec_ld(48, (__vector unsigned long long*) p); + VEC_PERM(vdata3, vdata3, vdata3, vperm_const); + + vconst2 = vec_ld(offset, vcrc_const); + GROUP_ENDING_NOP; + + v4 = vec_xor(v4, va4); + va4 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata4, + (__vector unsigned long long)vconst1); + vdata4 = vec_ld(64, (__vector unsigned long long*) p); + VEC_PERM(vdata4, vdata4, vdata4, vperm_const); + GROUP_ENDING_NOP; + + v5 = vec_xor(v5, va5); + va5 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata5, + (__vector unsigned long long)vconst1); + vdata5 = vec_ld(80, (__vector unsigned long long*) p); + VEC_PERM(vdata5, vdata5, vdata5, vperm_const); + GROUP_ENDING_NOP; + + v6 = vec_xor(v6, va6); + va6 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata6, + (__vector unsigned long long)vconst1); + vdata6 = vec_ld(96, (__vector unsigned long long*) p); + VEC_PERM(vdata6, vdata6, vdata6, vperm_const); + GROUP_ENDING_NOP; + + v7 = vec_xor(v7, va7); + va7 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata7, + (__vector unsigned long long)vconst1); + vdata7 = vec_ld(112, (__vector unsigned long long*) p); + VEC_PERM(vdata7, vdata7, vdata7, vperm_const); + + p = (char *)p + 128; + } + + /* First cool down */ + vconst1 = vec_ld(offset, vcrc_const); + offset += 16; + + v0 = vec_xor(v0, va0); + va0 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata0, + (__vector unsigned long long)vconst1); + GROUP_ENDING_NOP; + + v1 = vec_xor(v1, va1); + va1 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata1, + (__vector unsigned long long)vconst1); + GROUP_ENDING_NOP; + + v2 = vec_xor(v2, va2); + va2 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata2, + (__vector unsigned long long)vconst1); + GROUP_ENDING_NOP; + + v3 = vec_xor(v3, va3); + va3 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata3, + (__vector unsigned long long)vconst1); + GROUP_ENDING_NOP; + + v4 = vec_xor(v4, va4); + va4 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata4, + (__vector unsigned long long)vconst1); + GROUP_ENDING_NOP; + + v5 = vec_xor(v5, va5); + va5 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata5, + (__vector unsigned long long)vconst1); + GROUP_ENDING_NOP; + + v6 = vec_xor(v6, va6); + va6 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata6, + (__vector unsigned long long)vconst1); + GROUP_ENDING_NOP; + + v7 = vec_xor(v7, va7); + va7 = __builtin_crypto_vpmsumd((__vector unsigned long long)vdata7, + (__vector unsigned long long)vconst1); + }/* else */ + + /* Second cool down. */ + v0 = vec_xor(v0, va0); + v1 = vec_xor(v1, va1); + v2 = vec_xor(v2, va2); + v3 = vec_xor(v3, va3); + v4 = vec_xor(v4, va4); + v5 = vec_xor(v5, va5); + v6 = vec_xor(v6, va6); + v7 = vec_xor(v7, va7); + + /* + * vpmsumd produces a 96 bit result in the least significant bits + * of the register. Since we are bit reflected we have to shift it + * left 32 bits so it occupies the least significant bits in the + * bit reflected domain. + */ + v0 = (__vector unsigned long long)vec_sld((__vector unsigned char)v0, + (__vector unsigned char)vzero, 4); + v1 = (__vector unsigned long long)vec_sld((__vector unsigned char)v1, + (__vector unsigned char)vzero, 4); + v2 = (__vector unsigned long long)vec_sld((__vector unsigned char)v2, + (__vector unsigned char)vzero, 4); + v3 = (__vector unsigned long long)vec_sld((__vector unsigned char)v3, + (__vector unsigned char)vzero, 4); + v4 = (__vector unsigned long long)vec_sld((__vector unsigned char)v4, + (__vector unsigned char)vzero, 4); + v5 = (__vector unsigned long long)vec_sld((__vector unsigned char)v5, + (__vector unsigned char)vzero, 4); + v6 = (__vector unsigned long long)vec_sld((__vector unsigned char)v6, + (__vector unsigned char)vzero, 4); + v7 = (__vector unsigned long long)vec_sld((__vector unsigned char)v7, + (__vector unsigned char)vzero, 4); + + /* xor with the last 1024 bits. */ + va0 = vec_ld(0, (__vector unsigned long long*) p); + VEC_PERM(va0, va0, va0, vperm_const); + + va1 = vec_ld(16, (__vector unsigned long long*) p); + VEC_PERM(va1, va1, va1, vperm_const); + + va2 = vec_ld(32, (__vector unsigned long long*) p); + VEC_PERM(va2, va2, va2, vperm_const); + + va3 = vec_ld(48, (__vector unsigned long long*) p); + VEC_PERM(va3, va3, va3, vperm_const); + + va4 = vec_ld(64, (__vector unsigned long long*) p); + VEC_PERM(va4, va4, va4, vperm_const); + + va5 = vec_ld(80, (__vector unsigned long long*) p); + VEC_PERM(va5, va5, va5, vperm_const); + + va6 = vec_ld(96, (__vector unsigned long long*) p); + VEC_PERM(va6, va6, va6, vperm_const); + + va7 = vec_ld(112, (__vector unsigned long long*) p); + VEC_PERM(va7, va7, va7, vperm_const); + + p = (char *)p + 128; + + vdata0 = vec_xor(v0, va0); + vdata1 = vec_xor(v1, va1); + vdata2 = vec_xor(v2, va2); + vdata3 = vec_xor(v3, va3); + vdata4 = vec_xor(v4, va4); + vdata5 = vec_xor(v5, va5); + vdata6 = vec_xor(v6, va6); + vdata7 = vec_xor(v7, va7); + + /* Check if we have more blocks to process */ + next_block = 0; + if (length != 0) { + next_block = 1; + + /* zero v0-v7 */ + v0 = vec_xor(v0, v0); + v1 = vec_xor(v1, v1); + v2 = vec_xor(v2, v2); + v3 = vec_xor(v3, v3); + v4 = vec_xor(v4, v4); + v5 = vec_xor(v5, v5); + v6 = vec_xor(v6, v6); + v7 = vec_xor(v7, v7); + } + length = length + 128; + + } while (next_block); + + /* Calculate how many bytes we have left. */ + length = (len & 127); + + /* Calculate where in (short) constant table we need to start. */ + offset = 128 - length; + + v0 = vec_ld(offset, vcrc_short_const); + v1 = vec_ld(offset + 16, vcrc_short_const); + v2 = vec_ld(offset + 32, vcrc_short_const); + v3 = vec_ld(offset + 48, vcrc_short_const); + v4 = vec_ld(offset + 64, vcrc_short_const); + v5 = vec_ld(offset + 80, vcrc_short_const); + v6 = vec_ld(offset + 96, vcrc_short_const); + v7 = vec_ld(offset + 112, vcrc_short_const); + + offset += 128; + + v0 = (__vector unsigned long long)__builtin_crypto_vpmsumw( + (__vector unsigned int)vdata0, (__vector unsigned int)v0); + v1 = (__vector unsigned long long)__builtin_crypto_vpmsumw( + (__vector unsigned int)vdata1, (__vector unsigned int)v1); + v2 = (__vector unsigned long long)__builtin_crypto_vpmsumw( + (__vector unsigned int)vdata2, (__vector unsigned int)v2); + v3 = (__vector unsigned long long)__builtin_crypto_vpmsumw( + (__vector unsigned int)vdata3, (__vector unsigned int)v3); + v4 = (__vector unsigned long long)__builtin_crypto_vpmsumw( + (__vector unsigned int)vdata4, (__vector unsigned int)v4); + v5 = (__vector unsigned long long)__builtin_crypto_vpmsumw( + (__vector unsigned int)vdata5, (__vector unsigned int)v5); + v6 = (__vector unsigned long long)__builtin_crypto_vpmsumw( + (__vector unsigned int)vdata6, (__vector unsigned int)v6); + v7 = (__vector unsigned long long)__builtin_crypto_vpmsumw( + (__vector unsigned int)vdata7, (__vector unsigned int)v7); + + /* Now reduce the tail (0-112 bytes). */ + for (i = 0; i < length; i+=16) { + vdata0 = vec_ld(i,(__vector unsigned long long*)p); + VEC_PERM(vdata0, vdata0, vdata0, vperm_const); + va0 = vec_ld(offset + i,vcrc_short_const); + va0 = (__vector unsigned long long)__builtin_crypto_vpmsumw( + (__vector unsigned int)vdata0, (__vector unsigned int)va0); + v0 = vec_xor(v0, va0); + } + + /* xor all parallel chunks together. */ + v0 = vec_xor(v0, v1); + v2 = vec_xor(v2, v3); + v4 = vec_xor(v4, v5); + v6 = vec_xor(v6, v7); + + v0 = vec_xor(v0, v2); + v4 = vec_xor(v4, v6); + + v0 = vec_xor(v0, v4); + } + + /* Barrett Reduction */ + vconst1 = vec_ld(0, v_Barrett_const); + vconst2 = vec_ld(16, v_Barrett_const); + + v1 = (__vector unsigned long long)vec_sld((__vector unsigned char)v0, + (__vector unsigned char)v0, 8); + v0 = vec_xor(v1,v0); + + /* shift left one bit */ + __vector unsigned char vsht_splat = vec_splat_u8 (1); + v0 = (__vector unsigned long long)vec_sll((__vector unsigned char)v0, vsht_splat); + + v0 = vec_and(v0, vmask_64bit); + + /* + * The reflected version of Barrett reduction. Instead of bit + * reflecting our data (which is expensive to do), we bit reflect our + * constants and our algorithm, which means the intermediate data in + * our vector registers goes from 0-63 instead of 63-0. We can reflect + * the algorithm because we don't carry in mod 2 arithmetic. + */ + + /* bottom 32 bits of a */ + v1 = vec_and(v0, vmask_32bit); + + /* ma */ + v1 = __builtin_crypto_vpmsumd((__vector unsigned long long)v1, + (__vector unsigned long long)vconst1); + + /* bottom 32bits of ma */ + v1 = vec_and(v1, vmask_32bit); + /* qn */ + v1 = __builtin_crypto_vpmsumd((__vector unsigned long long)v1, + (__vector unsigned long long)vconst2); + /* a - qn, subtraction is xor in GF(2) */ + v0 = vec_xor (v0, v1); + + /* + * Since we are bit reflected, the result (ie the low 32 bits) is in + * the high 32 bits. We just need to shift it left 4 bytes + * V0 [ 0 1 X 3 ] + * V0 [ 0 X 2 3 ] + */ + + /* shift result into top 64 bits of */ + v0 = (__vector unsigned long long)vec_sld((__vector unsigned char)v0, + (__vector unsigned char)vzero, 4); + +#if BYTE_ORDER == BIG_ENDIAN + return v0[0]; +#else + return v0[1]; +#endif +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/fallback_builtins.h b/internal-complibs/zlib-ng-2.2.2/arch/power/fallback_builtins.h new file mode 100644 index 000000000..ed9584617 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/fallback_builtins.h @@ -0,0 +1,31 @@ +/* Helper functions to work around issues with clang builtins + * Copyright (C) 2021 IBM Corporation + * + * Authors: + * Daniel Black + * Rogerio Alves + * Tulio Magno Quites Machado Filho + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef POWER_BUILTINS_H +#define POWER_BUILTINS_H + +/* + * These stubs fix clang incompatibilities with GCC builtins. + */ + +#ifndef __builtin_crypto_vpmsumw +#define __builtin_crypto_vpmsumw __builtin_crypto_vpmsumb +#endif +#ifndef __builtin_crypto_vpmsumd +#define __builtin_crypto_vpmsumd __builtin_crypto_vpmsumb +#endif + +static inline __vector unsigned long long __attribute__((overloadable)) +vec_ld(int __a, const __vector unsigned long long* __b) { + return (__vector unsigned long long)__builtin_altivec_lvx(__a, __b); +} + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/power_features.c b/internal-complibs/zlib-ng-2.2.2/arch/power/power_features.c new file mode 100644 index 000000000..4939d1c18 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/power_features.c @@ -0,0 +1,49 @@ +/* power_features.c - POWER feature check + * Copyright (C) 2020 Matheus Castanho , IBM + * Copyright (C) 2021-2024 Mika T. Lindqvist + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef HAVE_SYS_AUXV_H +# include +#endif +#ifdef POWER_NEED_AUXVEC_H +# include +#endif +#ifdef __FreeBSD__ +# include +#endif +#include "zbuild.h" +#include "power_features.h" + +void Z_INTERNAL power_check_features(struct power_cpu_features *features) { +#ifdef PPC_FEATURES + unsigned long hwcap; +#ifdef __FreeBSD__ + elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); +#else + hwcap = getauxval(AT_HWCAP); +#endif + + if (hwcap & PPC_FEATURE_HAS_ALTIVEC) + features->has_altivec = 1; +#endif + +#ifdef POWER_FEATURES + unsigned long hwcap2; +#ifdef __FreeBSD__ + elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2)); +#else + hwcap2 = getauxval(AT_HWCAP2); +#endif + +#ifdef POWER8_VSX + if (hwcap2 & PPC_FEATURE2_ARCH_2_07) + features->has_arch_2_07 = 1; +#endif +#ifdef POWER9 + if (hwcap2 & PPC_FEATURE2_ARCH_3_00) + features->has_arch_3_00 = 1; +#endif +#endif +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/power_features.h b/internal-complibs/zlib-ng-2.2.2/arch/power/power_features.h new file mode 100644 index 000000000..1ff51de5d --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/power_features.h @@ -0,0 +1,18 @@ +/* power_features.h -- check for POWER CPU features + * Copyright (C) 2020 Matheus Castanho , IBM + * Copyright (C) 2021 Mika T. Lindqvist + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef POWER_FEATURES_H_ +#define POWER_FEATURES_H_ + +struct power_cpu_features { + int has_altivec; + int has_arch_2_07; + int has_arch_3_00; +}; + +void Z_INTERNAL power_check_features(struct power_cpu_features *features); + +#endif /* POWER_FEATURES_H_ */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/power_functions.h b/internal-complibs/zlib-ng-2.2.2/arch/power/power_functions.h new file mode 100644 index 000000000..cb6b7650e --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/power_functions.h @@ -0,0 +1,67 @@ +/* power_functions.h -- POWER implementations for arch-specific functions. + * Copyright (C) 2020 Matheus Castanho , IBM + * Copyright (C) 2021 Mika T. Lindqvist + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef POWER_FUNCTIONS_H_ +#define POWER_FUNCTIONS_H_ + +#ifdef PPC_VMX +uint32_t adler32_vmx(uint32_t adler, const uint8_t *buf, size_t len); +void slide_hash_vmx(deflate_state *s); +#endif + +#ifdef POWER8_VSX +uint32_t adler32_power8(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t chunksize_power8(void); +uint8_t* chunkmemset_safe_power8(uint8_t *out, unsigned dist, unsigned len, unsigned left); +uint32_t crc32_power8(uint32_t crc, const uint8_t *buf, size_t len); +void slide_hash_power8(deflate_state *s); +void inflate_fast_power8(PREFIX3(stream) *strm, uint32_t start); +#endif + +#ifdef POWER9 +uint32_t compare256_power9(const uint8_t *src0, const uint8_t *src1); +uint32_t longest_match_power9(deflate_state *const s, Pos cur_match); +uint32_t longest_match_slow_power9(deflate_state *const s, Pos cur_match); +#endif + + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +// Power - VMX +# if defined(PPC_VMX) && defined(__ALTIVEC__) +# undef native_adler32 +# define native_adler32 adler32_vmx +# undef native_slide_hash +# define native_slide_hash slide_hash_vmx +# endif +// Power8 - VSX +# if defined(POWER8_VSX) && defined(_ARCH_PWR8) && defined(__VSX__) +# undef native_adler32 +# define native_adler32 adler32_power8 +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_power8 +# undef native_chunksize +# define native_chunksize chunksize_power8 +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_power8 +# undef native_slide_hash +# define native_slide_hash slide_hash_power8 +# endif +# if defined(POWER8_VSX_CRC32) && defined(_ARCH_PWR8) && defined(__VSX__) +# undef native_crc32 +# define native_crc32 crc32_power8 +# endif +// Power9 +# if defined(POWER9) && defined(_ARCH_PWR9) +# undef native_compare256 +# define native_compare256 compare256_power9 +# undef native_longest_match +# define native_longest_match longest_match_power9 +# undef native_longest_match_slow +# define native_longest_match_slow longest_match_slow_power9 +# endif +#endif + +#endif /* POWER_FUNCTIONS_H_ */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/slide_hash_power8.c b/internal-complibs/zlib-ng-2.2.2/arch/power/slide_hash_power8.c new file mode 100644 index 000000000..d01e0acd5 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/slide_hash_power8.c @@ -0,0 +1,12 @@ +/* Optimized slide_hash for POWER processors + * Copyright (C) 2019-2020 IBM Corporation + * Author: Matheus Castanho + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef POWER8_VSX + +#define SLIDE_PPC slide_hash_power8 +#include "slide_ppc_tpl.h" + +#endif /* POWER8_VSX */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/slide_hash_vmx.c b/internal-complibs/zlib-ng-2.2.2/arch/power/slide_hash_vmx.c new file mode 100644 index 000000000..5a87ef7d9 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/slide_hash_vmx.c @@ -0,0 +1,10 @@ +/* Optimized slide_hash for PowerPC processors with VMX instructions + * Copyright (C) 2017-2021 Mika T. Lindqvist + * For conditions of distribution and use, see copyright notice in zlib.h + */ +#ifdef PPC_VMX + +#define SLIDE_PPC slide_hash_vmx +#include "slide_ppc_tpl.h" + +#endif /* PPC_VMX */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/power/slide_ppc_tpl.h b/internal-complibs/zlib-ng-2.2.2/arch/power/slide_ppc_tpl.h new file mode 100644 index 000000000..680a7f8e2 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/power/slide_ppc_tpl.h @@ -0,0 +1,32 @@ +/* Optimized slide_hash for PowerPC processors + * Copyright (C) 2017-2021 Mika T. Lindqvist + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include +#include "zbuild.h" +#include "deflate.h" + +static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize) { + const vector unsigned short vmx_wsize = vec_splats(wsize); + Pos *p = table; + + do { + vector unsigned short value, result; + + value = vec_ld(0, p); + result = vec_subs(value, vmx_wsize); + vec_st(result, 0, p); + + p += 8; + entries -= 8; + } while (entries > 0); +} + +void Z_INTERNAL SLIDE_PPC(deflate_state *s) { + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); + uint16_t wsize = (uint16_t)s->w_size; + + slide_hash_chain(s->head, HASH_SIZE, wsize); + slide_hash_chain(s->prev, wsize, wsize); +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/riscv/README.md b/internal-complibs/zlib-ng-2.2.2/arch/riscv/README.md new file mode 100644 index 000000000..013095c37 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/riscv/README.md @@ -0,0 +1,45 @@ +# Building RISC-V Target with Cmake # + +> **Warning** +> Runtime rvv detection (using `hwcap`) requires linux kernel 6.5 or newer. +> +> When running on older kernels, we fall back to compile-time detection, potentially this can cause crashes if rvv is enabled at compile but not supported by the target cpu. +> Therefore if older kernel support is needed, rvv should be disabled if the target cpu does not support it. +## Prerequisite: Build RISC-V Clang Toolchain and QEMU ## + +If you don't have prebuilt clang and riscv64 qemu, you can refer to the [script](https://github.com/sifive/prepare-riscv-toolchain-qemu/blob/main/prepare_riscv_toolchain_qemu.sh) to get the source. Copy the script to the zlib-ng root directory, and run it to download the source and build them. Modify the content according to your conditions (e.g., toolchain version). + +```bash +./prepare_riscv_toolchain_qemu.sh +``` + +After running script, clang & qemu are built in `build-toolchain-qemu/riscv-clang/` & `build-toolchain-qemu/riscv-qemu/`. + +`build-toolchain-qemu/riscv-clang/` is your `TOOLCHAIN_PATH`. +`build-toolchain-qemu/riscv-qemu/bin/qemu-riscv64` is your `QEMU_PATH`. + +You can also download the prebuilt toolchain & qemu from [the release page](https://github.com/sifive/prepare-riscv-toolchain-qemu/releases), and enjoy using them. + +## Cross-Compile for RISC-V Target ## + +```bash +cmake -G Ninja -B ./build-riscv \ + -D CMAKE_TOOLCHAIN_FILE=./cmake/toolchain-riscv.cmake \ + -D CMAKE_INSTALL_PREFIX=./build-riscv/install \ + -D TOOLCHAIN_PATH={TOOLCHAIN_PATH} \ + -D QEMU_PATH={QEMU_PATH} \ + . + +cmake --build ./build-riscv +``` + +Disable the option if there is no RVV support: +``` +-D WITH_RVV=OFF +``` + +## Run Unittests on User Mode QEMU ## + +```bash +cd ./build-riscv && ctest --verbose +``` diff --git a/internal-complibs/zlib-ng-2.2.2/arch/riscv/adler32_rvv.c b/internal-complibs/zlib-ng-2.2.2/arch/riscv/adler32_rvv.c new file mode 100644 index 000000000..d0f9aaa56 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/riscv/adler32_rvv.c @@ -0,0 +1,132 @@ +/* adler32_rvv.c - RVV version of adler32 + * Copyright (C) 2023 SiFive, Inc. All rights reserved. + * Contributed by Alex Chiang + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef RISCV_RVV + +#include +#include + +#include "zbuild.h" +#include "adler32_p.h" + +static inline uint32_t adler32_rvv_impl(uint32_t adler, uint8_t* restrict dst, const uint8_t *src, size_t len, int COPY) { + /* split Adler-32 into component sums */ + uint32_t sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (len == 1) { + if (COPY) memcpy(dst, src, 1); + return adler32_len_1(adler, src, sum2); + } + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (src == NULL) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (len < 16) { + if (COPY) memcpy(dst, src, len); + return adler32_len_16(adler, src, len, sum2); + } + + size_t left = len; + size_t vl = __riscv_vsetvlmax_e8m1(); + vl = vl > 256 ? 256 : vl; + vuint32m4_t v_buf32_accu = __riscv_vmv_v_x_u32m4(0, vl); + vuint32m4_t v_adler32_prev_accu = __riscv_vmv_v_x_u32m4(0, vl); + vuint16m2_t v_buf16_accu; + + /* + * We accumulate 8-bit data, and to prevent overflow, we have to use a 32-bit accumulator. + * However, adding 8-bit data into a 32-bit accumulator isn't efficient. We use 16-bit & 32-bit + * accumulators to boost performance. + * + * The block_size is the largest multiple of vl that <= 256, because overflow would occur when + * vl > 256 (255 * 256 <= UINT16_MAX). + * + * We accumulate 8-bit data into a 16-bit accumulator and then + * move the data into the 32-bit accumulator at the last iteration. + */ + size_t block_size = (256 / vl) * vl; + size_t nmax_limit = (NMAX / block_size); + size_t cnt = 0; + while (left >= block_size) { + v_buf16_accu = __riscv_vmv_v_x_u16m2(0, vl); + size_t subprob = block_size; + while (subprob > 0) { + vuint8m1_t v_buf8 = __riscv_vle8_v_u8m1(src, vl); + if (COPY) __riscv_vse8_v_u8m1(dst, v_buf8, vl); + v_adler32_prev_accu = __riscv_vwaddu_wv_u32m4(v_adler32_prev_accu, v_buf16_accu, vl); + v_buf16_accu = __riscv_vwaddu_wv_u16m2(v_buf16_accu, v_buf8, vl); + src += vl; + if (COPY) dst += vl; + subprob -= vl; + } + v_adler32_prev_accu = __riscv_vmacc_vx_u32m4(v_adler32_prev_accu, block_size / vl, v_buf32_accu, vl); + v_buf32_accu = __riscv_vwaddu_wv_u32m4(v_buf32_accu, v_buf16_accu, vl); + left -= block_size; + /* do modulo once each block of NMAX size */ + if (++cnt >= nmax_limit) { + v_adler32_prev_accu = __riscv_vremu_vx_u32m4(v_adler32_prev_accu, BASE, vl); + cnt = 0; + } + } + /* the left len <= 256 now, we can use 16-bit accum safely */ + v_buf16_accu = __riscv_vmv_v_x_u16m2(0, vl); + size_t res = left; + while (left >= vl) { + vuint8m1_t v_buf8 = __riscv_vle8_v_u8m1(src, vl); + if (COPY) __riscv_vse8_v_u8m1(dst, v_buf8, vl); + v_adler32_prev_accu = __riscv_vwaddu_wv_u32m4(v_adler32_prev_accu, v_buf16_accu, vl); + v_buf16_accu = __riscv_vwaddu_wv_u16m2(v_buf16_accu, v_buf8, vl); + src += vl; + if (COPY) dst += vl; + left -= vl; + } + v_adler32_prev_accu = __riscv_vmacc_vx_u32m4(v_adler32_prev_accu, res / vl, v_buf32_accu, vl); + v_adler32_prev_accu = __riscv_vremu_vx_u32m4(v_adler32_prev_accu, BASE, vl); + v_buf32_accu = __riscv_vwaddu_wv_u32m4(v_buf32_accu, v_buf16_accu, vl); + + vuint32m4_t v_seq = __riscv_vid_v_u32m4(vl); + vuint32m4_t v_rev_seq = __riscv_vrsub_vx_u32m4(v_seq, vl, vl); + vuint32m4_t v_sum32_accu = __riscv_vmul_vv_u32m4(v_buf32_accu, v_rev_seq, vl); + + v_sum32_accu = __riscv_vadd_vv_u32m4(v_sum32_accu, __riscv_vmul_vx_u32m4(v_adler32_prev_accu, vl, vl), vl); + + vuint32m1_t v_sum2_sum = __riscv_vmv_s_x_u32m1(0, vl); + v_sum2_sum = __riscv_vredsum_vs_u32m4_u32m1(v_sum32_accu, v_sum2_sum, vl); + uint32_t sum2_sum = __riscv_vmv_x_s_u32m1_u32(v_sum2_sum); + + sum2 += (sum2_sum + adler * (len - left)); + + vuint32m1_t v_adler_sum = __riscv_vmv_s_x_u32m1(0, vl); + v_adler_sum = __riscv_vredsum_vs_u32m4_u32m1(v_buf32_accu, v_adler_sum, vl); + uint32_t adler_sum = __riscv_vmv_x_s_u32m1_u32(v_adler_sum); + + adler += adler_sum; + + while (left--) { + if (COPY) *dst++ = *src; + adler += *src++; + sum2 += adler; + } + + sum2 %= BASE; + adler %= BASE; + + return adler | (sum2 << 16); +} + +Z_INTERNAL uint32_t adler32_fold_copy_rvv(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) { + return adler32_rvv_impl(adler, dst, src, len, 1); +} + +Z_INTERNAL uint32_t adler32_rvv(uint32_t adler, const uint8_t *buf, size_t len) { + return adler32_rvv_impl(adler, NULL, buf, len, 0); +} + +#endif // RISCV_RVV diff --git a/internal-complibs/zlib-ng-2.2.2/arch/riscv/chunkset_rvv.c b/internal-complibs/zlib-ng-2.2.2/arch/riscv/chunkset_rvv.c new file mode 100644 index 000000000..ee43bde2f --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/riscv/chunkset_rvv.c @@ -0,0 +1,121 @@ +/* chunkset_rvv.c - RVV version of chunkset + * Copyright (C) 2023 SiFive, Inc. All rights reserved. + * Contributed by Alex Chiang + * For conditions of distribution and use, see copyright notice in zlib.h + */ +#include +#include "zbuild.h" + +/* + * RISC-V glibc would enable RVV optimized memcpy at runtime by IFUNC, + * so we prefer using large size chunk and copy memory as much as possible. + */ +#define CHUNK_SIZE 32 + +#define HAVE_CHUNKMEMSET_2 +#define HAVE_CHUNKMEMSET_4 +#define HAVE_CHUNKMEMSET_8 + +#define CHUNK_MEMSET_RVV_IMPL(elen) \ +do { \ + size_t vl, len = CHUNK_SIZE / sizeof(uint##elen##_t); \ + uint##elen##_t val = *(uint##elen##_t*)from; \ + uint##elen##_t* chunk_p = (uint##elen##_t*)chunk; \ + do { \ + vl = __riscv_vsetvl_e##elen##m4(len); \ + vuint##elen##m4_t v_val = __riscv_vmv_v_x_u##elen##m4(val, vl); \ + __riscv_vse##elen##_v_u##elen##m4(chunk_p, v_val, vl); \ + len -= vl; chunk_p += vl; \ + } while (len > 0); \ +} while (0) + +/* We don't have a 32-byte datatype for RISC-V arch. */ +typedef struct chunk_s { + uint64_t data[4]; +} chunk_t; + +static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { + CHUNK_MEMSET_RVV_IMPL(16); +} + +static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { + CHUNK_MEMSET_RVV_IMPL(32); +} + +static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { + CHUNK_MEMSET_RVV_IMPL(64); +} + +static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { + memcpy(chunk->data, (uint8_t *)s, CHUNK_SIZE); +} + +static inline void storechunk(uint8_t *out, chunk_t *chunk) { + memcpy(out, chunk->data, CHUNK_SIZE); +} + +#define CHUNKSIZE chunksize_rvv +#define CHUNKCOPY chunkcopy_rvv +#define CHUNKUNROLL chunkunroll_rvv +#define CHUNKMEMSET chunkmemset_rvv +#define CHUNKMEMSET_SAFE chunkmemset_safe_rvv + +#define HAVE_CHUNKCOPY + +/* + * Assuming that the length is non-zero, and that `from` lags `out` by at least + * sizeof chunk_t bytes, please see the comments in chunkset_tpl.h. + * + * We load/store a single chunk once in the `CHUNKCOPY`. + * However, RISC-V glibc would enable RVV optimized memcpy at runtime by IFUNC, + * such that, we prefer copy large memory size once to make good use of the the RVV advance. + * + * To be aligned to the other platforms, we didn't modify `CHUNKCOPY` method a lot, + * but we still copy as much memory as possible for some conditions. + * + * case 1: out - from >= len (no overlap) + * We can use memcpy to copy `len` size once + * because the memory layout would be the same. + * + * case 2: overlap + * We copy N chunks using memcpy at once, aiming to achieve our goal: + * to copy as much memory as possible. + * + * After using a single memcpy to copy N chunks, we have to use series of + * loadchunk and storechunk to ensure the result is correct. + */ +static inline uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) { + Assert(len > 0, "chunkcopy should never have a length 0"); + int32_t align = ((len - 1) % sizeof(chunk_t)) + 1; + memcpy(out, from, sizeof(chunk_t)); + out += align; + from += align; + len -= align; + ptrdiff_t dist = out - from; + if (dist >= len) { + memcpy(out, from, len); + out += len; + from += len; + return out; + } + if (dist >= sizeof(chunk_t)) { + dist = (dist / sizeof(chunk_t)) * sizeof(chunk_t); + memcpy(out, from, dist); + out += dist; + from += dist; + len -= dist; + } + while (len > 0) { + memcpy(out, from, sizeof(chunk_t)); + out += sizeof(chunk_t); + from += sizeof(chunk_t); + len -= sizeof(chunk_t); + } + return out; +} + +#include "chunkset_tpl.h" + +#define INFLATE_FAST inflate_fast_rvv + +#include "inffast_tpl.h" diff --git a/internal-complibs/zlib-ng-2.2.2/arch/riscv/compare256_rvv.c b/internal-complibs/zlib-ng-2.2.2/arch/riscv/compare256_rvv.c new file mode 100644 index 000000000..3d6c3e3aa --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/riscv/compare256_rvv.c @@ -0,0 +1,49 @@ +/* compare256_rvv.c - RVV version of compare256 + * Copyright (C) 2023 SiFive, Inc. All rights reserved. + * Contributed by Alex Chiang + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef RISCV_RVV + +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" +#include "fallback_builtins.h" + +#include + +static inline uint32_t compare256_rvv_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + size_t vl; + long found_diff; + do { + vl = __riscv_vsetvl_e8m4(256 - len); + vuint8m4_t v_src0 = __riscv_vle8_v_u8m4(src0, vl); + vuint8m4_t v_src1 = __riscv_vle8_v_u8m4(src1, vl); + vbool2_t v_mask = __riscv_vmsne_vv_u8m4_b2(v_src0, v_src1, vl); + found_diff = __riscv_vfirst_m_b2(v_mask, vl); + if (found_diff >= 0) + return len + (uint32_t)found_diff; + src0 += vl, src1 += vl, len += vl; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_rvv(const uint8_t *src0, const uint8_t *src1) { + return compare256_rvv_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_rvv +#define COMPARE256 compare256_rvv_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_rvv +#define COMPARE256 compare256_rvv_static + +#include "match_tpl.h" + +#endif // RISCV_RVV diff --git a/internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_features.c b/internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_features.c new file mode 100644 index 000000000..62658af70 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_features.c @@ -0,0 +1,71 @@ +#include +#include +#include +#include + +#if defined(__linux__) && defined(HAVE_SYS_AUXV_H) +# include +#endif + +#include "zbuild.h" +#include "riscv_features.h" + +#define ISA_V_HWCAP (1 << ('v' - 'a')) + +int Z_INTERNAL is_kernel_version_greater_or_equal_to_6_5() { + struct utsname buffer; + if (uname(&buffer) == -1) { + // uname failed + return 0; + } + + int major, minor; + if (sscanf(buffer.release, "%d.%d", &major, &minor) != 2) { + // Something bad with uname() + return 0; + } + + if (major > 6 || major == 6 && minor >= 5) + return 1; + return 0; +} + +void Z_INTERNAL riscv_check_features_compile_time(struct riscv_cpu_features *features) { +#if defined(__riscv_v) && defined(__linux__) + features->has_rvv = 1; +#else + features->has_rvv = 0; +#endif +} + +void Z_INTERNAL riscv_check_features_runtime(struct riscv_cpu_features *features) { +#if defined(__linux__) && defined(HAVE_SYS_AUXV_H) + unsigned long hw_cap = getauxval(AT_HWCAP); +#else + unsigned long hw_cap = 0; +#endif + features->has_rvv = hw_cap & ISA_V_HWCAP; +} + +void Z_INTERNAL riscv_check_features(struct riscv_cpu_features *features) { + if (is_kernel_version_greater_or_equal_to_6_5()) + riscv_check_features_runtime(features); + else + riscv_check_features_compile_time(features); + if (features->has_rvv) { + size_t e8m1_vec_len; + intptr_t vtype_reg_val; + // Check that a vuint8m1_t vector is at least 16 bytes and that tail + // agnostic and mask agnostic mode are supported + // + __asm__ volatile( + "vsetvli %0, zero, e8, m1, ta, ma\n\t" + "csrr %1, vtype" + : "=r"(e8m1_vec_len), "=r"(vtype_reg_val)); + + // The RVV target is supported if the VILL bit of VTYPE (the MSB bit of + // VTYPE) is not set and the length of a vuint8m1_t vector is at least 16 + // bytes + features->has_rvv = (vtype_reg_val >= 0 && e8m1_vec_len >= 16); + } +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_features.h b/internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_features.h new file mode 100644 index 000000000..b1593acc2 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_features.h @@ -0,0 +1,18 @@ +/* riscv_features.h -- check for riscv features. + * + * Copyright (C) 2023 SiFive, Inc. All rights reserved. + * Contributed by Alex Chiang + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef RISCV_FEATURES_H_ +#define RISCV_FEATURES_H_ + +struct riscv_cpu_features { + int has_rvv; +}; + +void Z_INTERNAL riscv_check_features(struct riscv_cpu_features *features); + +#endif /* RISCV_FEATURES_H_ */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_functions.h b/internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_functions.h new file mode 100644 index 000000000..015b2fbd7 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/riscv/riscv_functions.h @@ -0,0 +1,49 @@ +/* riscv_functions.h -- RISCV implementations for arch-specific functions. + * + * Copyright (C) 2023 SiFive, Inc. All rights reserved. + * Contributed by Alex Chiang + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef RISCV_FUNCTIONS_H_ +#define RISCV_FUNCTIONS_H_ + +#ifdef RISCV_RVV +uint32_t adler32_rvv(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t adler32_fold_copy_rvv(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +uint32_t chunksize_rvv(void); +uint8_t* chunkmemset_safe_rvv(uint8_t *out, unsigned dist, unsigned len, unsigned left); +uint32_t compare256_rvv(const uint8_t *src0, const uint8_t *src1); + +uint32_t longest_match_rvv(deflate_state *const s, Pos cur_match); +uint32_t longest_match_slow_rvv(deflate_state *const s, Pos cur_match); +void slide_hash_rvv(deflate_state *s); +void inflate_fast_rvv(PREFIX3(stream) *strm, uint32_t start); +#endif + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +// RISCV - RVV +# if defined(RISCV_RVV) && defined(__riscv_v) && defined(__linux__) +# undef native_adler32 +# define native_adler32 adler32_rvv +# undef native_adler32_fold_copy +# define native_adler32_fold_copy adler32_fold_copy_rvv +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_rvv +# undef native_chunksize +# define native_chunksize chunksize_rvv +# undef native_compare256 +# define native_compare256 compare256_rvv +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_rvv +# undef native_longest_match +# define native_longest_match longest_match_rvv +# undef native_longest_match_slow +# define native_longest_match_slow longest_match_slow_rvv +# undef native_slide_hash +# define native_slide_hash slide_hash_rvv +# endif +#endif + +#endif /* RISCV_FUNCTIONS_H_ */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/riscv/slide_hash_rvv.c b/internal-complibs/zlib-ng-2.2.2/arch/riscv/slide_hash_rvv.c new file mode 100644 index 000000000..6f53d7a13 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/riscv/slide_hash_rvv.c @@ -0,0 +1,33 @@ +/* slide_hash_rvv.c - RVV version of slide_hash + * Copyright (C) 2023 SiFive, Inc. All rights reserved. + * Contributed by Alex Chiang + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef RISCV_RVV + +#include + +#include "zbuild.h" +#include "deflate.h" + +static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize) { + size_t vl; + while (entries > 0) { + vl = __riscv_vsetvl_e16m4(entries); + vuint16m4_t v_tab = __riscv_vle16_v_u16m4(table, vl); + vuint16m4_t v_diff = __riscv_vssubu_vx_u16m4(v_tab, wsize, vl); + __riscv_vse16_v_u16m4(table, v_diff, vl); + table += vl, entries -= vl; + } +} + +Z_INTERNAL void slide_hash_rvv(deflate_state *s) { + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); + uint16_t wsize = (uint16_t)s->w_size; + + slide_hash_chain(s->head, HASH_SIZE, wsize); + slide_hash_chain(s->prev, wsize, wsize); +} + +#endif // RISCV_RVV diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/Makefile.in b/internal-complibs/zlib-ng-2.2.2/arch/s390/Makefile.in similarity index 62% rename from internal-complibs/zlib-ng-2.0.7/arch/s390/Makefile.in rename to internal-complibs/zlib-ng-2.2.2/arch/s390/Makefile.in index 2652fe62d..e994157df 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/Makefile.in +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/Makefile.in @@ -7,16 +7,18 @@ CFLAGS= SFLAGS= INCLUDES= SUFFIX= +VGFMAFLAG= +NOLTOFLAG= SRCDIR=. SRCTOP=../.. TOPDIR=$(SRCTOP) -dfltcc_common.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_common.c +s390_features.o: + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/s390_features.c -dfltcc_common.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_common.c +s390_features.lo: + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/s390_features.c dfltcc_deflate.o: $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_deflate.c @@ -30,11 +32,17 @@ dfltcc_inflate.o: dfltcc_inflate.lo: $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_inflate.c +crc32-vx.o: + $(CC) $(CFLAGS) $(VGFMAFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32-vx.c + +crc32-vx.lo: + $(CC) $(SFLAGS) $(VGFMAFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32-vx.c + mostlyclean: clean clean: rm -f *.o *.lo *~ rm -rf objs rm -f *.gcda *.gcno *.gcov -distclean: +distclean: clean rm -f Makefile diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/README.md b/internal-complibs/zlib-ng-2.2.2/arch/s390/README.md similarity index 82% rename from internal-complibs/zlib-ng-2.0.7/arch/s390/README.md rename to internal-complibs/zlib-ng-2.2.2/arch/s390/README.md index 90066f0f9..7b383cc99 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/README.md +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/README.md @@ -61,16 +61,17 @@ integrated with the rest of zlib-ng using hook macros. ## Hook macros DFLTCC takes as arguments a parameter block, an input buffer, an output -buffer and a window. `ZALLOC_STATE()`, `ZFREE_STATE()`, `ZCOPY_STATE()`, -`ZALLOC_WINDOW()` and `TRY_FREE_WINDOW()` macros encapsulate allocation -details for the parameter block (which is allocated alongside zlib-ng -state) and the window (which must be page-aligned). - -While inflate software and hardware window formats match, this is not -the case for deflate. Therefore, `deflateSetDictionary()` and -`deflateGetDictionary()` need special handling, which is triggered using -`DEFLATE_SET_DICTIONARY_HOOK()` and `DEFLATE_GET_DICTIONARY_HOOK()` -macros. +buffer, and a window. Parameter blocks are stored alongside zlib states; +buffers are forwarded from the caller; and window - which must be +4k-aligned and is always 64k large, is managed using the `PAD_WINDOW()`, +`WINDOW_PAD_SIZE`, `HINT_ALIGNED_WINDOW` and `DEFLATE_ADJUST_WINDOW_SIZE()` +and `INFLATE_ADJUST_WINDOW_SIZE()` hooks. + +Software and hardware window formats do not match, therefore, +`deflateSetDictionary()`, `deflateGetDictionary()`, `inflateSetDictionary()` +and `inflateGetDictionary()` need special handling, which is triggered using +`DEFLATE_SET_DICTIONARY_HOOK()`, `DEFLATE_GET_DICTIONARY_HOOK()`, +`INFLATE_SET_DICTIONARY_HOOK()` and `INFLATE_GET_DICTIONARY_HOOK()` macros. `deflateResetKeep()` and `inflateResetKeep()` update the DFLTCC parameter block using `DEFLATE_RESET_KEEP_HOOK()` and @@ -116,8 +117,7 @@ converted to calls to functions, which are implemented in `arch/s390/dfltcc_*` files. The functions can be grouped in three broad categories: -* Base DFLTCC support, e.g. wrapping the machine instruction - - `dfltcc()` and allocating aligned memory - `dfltcc_alloc_state()`. +* Base DFLTCC support, e.g. wrapping the machine instruction - `dfltcc()`. * Translating between software and hardware data formats, e.g. `dfltcc_deflate_set_dictionary()`. * Translating between software and hardware state machines, e.g. @@ -213,29 +213,31 @@ DFLTCC is a non-privileged instruction, neither special VM/LPAR configuration nor root are required. zlib-ng CI uses an IBM-provided z15 self-hosted builder for the DFLTCC -testing. There are no IBM Z builds of GitHub Actions runner, and -stable qemu-user has problems with .NET apps, so the builder runs the -x86_64 runner version with qemu-user built from the master branch. +testing. There is no official IBM Z GitHub Actions runner, so we build +one inspired by `anup-kodlekere/gaplib`. +Future updates to actions-runner might need an updated patch. The .net +version number patch has been separated into a separate file to avoid a +need for constantly changing the patch. ## Configuring the builder. ### Install prerequisites. ``` -$ sudo dnf install docker +sudo dnf install podman ``` -### Add services. +### Add actions-runner service. ``` -$ sudo cp self-hosted-builder/*.service /etc/systemd/system/ -$ sudo systemctl daemon-reload +sudo cp self-hosted-builder/actions-runner.service /etc/systemd/system/ +sudo systemctl daemon-reload ``` -### Create a config file. +### Create a config file, needs github personal access token. ``` -$ sudo tee /etc/actions-runner +# Create file /etc/actions-runner repo=/ access_token= ``` @@ -244,40 +246,32 @@ Access token should have the repo scope, consult https://docs.github.com/en/rest/reference/actions#create-a-registration-token-for-a-repository for details. -### Autostart the x86_64 emulation support. +### Autostart actions-runner. ``` -$ sudo systemctl enable --now qemu-user-static +$ sudo systemctl enable --now actions-runner ``` -### Autostart the runner. +## Rebuilding the container +In order to update the `gaplib-actions-runner` podman container, e.g. to get the +latest OS security fixes, follow these steps: ``` -$ sudo systemctl enable --now actions-runner -``` +# Stop actions-runner service +sudo systemctl stop actions-runner -## Rebuilding the image +# Delete old container +sudo podman container rm gaplib-actions-runner -In order to update the `iiilinuxibmcom/actions-runner` image, e.g. to get the -latest OS security fixes, use the following commands: +# Delete old image +sudo podman image rm localhost/zlib-ng/actions-runner -``` -$ sudo docker build \ - --pull \ - -f self-hosted-builder/actions-runner.Dockerfile \ - -t iiilinuxibmcom/actions-runner -$ sudo systemctl restart actions-runner -``` +# Build image +sudo podman build --squash -f Dockerfile.zlib-ng --tag zlib-ng/actions-runner --build-arg . -## Removing persistent data +# Build container +sudo podman create --name=gaplib-actions-runner --env-file=/etc/actions-runner --init --interactive --volume=actions-runner-temp:/home/actions-runner zlib-ng/actions-runner -The `actions-runner` service stores various temporary data, such as runner -registration information, work directories and logs, in the `actions-runner` -volume. In order to remove it and start from scratch, e.g. when switching the -runner to a different repository, use the following commands: - -``` -$ sudo systemctl stop actions-runner -$ sudo docker rm -f actions-runner -$ sudo docker volume rm actions-runner +# Start actions-runner service +sudo systemctl start actions-runner ``` diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/crc32-vx.c b/internal-complibs/zlib-ng-2.2.2/arch/s390/crc32-vx.c new file mode 100644 index 000000000..b3dcbf703 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/crc32-vx.c @@ -0,0 +1,222 @@ +/* + * Hardware-accelerated CRC-32 variants for Linux on z Systems + * + * Use the z/Architecture Vector Extension Facility to accelerate the + * computing of bitreflected CRC-32 checksums. + * + * This CRC-32 implementation algorithm is bitreflected and processes + * the least-significant bit first (Little-Endian). + * + * This code was originally written by Hendrik Brueckner + * for use in the Linux kernel and has been + * relicensed under the zlib license. + */ + +#include "zbuild.h" +#include "arch_functions.h" + +#include + +typedef unsigned char uv16qi __attribute__((vector_size(16))); +typedef unsigned int uv4si __attribute__((vector_size(16))); +typedef unsigned long long uv2di __attribute__((vector_size(16))); + +static uint32_t crc32_le_vgfm_16(uint32_t crc, const uint8_t *buf, size_t len) { + /* + * The CRC-32 constant block contains reduction constants to fold and + * process particular chunks of the input data stream in parallel. + * + * For the CRC-32 variants, the constants are precomputed according to + * these definitions: + * + * R1 = [(x4*128+32 mod P'(x) << 32)]' << 1 + * R2 = [(x4*128-32 mod P'(x) << 32)]' << 1 + * R3 = [(x128+32 mod P'(x) << 32)]' << 1 + * R4 = [(x128-32 mod P'(x) << 32)]' << 1 + * R5 = [(x64 mod P'(x) << 32)]' << 1 + * R6 = [(x32 mod P'(x) << 32)]' << 1 + * + * The bitreflected Barret reduction constant, u', is defined as + * the bit reversal of floor(x**64 / P(x)). + * + * where P(x) is the polynomial in the normal domain and the P'(x) is the + * polynomial in the reversed (bitreflected) domain. + * + * CRC-32 (IEEE 802.3 Ethernet, ...) polynomials: + * + * P(x) = 0x04C11DB7 + * P'(x) = 0xEDB88320 + */ + const uv16qi perm_le2be = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; /* BE->LE mask */ + const uv2di r2r1 = {0x1C6E41596, 0x154442BD4}; /* R2, R1 */ + const uv2di r4r3 = {0x0CCAA009E, 0x1751997D0}; /* R4, R3 */ + const uv2di r5 = {0, 0x163CD6124}; /* R5 */ + const uv2di ru_poly = {0, 0x1F7011641}; /* u' */ + const uv2di crc_poly = {0, 0x1DB710641}; /* P'(x) << 1 */ + + /* + * Load the initial CRC value. + * + * The CRC value is loaded into the rightmost word of the + * vector register and is later XORed with the LSB portion + * of the loaded input data. + */ + uv2di v0 = {0, 0}; + v0 = (uv2di)vec_insert(crc, (uv4si)v0, 3); + + /* Load a 64-byte data chunk and XOR with CRC */ + uv2di v1 = vec_perm(((uv2di *)buf)[0], ((uv2di *)buf)[0], perm_le2be); + uv2di v2 = vec_perm(((uv2di *)buf)[1], ((uv2di *)buf)[1], perm_le2be); + uv2di v3 = vec_perm(((uv2di *)buf)[2], ((uv2di *)buf)[2], perm_le2be); + uv2di v4 = vec_perm(((uv2di *)buf)[3], ((uv2di *)buf)[3], perm_le2be); + + v1 ^= v0; + buf += 64; + len -= 64; + + while (len >= 64) { + /* Load the next 64-byte data chunk */ + uv16qi part1 = vec_perm(((uv16qi *)buf)[0], ((uv16qi *)buf)[0], perm_le2be); + uv16qi part2 = vec_perm(((uv16qi *)buf)[1], ((uv16qi *)buf)[1], perm_le2be); + uv16qi part3 = vec_perm(((uv16qi *)buf)[2], ((uv16qi *)buf)[2], perm_le2be); + uv16qi part4 = vec_perm(((uv16qi *)buf)[3], ((uv16qi *)buf)[3], perm_le2be); + + /* + * Perform a GF(2) multiplication of the doublewords in V1 with + * the R1 and R2 reduction constants in V0. The intermediate result + * is then folded (accumulated) with the next data chunk in PART1 and + * stored in V1. Repeat this step for the register contents + * in V2, V3, and V4 respectively. + */ + v1 = (uv2di)vec_gfmsum_accum_128(r2r1, v1, part1); + v2 = (uv2di)vec_gfmsum_accum_128(r2r1, v2, part2); + v3 = (uv2di)vec_gfmsum_accum_128(r2r1, v3, part3); + v4 = (uv2di)vec_gfmsum_accum_128(r2r1, v4, part4); + + buf += 64; + len -= 64; + } + + /* + * Fold V1 to V4 into a single 128-bit value in V1. Multiply V1 with R3 + * and R4 and accumulating the next 128-bit chunk until a single 128-bit + * value remains. + */ + v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v2); + v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v3); + v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v4); + + while (len >= 16) { + /* Load next data chunk */ + v2 = vec_perm(*(uv2di *)buf, *(uv2di *)buf, perm_le2be); + + /* Fold next data chunk */ + v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v2); + + buf += 16; + len -= 16; + } + + /* + * Set up a vector register for byte shifts. The shift value must + * be loaded in bits 1-4 in byte element 7 of a vector register. + * Shift by 8 bytes: 0x40 + * Shift by 4 bytes: 0x20 + */ + uv16qi v9 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + v9 = vec_insert((unsigned char)0x40, v9, 7); + + /* + * Prepare V0 for the next GF(2) multiplication: shift V0 by 8 bytes + * to move R4 into the rightmost doubleword and set the leftmost + * doubleword to 0x1. + */ + v0 = vec_srb(r4r3, (uv2di)v9); + v0[0] = 1; + + /* + * Compute GF(2) product of V1 and V0. The rightmost doubleword + * of V1 is multiplied with R4. The leftmost doubleword of V1 is + * multiplied by 0x1 and is then XORed with rightmost product. + * Implicitly, the intermediate leftmost product becomes padded + */ + v1 = (uv2di)vec_gfmsum_128(v0, v1); + + /* + * Now do the final 32-bit fold by multiplying the rightmost word + * in V1 with R5 and XOR the result with the remaining bits in V1. + * + * To achieve this by a single VGFMAG, right shift V1 by a word + * and store the result in V2 which is then accumulated. Use the + * vector unpack instruction to load the rightmost half of the + * doubleword into the rightmost doubleword element of V1; the other + * half is loaded in the leftmost doubleword. + * The vector register with CONST_R5 contains the R5 constant in the + * rightmost doubleword and the leftmost doubleword is zero to ignore + * the leftmost product of V1. + */ + v9 = vec_insert((unsigned char)0x20, v9, 7); + v2 = vec_srb(v1, (uv2di)v9); + v1 = vec_unpackl((uv4si)v1); /* Split rightmost doubleword */ + v1 = (uv2di)vec_gfmsum_accum_128(r5, v1, (uv16qi)v2); + + /* + * Apply a Barret reduction to compute the final 32-bit CRC value. + * + * The input values to the Barret reduction are the degree-63 polynomial + * in V1 (R(x)), degree-32 generator polynomial, and the reduction + * constant u. The Barret reduction result is the CRC value of R(x) mod + * P(x). + * + * The Barret reduction algorithm is defined as: + * + * 1. T1(x) = floor( R(x) / x^32 ) GF2MUL u + * 2. T2(x) = floor( T1(x) / x^32 ) GF2MUL P(x) + * 3. C(x) = R(x) XOR T2(x) mod x^32 + * + * Note: The leftmost doubleword of vector register containing + * CONST_RU_POLY is zero and, thus, the intermediate GF(2) product + * is zero and does not contribute to the final result. + */ + + /* T1(x) = floor( R(x) / x^32 ) GF2MUL u */ + v2 = vec_unpackl((uv4si)v1); + v2 = (uv2di)vec_gfmsum_128(ru_poly, v2); + + /* + * Compute the GF(2) product of the CRC polynomial with T1(x) in + * V2 and XOR the intermediate result, T2(x), with the value in V1. + * The final result is stored in word element 2 of V2. + */ + v2 = vec_unpackl((uv4si)v2); + v2 = (uv2di)vec_gfmsum_accum_128(crc_poly, v2, (uv16qi)v1); + + return ((uv4si)v2)[2]; +} + +#define VX_MIN_LEN 64 +#define VX_ALIGNMENT 16L +#define VX_ALIGN_MASK (VX_ALIGNMENT - 1) + +uint32_t Z_INTERNAL crc32_s390_vx(uint32_t crc, const unsigned char *buf, size_t len) { + size_t prealign, aligned, remaining; + + if (len < VX_MIN_LEN + VX_ALIGN_MASK) + return PREFIX(crc32_braid)(crc, buf, len); + + if ((uintptr_t)buf & VX_ALIGN_MASK) { + prealign = VX_ALIGNMENT - ((uintptr_t)buf & VX_ALIGN_MASK); + len -= prealign; + crc = PREFIX(crc32_braid)(crc, buf, prealign); + buf += prealign; + } + aligned = len & ~VX_ALIGN_MASK; + remaining = len & VX_ALIGN_MASK; + + crc = crc32_le_vgfm_16(crc ^ 0xffffffff, buf, aligned) ^ 0xffffffff; + + if (remaining) + crc = PREFIX(crc32_braid)(crc, buf + aligned, remaining); + + return crc; +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_common.h b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_common.h new file mode 100644 index 000000000..a6527ab5d --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_common.h @@ -0,0 +1,119 @@ +#ifndef DFLTCC_COMMON_H +#define DFLTCC_COMMON_H + +#include "zutil.h" + +/* + Parameter Block for Query Available Functions. + */ +struct dfltcc_qaf_param { + char fns[16]; + char reserved1[8]; + char fmts[2]; + char reserved2[6]; +} ALIGNED_(8); + +/* + Parameter Block for Generate Dynamic-Huffman Table, Compress and Expand. + */ +struct dfltcc_param_v0 { + uint16_t pbvn; /* Parameter-Block-Version Number */ + uint8_t mvn; /* Model-Version Number */ + uint8_t ribm; /* Reserved for IBM use */ + uint32_t reserved32 : 31; + uint32_t cf : 1; /* Continuation Flag */ + uint8_t reserved64[8]; + uint32_t nt : 1; /* New Task */ + uint32_t reserved129 : 1; + uint32_t cvt : 1; /* Check Value Type */ + uint32_t reserved131 : 1; + uint32_t htt : 1; /* Huffman-Table Type */ + uint32_t bcf : 1; /* Block-Continuation Flag */ + uint32_t bcc : 1; /* Block Closing Control */ + uint32_t bhf : 1; /* Block Header Final */ + uint32_t reserved136 : 1; + uint32_t reserved137 : 1; + uint32_t dhtgc : 1; /* DHT Generation Control */ + uint32_t reserved139 : 5; + uint32_t reserved144 : 5; + uint32_t sbb : 3; /* Sub-Byte Boundary */ + uint8_t oesc; /* Operation-Ending-Supplemental Code */ + uint32_t reserved160 : 12; + uint32_t ifs : 4; /* Incomplete-Function Status */ + uint16_t ifl; /* Incomplete-Function Length */ + uint8_t reserved192[8]; + uint8_t reserved256[8]; + uint8_t reserved320[4]; + uint16_t hl; /* History Length */ + uint32_t reserved368 : 1; + uint16_t ho : 15; /* History Offset */ + uint32_t cv; /* Check Value */ + uint32_t eobs : 15; /* End-of-block Symbol */ + uint32_t reserved431: 1; + uint8_t eobl : 4; /* End-of-block Length */ + uint32_t reserved436 : 12; + uint32_t reserved448 : 4; + uint16_t cdhtl : 12; /* Compressed-Dynamic-Huffman Table + Length */ + uint8_t reserved464[6]; + uint8_t cdht[288]; /* Compressed-Dynamic-Huffman Table */ + uint8_t reserved[24]; + uint8_t ribm2[8]; /* Reserved for IBM use */ + uint8_t csb[1152]; /* Continuation-State Buffer */ +} ALIGNED_(8); + +/* + Extension of inflate_state and deflate_state. + */ +struct dfltcc_state { + struct dfltcc_param_v0 param; /* Parameter block. */ + struct dfltcc_qaf_param af; /* Available functions. */ + char msg[64]; /* Buffer for strm->msg */ +}; + +typedef struct { + struct dfltcc_state common; + uint16_t level_mask; /* Levels on which to use DFLTCC */ + uint32_t block_size; /* New block each X bytes */ + size_t block_threshold; /* New block after total_in > X */ + uint32_t dht_threshold; /* New block only if avail_in >= X */ +} arch_deflate_state; + +typedef struct { + struct dfltcc_state common; +} arch_inflate_state; + +/* + History buffer size. + */ +#define HB_BITS 15 +#define HB_SIZE (1 << HB_BITS) + +/* + Sizes of deflate block parts. + */ +#define DFLTCC_BLOCK_HEADER_BITS 3 +#define DFLTCC_HLITS_COUNT_BITS 5 +#define DFLTCC_HDISTS_COUNT_BITS 5 +#define DFLTCC_HCLENS_COUNT_BITS 4 +#define DFLTCC_MAX_HCLENS 19 +#define DFLTCC_HCLEN_BITS 3 +#define DFLTCC_MAX_HLITS 286 +#define DFLTCC_MAX_HDISTS 30 +#define DFLTCC_MAX_HLIT_HDIST_BITS 7 +#define DFLTCC_MAX_SYMBOL_BITS 16 +#define DFLTCC_MAX_EOBS_BITS 15 +#define DFLTCC_MAX_PADDING_BITS 7 + +#define DEFLATE_BOUND_COMPLEN(source_len) \ + ((DFLTCC_BLOCK_HEADER_BITS + \ + DFLTCC_HLITS_COUNT_BITS + \ + DFLTCC_HDISTS_COUNT_BITS + \ + DFLTCC_HCLENS_COUNT_BITS + \ + DFLTCC_MAX_HCLENS * DFLTCC_HCLEN_BITS + \ + (DFLTCC_MAX_HLITS + DFLTCC_MAX_HDISTS) * DFLTCC_MAX_HLIT_HDIST_BITS + \ + (source_len) * DFLTCC_MAX_SYMBOL_BITS + \ + DFLTCC_MAX_EOBS_BITS + \ + DFLTCC_MAX_PADDING_BITS) >> 3) + +#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_deflate.c b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_deflate.c similarity index 77% rename from internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_deflate.c rename to internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_deflate.c index 9ecc6ba24..90b4b96e9 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_deflate.c +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_deflate.c @@ -14,16 +14,28 @@ */ #include "zbuild.h" -#include "zutil.h" #include "deflate.h" #include "trees_emit.h" #include "dfltcc_deflate.h" #include "dfltcc_detail.h" +void Z_INTERNAL PREFIX(dfltcc_reset_deflate_state)(PREFIX3(streamp) strm) { + deflate_state *state = (deflate_state *)strm->state; + arch_deflate_state *dfltcc_state = &state->arch; + + dfltcc_reset_state(&dfltcc_state->common); + + /* Initialize tuning parameters */ + dfltcc_state->level_mask = DFLTCC_LEVEL_MASK; + dfltcc_state->block_size = DFLTCC_BLOCK_SIZE; + dfltcc_state->block_threshold = DFLTCC_FIRST_FHT_BLOCK_SIZE; + dfltcc_state->dht_threshold = DFLTCC_DHT_MIN_SAMPLE_SIZE; +} + static inline int dfltcc_can_deflate_with_params(PREFIX3(streamp) strm, int level, uInt window_bits, int strategy, int reproducible) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); + arch_deflate_state *dfltcc_state = &state->arch; /* Unsupported compression settings */ if ((dfltcc_state->level_mask & (1 << level)) == 0) @@ -36,15 +48,15 @@ static inline int dfltcc_can_deflate_with_params(PREFIX3(streamp) strm, int leve return 0; /* Unsupported hardware */ - if (!is_bit_set(dfltcc_state->af.fns, DFLTCC_GDHT) || - !is_bit_set(dfltcc_state->af.fns, DFLTCC_CMPR) || - !is_bit_set(dfltcc_state->af.fmts, DFLTCC_FMT0)) + if (!is_bit_set(dfltcc_state->common.af.fns, DFLTCC_GDHT) || + !is_bit_set(dfltcc_state->common.af.fns, DFLTCC_CMPR) || + !is_bit_set(dfltcc_state->common.af.fmts, DFLTCC_FMT0)) return 0; return 1; } -int Z_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm) { +int Z_INTERNAL PREFIX(dfltcc_can_deflate)(PREFIX3(streamp) strm) { deflate_state *state = (deflate_state *)strm->state; return dfltcc_can_deflate_with_params(strm, state->level, state->w_bits, state->strategy, state->reproducible); @@ -52,7 +64,7 @@ int Z_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm) { static inline void dfltcc_gdht(PREFIX3(streamp) strm) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; size_t avail_in = strm->avail_in; dfltcc(DFLTCC_GDHT, param, NULL, NULL, &strm->next_in, &avail_in, NULL); @@ -60,7 +72,7 @@ static inline void dfltcc_gdht(PREFIX3(streamp) strm) { static inline dfltcc_cc dfltcc_cmpr(PREFIX3(streamp) strm) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; size_t avail_in = strm->avail_in; size_t avail_out = strm->avail_out; dfltcc_cc cc; @@ -78,8 +90,8 @@ static inline dfltcc_cc dfltcc_cmpr(PREFIX3(streamp) strm) { static inline void send_eobs(PREFIX3(streamp) strm, const struct dfltcc_param_v0 *param) { deflate_state *state = (deflate_state *)strm->state; - send_bits(state, bi_reverse(param->eobs >> (15 - param->eobl), param->eobl), param->eobl, state->bi_buf, state->bi_valid); - flush_pending(strm); + send_bits(state, PREFIX(bi_reverse)(param->eobs >> (15 - param->eobl), param->eobl), param->eobl, state->bi_buf, state->bi_valid); + PREFIX(flush_pending)(strm); if (state->pending != 0) { /* The remaining data is located in pending_out[0:pending]. If someone * calls put_byte() - this might happen in deflate() - the byte will be @@ -95,17 +107,17 @@ static inline void send_eobs(PREFIX3(streamp) strm, const struct dfltcc_param_v0 #endif } -int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result) { +int Z_INTERNAL PREFIX(dfltcc_deflate)(PREFIX3(streamp) strm, int flush, block_state *result) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; + arch_deflate_state *dfltcc_state = &state->arch; + struct dfltcc_param_v0 *param = &dfltcc_state->common.param; uInt masked_avail_in; dfltcc_cc cc; int need_empty_block; int soft_bcc; int no_flush; - if (!dfltcc_can_deflate(strm)) { + if (!PREFIX(dfltcc_can_deflate)(strm)) { /* Clear history. */ if (flush == Z_FULL_FLUSH) param->hl = 0; @@ -213,7 +225,7 @@ int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *res if (state->wrap == 1) param->cv = strm->adler; else if (state->wrap == 2) - param->cv = ZSWAP32(strm->adler); + param->cv = ZSWAP32(state->crc_fold.value); /* When opening a block, choose a Huffman-Table Type */ if (!param->bcf) { @@ -238,7 +250,7 @@ int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *res } while (cc == DFLTCC_CC_AGAIN); /* Translate parameter block to stream */ - strm->msg = oesc_msg(dfltcc_state->msg, param->oesc); + strm->msg = oesc_msg(dfltcc_state->common.msg, param->oesc); state->bi_valid = param->sbb; if (state->bi_valid == 0) state->bi_buf = 0; /* Avoid accessing next_out */ @@ -247,7 +259,7 @@ int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *res if (state->wrap == 1) strm->adler = param->cv; else if (state->wrap == 2) - strm->adler = ZSWAP32(param->cv); + state->crc_fold.value = ZSWAP32(param->cv); /* Unmask the input data */ strm->avail_in += masked_avail_in; @@ -298,14 +310,14 @@ int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *res */ static int dfltcc_was_deflate_used(PREFIX3(streamp) strm) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; return strm->total_in > 0 || param->nt == 0 || param->hl > 0; } -int Z_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush) { +int Z_INTERNAL PREFIX(dfltcc_deflate_params)(PREFIX3(streamp) strm, int level, int strategy, int *flush) { deflate_state *state = (deflate_state *)strm->state; - int could_deflate = dfltcc_can_deflate(strm); + int could_deflate = PREFIX(dfltcc_can_deflate)(strm); int can_deflate = dfltcc_can_deflate_with_params(strm, level, state->w_bits, strategy, state->reproducible); if (can_deflate == could_deflate) @@ -321,10 +333,9 @@ int Z_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strat return Z_OK; } -int Z_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush) { +int Z_INTERNAL PREFIX(dfltcc_deflate_done)(PREFIX3(streamp) strm, int flush) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; /* When deflate(Z_FULL_FLUSH) is called with small avail_out, it might * close the block without resetting the compression state. Detect this @@ -337,10 +348,10 @@ int Z_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush) { * buffered some data (Continuation Flag is set), or has not written EOBS * yet (Block-Continuation Flag is set). */ - return !dfltcc_can_deflate(strm) || (!param->cf && !param->bcf); + return !PREFIX(dfltcc_can_deflate)(strm) || (!param->cf && !param->bcf); } -int Z_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible) { +int Z_INTERNAL PREFIX(dfltcc_can_set_reproducible)(PREFIX3(streamp) strm, int reproducible) { deflate_state *state = (deflate_state *)strm->state; return reproducible != state->reproducible && !dfltcc_was_deflate_used(strm); @@ -349,41 +360,10 @@ int Z_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducib /* Preloading history. */ -static void append_history(struct dfltcc_param_v0 *param, unsigned char *history, const unsigned char *buf, uInt count) { - size_t offset; - size_t n; - - /* Do not use more than 32K */ - if (count > HB_SIZE) { - buf += count - HB_SIZE; - count = HB_SIZE; - } - offset = (param->ho + param->hl) % HB_SIZE; - if (offset + count <= HB_SIZE) - /* Circular history buffer does not wrap - copy one chunk */ - memcpy(history + offset, buf, count); - else { - /* Circular history buffer wraps - copy two chunks */ - n = HB_SIZE - offset; - memcpy(history + offset, buf, n); - memcpy(history, buf + n, count - n); - } - n = param->hl + count; - if (n <= HB_SIZE) - /* All history fits into buffer - no need to discard anything */ - param->hl = n; - else { - /* History does not fit into buffer - discard extra bytes */ - param->ho = (param->ho + (n - HB_SIZE)) % HB_SIZE; - param->hl = HB_SIZE; - } -} - -int Z_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm, +int Z_INTERNAL PREFIX(dfltcc_deflate_set_dictionary)(PREFIX3(streamp) strm, const unsigned char *dictionary, uInt dict_length) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; append_history(param, state->window, dictionary, dict_length); state->strstart = 1; /* Add FDICT to zlib header */ @@ -391,21 +371,12 @@ int Z_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm, return Z_OK; } -int Z_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt *dict_length) { +int Z_INTERNAL PREFIX(dfltcc_deflate_get_dictionary)(PREFIX3(streamp) strm, unsigned char *dictionary, uInt *dict_length) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; - if (dictionary) { - if (param->ho + param->hl <= HB_SIZE) - /* Circular history buffer does not wrap - copy one chunk */ - memcpy(dictionary, state->window + param->ho, param->hl); - else { - /* Circular history buffer wraps - copy two chunks */ - memcpy(dictionary, state->window + param->ho, HB_SIZE - param->ho); - memcpy(dictionary + HB_SIZE - param->ho, state->window, param->ho + param->hl - HB_SIZE); - } - } + if (dictionary) + get_history(param, state->window, dictionary); if (dict_length) *dict_length = param->hl; return Z_OK; diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_deflate.h b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_deflate.h new file mode 100644 index 000000000..35e2fd3f6 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_deflate.h @@ -0,0 +1,58 @@ +#ifndef DFLTCC_DEFLATE_H +#define DFLTCC_DEFLATE_H + +#include "deflate.h" +#include "dfltcc_common.h" + +void Z_INTERNAL PREFIX(dfltcc_reset_deflate_state)(PREFIX3(streamp)); +int Z_INTERNAL PREFIX(dfltcc_can_deflate)(PREFIX3(streamp) strm); +int Z_INTERNAL PREFIX(dfltcc_deflate)(PREFIX3(streamp) strm, int flush, block_state *result); +int Z_INTERNAL PREFIX(dfltcc_deflate_params)(PREFIX3(streamp) strm, int level, int strategy, int *flush); +int Z_INTERNAL PREFIX(dfltcc_deflate_done)(PREFIX3(streamp) strm, int flush); +int Z_INTERNAL PREFIX(dfltcc_can_set_reproducible)(PREFIX3(streamp) strm, int reproducible); +int Z_INTERNAL PREFIX(dfltcc_deflate_set_dictionary)(PREFIX3(streamp) strm, + const unsigned char *dictionary, uInt dict_length); +int Z_INTERNAL PREFIX(dfltcc_deflate_get_dictionary)(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length); + +#define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \ + do { \ + if (PREFIX(dfltcc_can_deflate)((strm))) \ + return PREFIX(dfltcc_deflate_set_dictionary)((strm), (dict), (dict_len)); \ + } while (0) + +#define DEFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) \ + do { \ + if (PREFIX(dfltcc_can_deflate)((strm))) \ + return PREFIX(dfltcc_deflate_get_dictionary)((strm), (dict), (dict_len)); \ + } while (0) + +#define DEFLATE_RESET_KEEP_HOOK PREFIX(dfltcc_reset_deflate_state) + +#define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) \ + do { \ + int err; \ +\ + err = PREFIX(dfltcc_deflate_params)((strm), (level), (strategy), (hook_flush)); \ + if (err == Z_STREAM_ERROR) \ + return err; \ + } while (0) + +#define DEFLATE_DONE PREFIX(dfltcc_deflate_done) + +#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, source_len) \ + do { \ + if (deflateStateCheck((strm)) || PREFIX(dfltcc_can_deflate)((strm))) \ + (complen) = DEFLATE_BOUND_COMPLEN(source_len); \ + } while (0) + +#define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) (PREFIX(dfltcc_can_deflate)((strm))) + +#define DEFLATE_HOOK PREFIX(dfltcc_deflate) + +#define DEFLATE_NEED_CHECKSUM(strm) (!PREFIX(dfltcc_can_deflate)((strm))) + +#define DEFLATE_CAN_SET_REPRODUCIBLE PREFIX(dfltcc_can_set_reproducible) + +#define DEFLATE_ADJUST_WINDOW_SIZE(n) MAX(n, HB_SIZE) + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_detail.h b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_detail.h new file mode 100644 index 000000000..ae6001ba3 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_detail.h @@ -0,0 +1,275 @@ +#include "zbuild.h" +#include + +#ifdef HAVE_SYS_SDT_H +#include +#endif + +/* + Tuning parameters. + */ +#ifndef DFLTCC_LEVEL_MASK +#define DFLTCC_LEVEL_MASK 0x2 +#endif +#ifndef DFLTCC_BLOCK_SIZE +#define DFLTCC_BLOCK_SIZE 1048576 +#endif +#ifndef DFLTCC_FIRST_FHT_BLOCK_SIZE +#define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096 +#endif +#ifndef DFLTCC_DHT_MIN_SAMPLE_SIZE +#define DFLTCC_DHT_MIN_SAMPLE_SIZE 4096 +#endif +#ifndef DFLTCC_RIBM +#define DFLTCC_RIBM 0 +#endif + +#define static_assert(c, msg) __attribute__((unused)) static char static_assert_failed_ ## msg[c ? 1 : -1] + +#define DFLTCC_SIZEOF_QAF 32 +static_assert(sizeof(struct dfltcc_qaf_param) == DFLTCC_SIZEOF_QAF, qaf); + +static inline int is_bit_set(const char *bits, int n) { + return bits[n / 8] & (1 << (7 - (n % 8))); +} + +static inline void clear_bit(char *bits, int n) { + bits[n / 8] &= ~(1 << (7 - (n % 8))); +} + +#define DFLTCC_FACILITY 151 + +static inline int is_dfltcc_enabled(void) { + uint64_t facilities[(DFLTCC_FACILITY / 64) + 1]; + Z_REGISTER uint8_t r0 __asm__("r0"); + + memset(facilities, 0, sizeof(facilities)); + r0 = sizeof(facilities) / sizeof(facilities[0]) - 1; + /* STFLE is supported since z9-109 and only in z/Architecture mode. When + * compiling with -m31, gcc defaults to ESA mode, however, since the kernel + * is 64-bit, it's always z/Architecture mode at runtime. + */ + __asm__ volatile( +#ifndef __clang__ + ".machinemode push\n" + ".machinemode zarch\n" +#endif + "stfle %[facilities]\n" +#ifndef __clang__ + ".machinemode pop\n" +#endif + : [facilities] "=Q" (facilities), [r0] "+r" (r0) :: "cc"); + return is_bit_set((const char *)facilities, DFLTCC_FACILITY); +} + +#define DFLTCC_FMT0 0 + +#define CVT_CRC32 0 +#define CVT_ADLER32 1 +#define HTT_FIXED 0 +#define HTT_DYNAMIC 1 + +#define DFLTCC_SIZEOF_GDHT_V0 384 +#define DFLTCC_SIZEOF_CMPR_XPND_V0 1536 +static_assert(offsetof(struct dfltcc_param_v0, csb) == DFLTCC_SIZEOF_GDHT_V0, gdht_v0); +static_assert(sizeof(struct dfltcc_param_v0) == DFLTCC_SIZEOF_CMPR_XPND_V0, cmpr_xpnd_v0); + +static inline z_const char *oesc_msg(char *buf, int oesc) { + if (oesc == 0x00) + return NULL; /* Successful completion */ + else { + sprintf(buf, "Operation-Ending-Supplemental Code is 0x%.2X", oesc); + return buf; + } +} + +/* + C wrapper for the DEFLATE CONVERSION CALL instruction. + */ +typedef enum { + DFLTCC_CC_OK = 0, + DFLTCC_CC_OP1_TOO_SHORT = 1, + DFLTCC_CC_OP2_TOO_SHORT = 2, + DFLTCC_CC_OP2_CORRUPT = 2, + DFLTCC_CC_AGAIN = 3, +} dfltcc_cc; + +#define DFLTCC_QAF 0 +#define DFLTCC_GDHT 1 +#define DFLTCC_CMPR 2 +#define DFLTCC_XPND 4 +#define HBT_CIRCULAR (1 << 7) +#define DFLTCC_FN_MASK ((1 << 7) - 1) + +/* Return lengths of high (starting at param->ho) and low (starting at 0) fragments of the circular history buffer. */ +static inline void get_history_lengths(struct dfltcc_param_v0 *param, size_t *hl_high, size_t *hl_low) { + *hl_high = MIN(param->hl, HB_SIZE - param->ho); + *hl_low = param->hl - *hl_high; +} + +/* Notify instrumentation about an upcoming read/write access to the circular history buffer. */ +static inline void instrument_read_write_hist(struct dfltcc_param_v0 *param, void *hist) { + size_t hl_high, hl_low; + + get_history_lengths(param, &hl_high, &hl_low); + instrument_read_write(hist + param->ho, hl_high); + instrument_read_write(hist, hl_low); +} + +/* Notify MSan about a completed write to the circular history buffer. */ +static inline void msan_unpoison_hist(struct dfltcc_param_v0 *param, void *hist) { + size_t hl_high, hl_low; + + get_history_lengths(param, &hl_high, &hl_low); + __msan_unpoison(hist + param->ho, hl_high); + __msan_unpoison(hist, hl_low); +} + +static inline dfltcc_cc dfltcc(int fn, void *param, + unsigned char **op1, size_t *len1, + z_const unsigned char **op2, size_t *len2, void *hist) { + unsigned char *t2 = op1 ? *op1 : NULL; + unsigned char *orig_t2 = t2; + size_t t3 = len1 ? *len1 : 0; + z_const unsigned char *t4 = op2 ? *op2 : NULL; + size_t t5 = len2 ? *len2 : 0; + Z_REGISTER int r0 __asm__("r0"); + Z_REGISTER void *r1 __asm__("r1"); + Z_REGISTER unsigned char *r2 __asm__("r2"); + Z_REGISTER size_t r3 __asm__("r3"); + Z_REGISTER z_const unsigned char *r4 __asm__("r4"); + Z_REGISTER size_t r5 __asm__("r5"); + int cc; + + /* Insert pre-instrumentation for DFLTCC. */ + switch (fn & DFLTCC_FN_MASK) { + case DFLTCC_QAF: + instrument_write(param, DFLTCC_SIZEOF_QAF); + break; + case DFLTCC_GDHT: + instrument_read_write(param, DFLTCC_SIZEOF_GDHT_V0); + instrument_read(t4, t5); + break; + case DFLTCC_CMPR: + case DFLTCC_XPND: + instrument_read_write(param, DFLTCC_SIZEOF_CMPR_XPND_V0); + instrument_read(t4, t5); + instrument_write(t2, t3); + instrument_read_write_hist(param, hist); + break; + } + + r0 = fn; r1 = param; r2 = t2; r3 = t3; r4 = t4; r5 = t5; + __asm__ volatile( +#ifdef HAVE_SYS_SDT_H + STAP_PROBE_ASM(zlib, dfltcc_entry, STAP_PROBE_ASM_TEMPLATE(5)) +#endif + ".insn rrf,0xb9390000,%[r2],%[r4],%[hist],0\n" +#ifdef HAVE_SYS_SDT_H + STAP_PROBE_ASM(zlib, dfltcc_exit, STAP_PROBE_ASM_TEMPLATE(5)) +#endif + "ipm %[cc]\n" + : [r2] "+r" (r2) + , [r3] "+r" (r3) + , [r4] "+r" (r4) + , [r5] "+r" (r5) + , [cc] "=r" (cc) + : [r0] "r" (r0) + , [r1] "r" (r1) + , [hist] "r" (hist) +#ifdef HAVE_SYS_SDT_H + , STAP_PROBE_ASM_OPERANDS(5, r2, r3, r4, r5, hist) +#endif + : "cc", "memory"); + t2 = r2; t3 = r3; t4 = r4; t5 = r5; + + /* Insert post-instrumentation for DFLTCC. */ + switch (fn & DFLTCC_FN_MASK) { + case DFLTCC_QAF: + __msan_unpoison(param, DFLTCC_SIZEOF_QAF); + break; + case DFLTCC_GDHT: + __msan_unpoison(param, DFLTCC_SIZEOF_GDHT_V0); + break; + case DFLTCC_CMPR: + __msan_unpoison(param, DFLTCC_SIZEOF_CMPR_XPND_V0); + __msan_unpoison(orig_t2, t2 - orig_t2 + (((struct dfltcc_param_v0 *)param)->sbb == 0 ? 0 : 1)); + msan_unpoison_hist(param, hist); + break; + case DFLTCC_XPND: + __msan_unpoison(param, DFLTCC_SIZEOF_CMPR_XPND_V0); + __msan_unpoison(orig_t2, t2 - orig_t2); + msan_unpoison_hist(param, hist); + break; + } + + if (op1) + *op1 = t2; + if (len1) + *len1 = t3; + if (op2) + *op2 = t4; + if (len2) + *len2 = t5; + return (cc >> 28) & 3; +} + +#define ALIGN_UP(p, size) (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1)) + +static inline void dfltcc_reset_state(struct dfltcc_state *dfltcc_state) { + /* Initialize available functions */ + if (is_dfltcc_enabled()) { + dfltcc(DFLTCC_QAF, &dfltcc_state->param, NULL, NULL, NULL, NULL, NULL); + memmove(&dfltcc_state->af, &dfltcc_state->param, sizeof(dfltcc_state->af)); + } else + memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af)); + + /* Initialize parameter block */ + memset(&dfltcc_state->param, 0, sizeof(dfltcc_state->param)); + dfltcc_state->param.nt = 1; + dfltcc_state->param.ribm = DFLTCC_RIBM; +} + +static inline void dfltcc_copy_state(void *dst, const void *src, uInt size, uInt extension_size) { + memcpy(dst, src, ALIGN_UP(size, 8) + extension_size); +} + +static inline void append_history(struct dfltcc_param_v0 *param, unsigned char *history, + const unsigned char *buf, uInt count) { + size_t offset; + size_t n; + + /* Do not use more than 32K */ + if (count > HB_SIZE) { + buf += count - HB_SIZE; + count = HB_SIZE; + } + offset = (param->ho + param->hl) % HB_SIZE; + if (offset + count <= HB_SIZE) + /* Circular history buffer does not wrap - copy one chunk */ + memcpy(history + offset, buf, count); + else { + /* Circular history buffer wraps - copy two chunks */ + n = HB_SIZE - offset; + memcpy(history + offset, buf, n); + memcpy(history, buf + n, count - n); + } + n = param->hl + count; + if (n <= HB_SIZE) + /* All history fits into buffer - no need to discard anything */ + param->hl = n; + else { + /* History does not fit into buffer - discard extra bytes */ + param->ho = (param->ho + (n - HB_SIZE)) % HB_SIZE; + param->hl = HB_SIZE; + } +} + +static inline void get_history(struct dfltcc_param_v0 *param, const unsigned char *history, + unsigned char *buf) { + size_t hl_high, hl_low; + + get_history_lengths(param, &hl_high, &hl_low); + memcpy(buf, history + param->ho, hl_high); + memcpy(buf + hl_high, history, hl_low); +} diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_inflate.c b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_inflate.c similarity index 54% rename from internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_inflate.c rename to internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_inflate.c index 801e547ef..cc3cb3978 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/s390/dfltcc_inflate.c +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_inflate.c @@ -20,13 +20,15 @@ #include "dfltcc_inflate.h" #include "dfltcc_detail.h" -int Z_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm) { +void Z_INTERNAL PREFIX(dfltcc_reset_inflate_state)(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - /* Unsupported compression settings */ - if (state->wbits != HB_BITS) - return 0; + dfltcc_reset_state(&state->arch.common); +} + +int Z_INTERNAL PREFIX(dfltcc_can_inflate)(PREFIX3(streamp) strm) { + struct inflate_state *state = (struct inflate_state *)strm->state; + struct dfltcc_state *dfltcc_state = &state->arch.common; /* Unsupported hardware */ return is_bit_set(dfltcc_state->af.fns, DFLTCC_XPND) && is_bit_set(dfltcc_state->af.fmts, DFLTCC_FMT0); @@ -34,7 +36,7 @@ int Z_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm) { static inline dfltcc_cc dfltcc_xpnd(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; size_t avail_in = strm->avail_in; size_t avail_out = strm->avail_out; dfltcc_cc cc; @@ -47,15 +49,15 @@ static inline dfltcc_cc dfltcc_xpnd(PREFIX3(streamp) strm) { return cc; } -dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret) { +dfltcc_inflate_action Z_INTERNAL PREFIX(dfltcc_inflate)(PREFIX3(streamp) strm, int flush, int *ret) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); + struct dfltcc_state *dfltcc_state = &state->arch.common; struct dfltcc_param_v0 *param = &dfltcc_state->param; dfltcc_cc cc; if (flush == Z_BLOCK || flush == Z_TREES) { /* DFLTCC does not support stopping on block boundaries */ - if (dfltcc_inflate_disable(strm)) { + if (PREFIX(dfltcc_inflate_disable)(strm)) { *ret = Z_STREAM_ERROR; return DFLTCC_INFLATE_BREAK; } else @@ -75,16 +77,13 @@ dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush if (strm->avail_in == 0 && !param->cf) return DFLTCC_INFLATE_BREAK; - if (inflate_ensure_window(state)) { - state->mode = MEM; - return DFLTCC_INFLATE_CONTINUE; - } + /* if window not in use yet, initialize */ + if (state->wsize == 0) + state->wsize = 1U << state->wbits; /* Translate stream to parameter block */ param->cvt = ((state->wrap & 4) && state->flags) ? CVT_CRC32 : CVT_ADLER32; param->sbb = state->bits; - param->hl = state->whave; /* Software and hardware history formats match */ - param->ho = (state->wnext - state->whave) & ((1 << HB_BITS) - 1); if (param->hl) param->nt = 0; /* Honor history for the first block */ if (state->wrap & 4) @@ -99,8 +98,6 @@ dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush strm->msg = oesc_msg(dfltcc_state->msg, param->oesc); state->last = cc == DFLTCC_CC_OK; state->bits = param->sbb; - state->whave = param->hl; - state->wnext = (param->ho + param->hl) & ((1 << HB_BITS) - 1); if (state->wrap & 4) strm->adler = state->check = state->flags ? ZSWAP32(param->cv) : param->cv; if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) { @@ -114,20 +111,43 @@ dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush DFLTCC_INFLATE_BREAK : DFLTCC_INFLATE_CONTINUE; } -int Z_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm) { +int Z_INTERNAL PREFIX(dfltcc_was_inflate_used)(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; - return !param->nt; + return !state->arch.common.param.nt; } -int Z_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm) { +/* + Rotates a circular buffer. + The implementation is based on https://cplusplus.com/reference/algorithm/rotate/ + */ +static void rotate(unsigned char *start, unsigned char *pivot, unsigned char *end) { + unsigned char *p = pivot; + unsigned char tmp; + + while (p != start) { + tmp = *start; + *start = *p; + *p = tmp; + + start++; + p++; + + if (p == end) + p = pivot; + else if (start == pivot) + pivot = p; + } +} + +int Z_INTERNAL PREFIX(dfltcc_inflate_disable)(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); + struct dfltcc_state *dfltcc_state = &state->arch.common; + struct dfltcc_param_v0 *param = &dfltcc_state->param; - if (!dfltcc_can_inflate(strm)) + if (!PREFIX(dfltcc_can_inflate)(strm)) return 0; - if (dfltcc_was_inflate_used(strm)) + if (PREFIX(dfltcc_was_inflate_used)(strm)) /* DFLTCC has already decompressed some data. Since there is not * enough information to resume decompression in software, the call * must fail. @@ -135,5 +155,37 @@ int Z_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm) { return 1; /* DFLTCC was not used yet - decompress in software */ memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af)); + /* Convert the window from the hardware to the software format */ + rotate(state->window, state->window + param->ho, state->window + HB_SIZE); + state->whave = state->wnext = MIN(param->hl, state->wsize); return 0; } + +/* + Preloading history. +*/ +int Z_INTERNAL PREFIX(dfltcc_inflate_set_dictionary)(PREFIX3(streamp) strm, + const unsigned char *dictionary, uInt dict_length) { + struct inflate_state *state = (struct inflate_state *)strm->state; + struct dfltcc_param_v0 *param = &state->arch.common.param; + + /* if window not in use yet, initialize */ + if (state->wsize == 0) + state->wsize = 1U << state->wbits; + + append_history(param, state->window, dictionary, dict_length); + state->havedict = 1; + return Z_OK; +} + +int Z_INTERNAL PREFIX(dfltcc_inflate_get_dictionary)(PREFIX3(streamp) strm, + unsigned char *dictionary, uInt *dict_length) { + struct inflate_state *state = (struct inflate_state *)strm->state; + struct dfltcc_param_v0 *param = &state->arch.common.param; + + if (dictionary && state->window) + get_history(param, state->window, dictionary); + if (dict_length) + *dict_length = param->hl; + return Z_OK; +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_inflate.h b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_inflate.h new file mode 100644 index 000000000..3623f8ed7 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/dfltcc_inflate.h @@ -0,0 +1,67 @@ +#ifndef DFLTCC_INFLATE_H +#define DFLTCC_INFLATE_H + +#include "dfltcc_common.h" + +void Z_INTERNAL PREFIX(dfltcc_reset_inflate_state)(PREFIX3(streamp) strm); +int Z_INTERNAL PREFIX(dfltcc_can_inflate)(PREFIX3(streamp) strm); +typedef enum { + DFLTCC_INFLATE_CONTINUE, + DFLTCC_INFLATE_BREAK, + DFLTCC_INFLATE_SOFTWARE, +} dfltcc_inflate_action; +dfltcc_inflate_action Z_INTERNAL PREFIX(dfltcc_inflate)(PREFIX3(streamp) strm, int flush, int *ret); +int Z_INTERNAL PREFIX(dfltcc_was_inflate_used)(PREFIX3(streamp) strm); +int Z_INTERNAL PREFIX(dfltcc_inflate_disable)(PREFIX3(streamp) strm); +int Z_INTERNAL PREFIX(dfltcc_inflate_set_dictionary)(PREFIX3(streamp) strm, + const unsigned char *dictionary, uInt dict_length); +int Z_INTERNAL PREFIX(dfltcc_inflate_get_dictionary)(PREFIX3(streamp) strm, + unsigned char *dictionary, uInt* dict_length); + +#define INFLATE_RESET_KEEP_HOOK PREFIX(dfltcc_reset_inflate_state) + +#define INFLATE_PRIME_HOOK(strm, bits, value) \ + do { if (PREFIX(dfltcc_inflate_disable)((strm))) return Z_STREAM_ERROR; } while (0) + +#define INFLATE_TYPEDO_HOOK(strm, flush) \ + if (PREFIX(dfltcc_can_inflate)((strm))) { \ + dfltcc_inflate_action action; \ +\ + RESTORE(); \ + action = PREFIX(dfltcc_inflate)((strm), (flush), &ret); \ + LOAD(); \ + if (action == DFLTCC_INFLATE_CONTINUE) \ + break; \ + else if (action == DFLTCC_INFLATE_BREAK) \ + goto inf_leave; \ + } + +#define INFLATE_NEED_CHECKSUM(strm) (!PREFIX(dfltcc_can_inflate)((strm))) + +#define INFLATE_NEED_UPDATEWINDOW(strm) (!PREFIX(dfltcc_can_inflate)((strm))) + +#define INFLATE_MARK_HOOK(strm) \ + do { \ + if (PREFIX(dfltcc_was_inflate_used)((strm))) return -(1L << 16); \ + } while (0) + +#define INFLATE_SYNC_POINT_HOOK(strm) \ + do { \ + if (PREFIX(dfltcc_was_inflate_used)((strm))) return Z_STREAM_ERROR; \ + } while (0) + +#define INFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \ + do { \ + if (PREFIX(dfltcc_can_inflate)((strm))) \ + return PREFIX(dfltcc_inflate_set_dictionary)((strm), (dict), (dict_len)); \ + } while (0) + +#define INFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) \ + do { \ + if (PREFIX(dfltcc_can_inflate)((strm))) \ + return PREFIX(dfltcc_inflate_get_dictionary)((strm), (dict), (dict_len)); \ + } while (0) + +#define INFLATE_ADJUST_WINDOW_SIZE(n) MAX(n, HB_SIZE) + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/s390_features.c b/internal-complibs/zlib-ng-2.2.2/arch/s390/s390_features.c new file mode 100644 index 000000000..1f90a926c --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/s390_features.c @@ -0,0 +1,14 @@ +#include "zbuild.h" +#include "s390_features.h" + +#ifdef HAVE_SYS_AUXV_H +# include +#endif + +#ifndef HWCAP_S390_VXRS +#define HWCAP_S390_VXRS (1 << 11) +#endif + +void Z_INTERNAL s390_check_features(struct s390_cpu_features *features) { + features->has_vx = getauxval(AT_HWCAP) & HWCAP_S390_VXRS; +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/s390_features.h b/internal-complibs/zlib-ng-2.2.2/arch/s390/s390_features.h new file mode 100644 index 000000000..fb2ac14b2 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/s390_features.h @@ -0,0 +1,14 @@ +/* s390_features.h -- check for s390 features. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef S390_FEATURES_H_ +#define S390_FEATURES_H_ + +struct s390_cpu_features { + int has_vx; +}; + +void Z_INTERNAL s390_check_features(struct s390_cpu_features *features); + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/s390_functions.h b/internal-complibs/zlib-ng-2.2.2/arch/s390/s390_functions.h new file mode 100644 index 000000000..e9c67978f --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/s390_functions.h @@ -0,0 +1,20 @@ +/* s390_functions.h -- s390 implementations for arch-specific functions. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef S390_FUNCTIONS_H_ +#define S390_FUNCTIONS_H_ + +#ifdef S390_CRC32_VX +uint32_t crc32_s390_vx(uint32_t crc, const uint8_t *buf, size_t len); +#endif + + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +# if defined(S390_CRC32_VX) && defined(__zarch__) && __ARCH__ >= 11 && defined(__VX__) +# undef native_crc32 +# define native_crc32 = crc32_s390_vx +# endif +#endif + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/actions-runner.Dockerfile b/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/actions-runner.Dockerfile new file mode 100644 index 000000000..cf5c3e727 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/actions-runner.Dockerfile @@ -0,0 +1,47 @@ +# Self-Hosted IBM Z Github Actions Runner. + +FROM almalinux:9 + +RUN dnf update -y -q && \ + dnf install -y -q --enablerepo=crb wget git which sudo jq \ + cmake make automake autoconf m4 libtool ninja-build python3-pip \ + gcc gcc-c++ clang llvm-toolset glibc-all-langpacks langpacks-en \ + glibc-static libstdc++-static libstdc++-devel libxslt-devel libxml2-devel + +RUN dnf install -y -q dotnet-sdk-6.0 && \ + echo "Using SDK - `dotnet --version`" + +COPY runner-s390x.patch /tmp/runner.patch +COPY runner-global.json /tmp/global.json + +RUN cd /tmp && \ + git clone -q https://github.com/actions/runner && \ + cd runner && \ + git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) -b build && \ + git apply /tmp/runner.patch && \ + cp -f /tmp/global.json src/global.json + + +RUN cd /tmp/runner/src && \ + ./dev.sh layout && \ + ./dev.sh package && \ + rm -rf /root/.dotnet /root/.nuget + +RUN useradd -c "Action Runner" -m actions-runner && \ + usermod -L actions-runner + +RUN tar -xf /tmp/runner/_package/*.tar.gz -C /home/actions-runner && \ + chown -R actions-runner:actions-runner /home/actions-runner + +#VOLUME /home/actions-runner + +RUN rm -rf /tmp/runner /var/cache/dnf/* /tmp/runner.patch /tmp/global.json && \ + dnf clean all + +USER actions-runner + +# Scripts. +COPY fs/ / +WORKDIR /home/actions-runner +ENTRYPOINT ["/usr/bin/entrypoint"] +CMD ["/usr/bin/actions-runner"] diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/actions-runner.service b/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/actions-runner.service new file mode 100644 index 000000000..b6c20b65e --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/actions-runner.service @@ -0,0 +1,18 @@ +[Unit] +Description=Podman container: Gaplib Github Actions Runner +Wants=network-online.target +After=network-online.target +StartLimitIntervalSec=1 +RequiresMountsFor=/run/user/1001/containers + +[Service] +Environment=PODMAN_SYSTEMD_UNIT=%n +Restart=always +TimeoutStopSec=61 +ExecStart=/usr/bin/podman start gaplib-actions-runner +ExecStop=/usr/bin/podman stop -t 1 gaplib-actions-runner +ExecStopPost=/usr/bin/podman stop -t 1 gaplib-actions-runner +Type=forking + +[Install] +WantedBy=default.target diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/fs/usr/bin/actions-runner b/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/fs/usr/bin/actions-runner similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/fs/usr/bin/actions-runner rename to internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/fs/usr/bin/actions-runner diff --git a/internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/fs/usr/bin/entrypoint b/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/fs/usr/bin/entrypoint similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/arch/s390/self-hosted-builder/fs/usr/bin/entrypoint rename to internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/fs/usr/bin/entrypoint diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/runner-global.json b/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/runner-global.json new file mode 100644 index 000000000..e7028fe0d --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/runner-global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "6.0.421" + } +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/runner-s390x.patch b/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/runner-s390x.patch new file mode 100644 index 000000000..8260f3ccd --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/s390/self-hosted-builder/runner-s390x.patch @@ -0,0 +1,243 @@ +diff --git a/src/Directory.Build.props b/src/Directory.Build.props +index 9db5fac..f02e235 100644 +--- a/src/Directory.Build.props ++++ b/src/Directory.Build.props +@@ -44,6 +44,9 @@ + + $(DefineConstants);ARM64 + ++ ++ $(DefineConstants);S390X ++ + + + +diff --git a/src/Misc/externals.sh b/src/Misc/externals.sh +index 383221e..1555f67 100755 +--- a/src/Misc/externals.sh ++++ b/src/Misc/externals.sh +@@ -189,3 +189,8 @@ if [[ "$PACKAGERUNTIME" == "linux-arm" ]]; then + acquireExternalTool "$NODE_URL/v${NODE16_VERSION}/node-v${NODE16_VERSION}-linux-armv7l.tar.gz" node16 fix_nested_dir + acquireExternalTool "$NODE_URL/v${NODE20_VERSION}/node-v${NODE20_VERSION}-linux-armv7l.tar.gz" node20 fix_nested_dir + fi ++ ++if [[ "$PACKAGERUNTIME" == "linux-s390x" ]]; then ++ acquireExternalTool "$NODE_URL/v${NODE16_VERSION}/node-v${NODE16_VERSION}-linux-s390x.tar.gz" node16 fix_nested_dir ++ acquireExternalTool "$NODE_URL/v${NODE20_VERSION}/node-v${NODE20_VERSION}-linux-s390x.tar.gz" node20 fix_nested_dir ++fi +diff --git a/src/Misc/layoutroot/config.sh b/src/Misc/layoutroot/config.sh +index 14cc6ba..9b5b8e6 100755 +--- a/src/Misc/layoutroot/config.sh ++++ b/src/Misc/layoutroot/config.sh +@@ -20,25 +20,29 @@ then + + message="Execute sudo ./bin/installdependencies.sh to install any missing Dotnet Core 6.0 dependencies." + +- ldd ./bin/libcoreclr.so | grep 'not found' +- if [ $? -eq 0 ]; then +- echo "Dependencies is missing for Dotnet Core 6.0" +- echo $message +- exit 1 +- fi ++ ARCH=`uname -m` ++ if [ "${ARCH}" != "s390x" -a "${ARCH}" != "ppc64le" ] ++ then ++ ldd ./bin/libcoreclr.so | grep 'not found' ++ if [ $? -eq 0 ]; then ++ echo "Dependencies is missing for Dotnet Core 6.0" ++ echo $message ++ exit 1 ++ fi + +- ldd ./bin/libSystem.Security.Cryptography.Native.OpenSsl.so | grep 'not found' +- if [ $? -eq 0 ]; then +- echo "Dependencies is missing for Dotnet Core 6.0" +- echo $message +- exit 1 +- fi ++ ldd ./bin/libSystem.Security.Cryptography.Native.OpenSsl.so | grep 'not found' ++ if [ $? -eq 0 ]; then ++ echo "Dependencies is missing for Dotnet Core 6.0" ++ echo $message ++ exit 1 ++ fi + +- ldd ./bin/libSystem.IO.Compression.Native.so | grep 'not found' +- if [ $? -eq 0 ]; then +- echo "Dependencies is missing for Dotnet Core 6.0" +- echo $message +- exit 1 ++ ldd ./bin/libSystem.IO.Compression.Native.so | grep 'not found' ++ if [ $? -eq 0 ]; then ++ echo "Dependencies is missing for Dotnet Core 6.0" ++ echo $message ++ exit 1 ++ fi + fi + + if ! [ -x "$(command -v ldconfig)" ]; then +diff --git a/src/Runner.Common/Constants.cs b/src/Runner.Common/Constants.cs +index 177e3c9..9545981 100644 +--- a/src/Runner.Common/Constants.cs ++++ b/src/Runner.Common/Constants.cs +@@ -58,7 +58,8 @@ namespace GitHub.Runner.Common + X86, + X64, + Arm, +- Arm64 ++ Arm64, ++ S390x + } + + public static class Runner +@@ -81,6 +82,8 @@ namespace GitHub.Runner.Common + public static readonly Architecture PlatformArchitecture = Architecture.Arm; + #elif ARM64 + public static readonly Architecture PlatformArchitecture = Architecture.Arm64; ++#elif S390X ++ public static readonly Architecture PlatformArchitecture = Architecture.S390x; + #else + public static readonly Architecture PlatformArchitecture = Architecture.X64; + #endif +diff --git a/src/Runner.Common/Util/VarUtil.cs b/src/Runner.Common/Util/VarUtil.cs +index 97273a1..2a34430 100644 +--- a/src/Runner.Common/Util/VarUtil.cs ++++ b/src/Runner.Common/Util/VarUtil.cs +@@ -53,6 +53,8 @@ namespace GitHub.Runner.Common.Util + return "ARM"; + case Constants.Architecture.Arm64: + return "ARM64"; ++ case Constants.Architecture.S390x: ++ return "S390X"; + default: + throw new NotSupportedException(); // Should never reach here. + } +diff --git a/src/Test/L0/ConstantGenerationL0.cs b/src/Test/L0/ConstantGenerationL0.cs +index 2042485..a9d8b46 100644 +--- a/src/Test/L0/ConstantGenerationL0.cs ++++ b/src/Test/L0/ConstantGenerationL0.cs +@@ -20,6 +20,7 @@ namespace GitHub.Runner.Common.Tests + "linux-x64", + "linux-arm", + "linux-arm64", ++ "linux-s390x", + "osx-x64", + "osx-arm64" + }; +diff --git a/src/Test/L0/Listener/SelfUpdaterL0.cs b/src/Test/L0/Listener/SelfUpdaterL0.cs +index 26ba65e..6791df3 100644 +--- a/src/Test/L0/Listener/SelfUpdaterL0.cs ++++ b/src/Test/L0/Listener/SelfUpdaterL0.cs +@@ -1,4 +1,4 @@ +-#if !(OS_WINDOWS && ARM64) ++#if !(OS_WINDOWS && ARM64) && !S390X + using System; + using System.Collections.Generic; + using System.IO; +@@ -16,6 +16,7 @@ using Xunit; + + namespace GitHub.Runner.Common.Tests.Listener + { ++#if !S390X // Self-update is not currently supported on S390X + public sealed class SelfUpdaterL0 + { + private Mock _runnerServer; +@@ -291,5 +292,6 @@ namespace GitHub.Runner.Common.Tests.Listener + } + } + } ++#endif + } + #endif +diff --git a/src/Test/L0/Listener/SelfUpdaterV2L0.cs b/src/Test/L0/Listener/SelfUpdaterV2L0.cs +index 5115a6b..dd8d198 100644 +--- a/src/Test/L0/Listener/SelfUpdaterV2L0.cs ++++ b/src/Test/L0/Listener/SelfUpdaterV2L0.cs +@@ -1,4 +1,4 @@ +-#if !(OS_WINDOWS && ARM64) ++#if !(OS_WINDOWS && ARM64) && !S390X + using System; + using System.Collections.Generic; + using System.IO; +diff --git a/src/Test/L0/Worker/StepHostL0.cs b/src/Test/L0/Worker/StepHostL0.cs +index f6b5889..26f8e21 100644 +--- a/src/Test/L0/Worker/StepHostL0.cs ++++ b/src/Test/L0/Worker/StepHostL0.cs +@@ -31,7 +31,7 @@ namespace GitHub.Runner.Common.Tests.Worker + return hc; + } + +-#if OS_LINUX ++#if OS_LINUX && !S390X + [Fact] + [Trait("Level", "L0")] + [Trait("Category", "Worker")] +diff --git a/src/dev.sh b/src/dev.sh +index fa637d1..8c66f37 100755 +--- a/src/dev.sh ++++ b/src/dev.sh +@@ -54,6 +54,7 @@ elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then + case $CPU_NAME in + armv7l) RUNTIME_ID="linux-arm";; + aarch64) RUNTIME_ID="linux-arm64";; ++ s390x) RUNTIME_ID="linux-s390x";; + esac + fi + elif [[ "$CURRENT_PLATFORM" == 'darwin' ]]; then +@@ -80,7 +81,7 @@ if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then + exit 1 + fi + elif [[ "$CURRENT_PLATFORM" == 'linux' ]]; then +- if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'linux-arm') ]]; then ++ if [[ ("$RUNTIME_ID" != 'linux-x64') && ("$RUNTIME_ID" != 'linux-x86') && ("$RUNTIME_ID" != 'linux-arm64') && ("$RUNTIME_ID" != 'linux-arm') && ("$RUNTIME_ID" != 'linux-s390x') ]]; then + echo "Failed: Can't build $RUNTIME_ID package $CURRENT_PLATFORM" >&2 + exit 1 + fi +@@ -199,7 +200,8 @@ function package () + popd > /dev/null + } + +-if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}") || (! -e "${DOTNETSDK_INSTALLDIR}/dotnet") ]]; then ++if [[ "${RUNTIME_ID}" != "linux-s390x" && ((! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}") || (! -e "${DOTNETSDK_INSTALLDIR}/dotnet")) ]]; then ++ + + # Download dotnet SDK to ../_dotnetsdk directory + heading "Ensure Dotnet SDK" +@@ -224,8 +226,10 @@ if [[ (! -d "${DOTNETSDK_INSTALLDIR}") || (! -e "${DOTNETSDK_INSTALLDIR}/.${DOTN + echo "${DOTNETSDK_VERSION}" > "${DOTNETSDK_INSTALLDIR}/.${DOTNETSDK_VERSION}" + fi + +-echo "Prepend ${DOTNETSDK_INSTALLDIR} to %PATH%" +-export PATH=${DOTNETSDK_INSTALLDIR}:$PATH ++if [[ -d "${DOTNETSDK_INSTALLDIR}" ]]; then ++ echo "Prepend ${DOTNETSDK_INSTALLDIR} to %PATH%" ++ export PATH=${DOTNETSDK_INSTALLDIR}:$PATH ++fi + + heading "Dotnet SDK Version" + dotnet --version +diff --git a/src/dir.proj b/src/dir.proj +index 056a312..8370922 100644 +--- a/src/dir.proj ++++ b/src/dir.proj +@@ -41,8 +41,18 @@ + + + +- +- ++ ++ ++ RuntimeIdentifier=$(PackageRuntime) ++ ++ SelfContained=false;CopyLocalRuntimeTargetAssets=false ++ ++ ++ ++ + + + diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/Makefile.in b/internal-complibs/zlib-ng-2.2.2/arch/x86/Makefile.in new file mode 100644 index 000000000..c13cd179c --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/Makefile.in @@ -0,0 +1,140 @@ +# Makefile for zlib +# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler +# For conditions of distribution and use, see copyright notice in zlib.h + +CC= +CFLAGS= +SFLAGS= +INCLUDES= +SUFFIX= + +AVX512FLAG=-mavx512f -mavx512dq -mavx512vl -mavx512bw +AVX512VNNIFLAG=-mavx512vnni +AVX2FLAG=-mavx2 +SSE2FLAG=-msse2 +SSSE3FLAG=-mssse3 +SSE42FLAG=-msse4.2 +PCLMULFLAG=-mpclmul +VPCLMULFLAG=-mvpclmulqdq +XSAVEFLAG=-mxsave +NOLTOFLAG= + +SRCDIR=. +SRCTOP=../.. +TOPDIR=$(SRCTOP) + +all: \ + x86_features.o x86_features.lo \ + adler32_avx2.o adler32_avx2.lo \ + adler32_avx512.o adler32_avx512.lo \ + adler32_avx512_vnni.o adler32_avx512_vnni.lo \ + adler32_sse42.o adler32_sse42.lo \ + adler32_ssse3.o adler32_ssse3.lo \ + chunkset_avx2.o chunkset_avx2.lo \ + chunkset_sse2.o chunkset_sse2.lo \ + chunkset_ssse3.o chunkset_ssse3.lo \ + compare256_avx2.o compare256_avx2.lo \ + compare256_sse2.o compare256_sse2.lo \ + crc32_pclmulqdq.o crc32_pclmulqdq.lo \ + crc32_vpclmulqdq.o crc32_vpclmulqdq.lo \ + slide_hash_avx2.o slide_hash_avx2.lo \ + slide_hash_sse2.o slide_hash_sse2.lo + +x86_features.o: + $(CC) $(CFLAGS) $(XSAVEFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/x86_features.c + +x86_features.lo: + $(CC) $(SFLAGS) $(XSAVEFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/x86_features.c + +chunkset_avx2.o: + $(CC) $(CFLAGS) $(AVX2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_avx2.c + +chunkset_avx2.lo: + $(CC) $(SFLAGS) $(AVX2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_avx2.c + +chunkset_sse2.o: + $(CC) $(CFLAGS) $(SSE2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_sse2.c + +chunkset_sse2.lo: + $(CC) $(SFLAGS) $(SSE2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_sse2.c + +chunkset_ssse3.o: + $(CC) $(CFLAGS) $(SSSE3FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_ssse3.c + +chunkset_ssse3.lo: + $(CC) $(SFLAGS) $(SSSE3FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_ssse3.c + +compare256_avx2.o: + $(CC) $(CFLAGS) $(AVX2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_avx2.c + +compare256_avx2.lo: + $(CC) $(SFLAGS) $(AVX2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_avx2.c + +compare256_sse2.o: + $(CC) $(CFLAGS) $(SSE2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_sse2.c + +compare256_sse2.lo: + $(CC) $(SFLAGS) $(SSE2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_sse2.c + +crc32_pclmulqdq.o: + $(CC) $(CFLAGS) $(PCLMULFLAG) $(SSE42FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_pclmulqdq.c + +crc32_pclmulqdq.lo: + $(CC) $(SFLAGS) $(PCLMULFLAG) $(SSE42FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_pclmulqdq.c + +crc32_vpclmulqdq.o: + $(CC) $(CFLAGS) $(PCLMULFLAG) $(VPCLMULFLAG) $(AVX512FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_vpclmulqdq.c + +crc32_vpclmulqdq.lo: + $(CC) $(SFLAGS) $(PCLMULFLAG) $(VPCLMULFLAG) $(AVX512FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_vpclmulqdq.c + +slide_hash_avx2.o: + $(CC) $(CFLAGS) $(AVX2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_avx2.c + +slide_hash_avx2.lo: + $(CC) $(SFLAGS) $(AVX2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_avx2.c + +slide_hash_sse2.o: + $(CC) $(CFLAGS) $(SSE2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_sse2.c + +slide_hash_sse2.lo: + $(CC) $(SFLAGS) $(SSE2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_sse2.c + +adler32_avx2.o: $(SRCDIR)/adler32_avx2.c + $(CC) $(CFLAGS) $(AVX2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_avx2.c + +adler32_avx2.lo: $(SRCDIR)/adler32_avx2.c + $(CC) $(SFLAGS) $(AVX2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_avx2.c + +adler32_avx512.o: $(SRCDIR)/adler32_avx512.c + $(CC) $(CFLAGS) $(AVX512FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_avx512.c + +adler32_avx512.lo: $(SRCDIR)/adler32_avx512.c + $(CC) $(SFLAGS) $(AVX512FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_avx512.c + +adler32_avx512_vnni.o: $(SRCDIR)/adler32_avx512_vnni.c + $(CC) $(CFLAGS) $(AVX512VNNIFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_avx512_vnni.c + +adler32_avx512_vnni.lo: $(SRCDIR)/adler32_avx512_vnni.c + $(CC) $(SFLAGS) $(AVX512VNNIFLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_avx512_vnni.c + +adler32_ssse3.o: $(SRCDIR)/adler32_ssse3.c + $(CC) $(CFLAGS) $(SSSE3FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_ssse3.c + +adler32_ssse3.lo: $(SRCDIR)/adler32_ssse3.c + $(CC) $(SFLAGS) $(SSSE3FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_ssse3.c + +adler32_sse42.o: $(SRCDIR)/adler32_sse42.c + $(CC) $(CFLAGS) $(SSE42FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_sse42.c + +adler32_sse42.lo: $(SRCDIR)/adler32_sse42.c + $(CC) $(SFLAGS) $(SSE42FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_sse42.c + +mostlyclean: clean +clean: + rm -f *.o *.lo *~ + rm -rf objs + rm -f *.gcda *.gcno *.gcov + +distclean: clean + rm -f Makefile diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx2.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx2.c new file mode 100644 index 000000000..38e7f068e --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx2.c @@ -0,0 +1,145 @@ +/* adler32_avx2.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2011 Mark Adler + * Copyright (C) 2022 Adam Stylinski + * Authors: + * Brian Bockelman + * Adam Stylinski + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef X86_AVX2 + +#include "zbuild.h" +#include +#include "adler32_p.h" +#include "adler32_avx2_p.h" +#include "x86_intrins.h" + +extern uint32_t adler32_fold_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +extern uint32_t adler32_ssse3(uint32_t adler, const uint8_t *src, size_t len); + +static inline uint32_t adler32_fold_copy_impl(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len, const int COPY) { + if (src == NULL) return 1L; + if (len == 0) return adler; + + uint32_t adler0, adler1; + adler1 = (adler >> 16) & 0xffff; + adler0 = adler & 0xffff; + +rem_peel: + if (len < 16) { + if (COPY) { + return adler32_copy_len_16(adler0, src, dst, len, adler1); + } else { + return adler32_len_16(adler0, src, len, adler1); + } + } else if (len < 32) { + if (COPY) { + return adler32_fold_copy_sse42(adler, dst, src, len); + } else { + return adler32_ssse3(adler, src, len); + } + } + + __m256i vs1, vs2; + + const __m256i dot2v = _mm256_setr_epi8(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, + 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1); + const __m256i dot3v = _mm256_set1_epi16(1); + const __m256i zero = _mm256_setzero_si256(); + + while (len >= 32) { + vs1 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler0)); + vs2 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler1)); + __m256i vs1_0 = vs1; + __m256i vs3 = _mm256_setzero_si256(); + + size_t k = MIN(len, NMAX); + k -= k % 32; + len -= k; + + while (k >= 32) { + /* + vs1 = adler + sum(c[i]) + vs2 = sum2 + 32 vs1 + sum( (32-i+1) c[i] ) + */ + __m256i vbuf = _mm256_loadu_si256((__m256i*)src); + src += 32; + k -= 32; + + __m256i vs1_sad = _mm256_sad_epu8(vbuf, zero); // Sum of abs diff, resulting in 2 x int32's + + if (COPY) { + _mm256_storeu_si256((__m256i*)dst, vbuf); + dst += 32; + } + + vs1 = _mm256_add_epi32(vs1, vs1_sad); + vs3 = _mm256_add_epi32(vs3, vs1_0); + __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v); // sum 32 uint8s to 16 shorts + __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); // sum 16 shorts to 8 uint32s + vs2 = _mm256_add_epi32(vsum2, vs2); + vs1_0 = vs1; + } + + /* Defer the multiplication with 32 to outside of the loop */ + vs3 = _mm256_slli_epi32(vs3, 5); + vs2 = _mm256_add_epi32(vs2, vs3); + + /* The compiler is generating the following sequence for this integer modulus + * when done the scalar way, in GPRs: + + adler = (s1_unpack[0] % BASE) + (s1_unpack[1] % BASE) + (s1_unpack[2] % BASE) + (s1_unpack[3] % BASE) + + (s1_unpack[4] % BASE) + (s1_unpack[5] % BASE) + (s1_unpack[6] % BASE) + (s1_unpack[7] % BASE); + + mov $0x80078071,%edi // move magic constant into 32 bit register %edi + ... + vmovd %xmm1,%esi // move vector lane 0 to 32 bit register %esi + mov %rsi,%rax // zero-extend this value to 64 bit precision in %rax + imul %rdi,%rsi // do a signed multiplication with magic constant and vector element + shr $0x2f,%rsi // shift right by 47 + imul $0xfff1,%esi,%esi // do a signed multiplication with value truncated to 32 bits with 0xfff1 + sub %esi,%eax // subtract lower 32 bits of original vector value from modified one above + ... + // repeats for each element with vpextract instructions + + This is tricky with AVX2 for a number of reasons: + 1.) There's no 64 bit multiplication instruction, but there is a sequence to get there + 2.) There's ways to extend vectors to 64 bit precision, but no simple way to truncate + back down to 32 bit precision later (there is in AVX512) + 3.) Full width integer multiplications aren't cheap + + We can, however, do a relatively cheap sequence for horizontal sums. + Then, we simply do the integer modulus on the resulting 64 bit GPR, on a scalar value. It was + previously thought that casting to 64 bit precision was needed prior to the horizontal sum, but + that is simply not the case, as NMAX is defined as the maximum number of scalar sums that can be + performed on the maximum possible inputs before overflow + */ + + + /* In AVX2-land, this trip through GPRs will probably be unavoidable, as there's no cheap and easy + * conversion from 64 bit integer to 32 bit (needed for the inexpensive modulus with a constant). + * This casting to 32 bit is cheap through GPRs (just register aliasing). See above for exactly + * what the compiler is doing to avoid integer divisions. */ + adler0 = partial_hsum256(vs1) % BASE; + adler1 = hsum256(vs2) % BASE; + } + + adler = adler0 | (adler1 << 16); + + if (len) { + goto rem_peel; + } + + return adler; +} + +Z_INTERNAL uint32_t adler32_avx2(uint32_t adler, const uint8_t *src, size_t len) { + return adler32_fold_copy_impl(adler, NULL, src, len, 0); +} + +Z_INTERNAL uint32_t adler32_fold_copy_avx2(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) { + return adler32_fold_copy_impl(adler, dst, src, len, 1); +} + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx2_p.h b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx2_p.h new file mode 100644 index 000000000..f0f8a4a88 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx2_p.h @@ -0,0 +1,32 @@ +/* adler32_avx2_p.h -- adler32 avx2 utility functions + * Copyright (C) 2022 Adam Stylinski + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef ADLER32_AVX2_P_H_ +#define ADLER32_AVX2_P_H_ + +#if defined(X86_AVX2) || defined(X86_AVX512VNNI) + +/* 32 bit horizontal sum, adapted from Agner Fog's vector library. */ +static inline uint32_t hsum256(__m256i x) { + __m128i sum1 = _mm_add_epi32(_mm256_extracti128_si256(x, 1), + _mm256_castsi256_si128(x)); + __m128i sum2 = _mm_add_epi32(sum1, _mm_unpackhi_epi64(sum1, sum1)); + __m128i sum3 = _mm_add_epi32(sum2, _mm_shuffle_epi32(sum2, 1)); + return (uint32_t)_mm_cvtsi128_si32(sum3); +} + +static inline uint32_t partial_hsum256(__m256i x) { + /* We need a permutation vector to extract every other integer. The + * rest are going to be zeros */ + const __m256i perm_vec = _mm256_setr_epi32(0, 2, 4, 6, 1, 1, 1, 1); + __m256i non_zero = _mm256_permutevar8x32_epi32(x, perm_vec); + __m128i non_zero_sse = _mm256_castsi256_si128(non_zero); + __m128i sum2 = _mm_add_epi32(non_zero_sse,_mm_unpackhi_epi64(non_zero_sse, non_zero_sse)); + __m128i sum3 = _mm_add_epi32(sum2, _mm_shuffle_epi32(sum2, 1)); + return (uint32_t)_mm_cvtsi128_si32(sum3); +} +#endif + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512.c new file mode 100644 index 000000000..626c4807f --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512.c @@ -0,0 +1,108 @@ +/* adler32_avx512.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2011 Mark Adler + * Authors: + * Adam Stylinski + * Brian Bockelman + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef X86_AVX512 + +#include "zbuild.h" +#include "adler32_p.h" +#include "arch_functions.h" +#include +#include "x86_intrins.h" +#include "adler32_avx512_p.h" + +static inline uint32_t adler32_fold_copy_impl(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len, const int COPY) { + if (src == NULL) return 1L; + if (len == 0) return adler; + + uint32_t adler0, adler1; + adler1 = (adler >> 16) & 0xffff; + adler0 = adler & 0xffff; + +rem_peel: + if (len < 64) { + /* This handles the remaining copies, just call normal adler checksum after this */ + if (COPY) { + __mmask64 storemask = (0xFFFFFFFFFFFFFFFFUL >> (64 - len)); + __m512i copy_vec = _mm512_maskz_loadu_epi8(storemask, src); + _mm512_mask_storeu_epi8(dst, storemask, copy_vec); + } + + return adler32_avx2(adler, src, len); + } + + __m512i vbuf, vs1_0, vs3; + + const __m512i dot2v = _mm512_set_epi8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64); + const __m512i dot3v = _mm512_set1_epi16(1); + const __m512i zero = _mm512_setzero_si512(); + size_t k; + + while (len >= 64) { + __m512i vs1 = _mm512_zextsi128_si512(_mm_cvtsi32_si128(adler0)); + __m512i vs2 = _mm512_zextsi128_si512(_mm_cvtsi32_si128(adler1)); + vs1_0 = vs1; + vs3 = _mm512_setzero_si512(); + + k = MIN(len, NMAX); + k -= k % 64; + len -= k; + + while (k >= 64) { + /* + vs1 = adler + sum(c[i]) + vs2 = sum2 + 64 vs1 + sum( (64-i+1) c[i] ) + */ + vbuf = _mm512_loadu_si512(src); + + if (COPY) { + _mm512_storeu_si512(dst, vbuf); + dst += 64; + } + + src += 64; + k -= 64; + + __m512i vs1_sad = _mm512_sad_epu8(vbuf, zero); + __m512i v_short_sum2 = _mm512_maddubs_epi16(vbuf, dot2v); + vs1 = _mm512_add_epi32(vs1_sad, vs1); + vs3 = _mm512_add_epi32(vs3, vs1_0); + __m512i vsum2 = _mm512_madd_epi16(v_short_sum2, dot3v); + vs2 = _mm512_add_epi32(vsum2, vs2); + vs1_0 = vs1; + } + + vs3 = _mm512_slli_epi32(vs3, 6); + vs2 = _mm512_add_epi32(vs2, vs3); + + adler0 = partial_hsum(vs1) % BASE; + adler1 = _mm512_reduce_add_epu32(vs2) % BASE; + } + + adler = adler0 | (adler1 << 16); + + /* Process tail (len < 64). */ + if (len) { + goto rem_peel; + } + + return adler; +} + +Z_INTERNAL uint32_t adler32_fold_copy_avx512(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) { + return adler32_fold_copy_impl(adler, dst, src, len, 1); +} + +Z_INTERNAL uint32_t adler32_avx512(uint32_t adler, const uint8_t *src, size_t len) { + return adler32_fold_copy_impl(adler, NULL, src, len, 0); +} + +#endif + diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512_p.h b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512_p.h new file mode 100644 index 000000000..742269053 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512_p.h @@ -0,0 +1,57 @@ +#ifndef AVX512_FUNCS_H +#define AVX512_FUNCS_H + +#include +#include + +/* Written because Visual C++ toolchains before v142 have constant overflow in AVX512 intrinsic macros */ +#if defined(_MSC_VER) && !defined(_MM_K0_REG8) +# undef _mm512_extracti64x4_epi64 +# define _mm512_extracti64x4_epi64(v1, e1) _mm512_maskz_extracti64x4_epi64(UINT8_MAX, v1, e1) +# undef _mm512_set1_epi16 +# define _mm512_set1_epi16(e1) _mm512_maskz_set1_epi16(UINT32_MAX, e1) +# undef _mm512_maddubs_epi16 +# define _mm512_maddubs_epi16(v1, v2) _mm512_maskz_maddubs_epi16(UINT32_MAX, v1, v2) +#endif + +/* Written because *_add_epi32(a) sets off ubsan */ +static inline uint32_t _mm512_reduce_add_epu32(__m512i x) { + __m256i a = _mm512_extracti64x4_epi64(x, 1); + __m256i b = _mm512_extracti64x4_epi64(x, 0); + + __m256i a_plus_b = _mm256_add_epi32(a, b); + __m128i c = _mm256_extracti128_si256(a_plus_b, 1); + __m128i d = _mm256_extracti128_si256(a_plus_b, 0); + __m128i c_plus_d = _mm_add_epi32(c, d); + + __m128i sum1 = _mm_unpackhi_epi64(c_plus_d, c_plus_d); + __m128i sum2 = _mm_add_epi32(sum1, c_plus_d); + __m128i sum3 = _mm_shuffle_epi32(sum2, 0x01); + __m128i sum4 = _mm_add_epi32(sum2, sum3); + + return _mm_cvtsi128_si32(sum4); +} + +static inline uint32_t partial_hsum(__m512i x) { + /* We need a permutation vector to extract every other integer. The + * rest are going to be zeros. Marking this const so the compiler stands + * a better chance of keeping this resident in a register through entire + * loop execution. We certainly have enough zmm registers (32) */ + const __m512i perm_vec = _mm512_setr_epi32(0, 2, 4, 6, 8, 10, 12, 14, + 1, 1, 1, 1, 1, 1, 1, 1); + + __m512i non_zero = _mm512_permutexvar_epi32(perm_vec, x); + + /* From here, it's a simple 256 bit wide reduction sum */ + __m256i non_zero_avx = _mm512_castsi512_si256(non_zero); + + /* See Agner Fog's vectorclass for a decent reference. Essentially, phadd is + * pretty slow, much slower than the longer instruction sequence below */ + __m128i sum1 = _mm_add_epi32(_mm256_extracti128_si256(non_zero_avx, 1), + _mm256_castsi256_si128(non_zero_avx)); + __m128i sum2 = _mm_add_epi32(sum1,_mm_unpackhi_epi64(sum1, sum1)); + __m128i sum3 = _mm_add_epi32(sum2,_mm_shuffle_epi32(sum2, 1)); + return (uint32_t)_mm_cvtsi128_si32(sum3); +} + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512_vnni.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512_vnni.c new file mode 100644 index 000000000..4c5cfc1ca --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_avx512_vnni.c @@ -0,0 +1,210 @@ +/* adler32_avx512_vnni.c -- compute the Adler-32 checksum of a data stream + * Based on Brian Bockelman's AVX2 version + * Copyright (C) 1995-2011 Mark Adler + * Authors: + * Adam Stylinski + * Brian Bockelman + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef X86_AVX512VNNI + +#include "zbuild.h" +#include "adler32_p.h" +#include "arch_functions.h" +#include +#include "x86_intrins.h" +#include "adler32_avx512_p.h" +#include "adler32_avx2_p.h" + +Z_INTERNAL uint32_t adler32_avx512_vnni(uint32_t adler, const uint8_t *src, size_t len) { + if (src == NULL) return 1L; + if (len == 0) return adler; + + uint32_t adler0, adler1; + adler1 = (adler >> 16) & 0xffff; + adler0 = adler & 0xffff; + +rem_peel: + if (len < 32) + return adler32_ssse3(adler, src, len); + + if (len < 64) + return adler32_avx2(adler, src, len); + + const __m512i dot2v = _mm512_set_epi8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64); + + const __m512i zero = _mm512_setzero_si512(); + __m512i vs1, vs2; + + while (len >= 64) { + vs1 = _mm512_zextsi128_si512(_mm_cvtsi32_si128(adler0)); + vs2 = _mm512_zextsi128_si512(_mm_cvtsi32_si128(adler1)); + size_t k = MIN(len, NMAX); + k -= k % 64; + len -= k; + __m512i vs1_0 = vs1; + __m512i vs3 = _mm512_setzero_si512(); + /* We might get a tad bit more ILP here if we sum to a second register in the loop */ + __m512i vs2_1 = _mm512_setzero_si512(); + __m512i vbuf0, vbuf1; + + /* Remainder peeling */ + if (k % 128) { + vbuf1 = _mm512_loadu_si512((__m512i*)src); + + src += 64; + k -= 64; + + __m512i vs1_sad = _mm512_sad_epu8(vbuf1, zero); + vs1 = _mm512_add_epi32(vs1, vs1_sad); + vs3 = _mm512_add_epi32(vs3, vs1_0); + vs2 = _mm512_dpbusd_epi32(vs2, vbuf1, dot2v); + vs1_0 = vs1; + } + + /* Manually unrolled this loop by 2 for an decent amount of ILP */ + while (k >= 128) { + /* + vs1 = adler + sum(c[i]) + vs2 = sum2 + 64 vs1 + sum( (64-i+1) c[i] ) + */ + vbuf0 = _mm512_loadu_si512((__m512i*)src); + vbuf1 = _mm512_loadu_si512((__m512i*)(src + 64)); + src += 128; + k -= 128; + + __m512i vs1_sad = _mm512_sad_epu8(vbuf0, zero); + vs1 = _mm512_add_epi32(vs1, vs1_sad); + vs3 = _mm512_add_epi32(vs3, vs1_0); + /* multiply-add, resulting in 16 ints. Fuse with sum stage from prior versions, as we now have the dp + * instructions to eliminate them */ + vs2 = _mm512_dpbusd_epi32(vs2, vbuf0, dot2v); + + vs3 = _mm512_add_epi32(vs3, vs1); + vs1_sad = _mm512_sad_epu8(vbuf1, zero); + vs1 = _mm512_add_epi32(vs1, vs1_sad); + vs2_1 = _mm512_dpbusd_epi32(vs2_1, vbuf1, dot2v); + vs1_0 = vs1; + } + + vs3 = _mm512_slli_epi32(vs3, 6); + vs2 = _mm512_add_epi32(vs2, vs3); + vs2 = _mm512_add_epi32(vs2, vs2_1); + + adler0 = partial_hsum(vs1) % BASE; + adler1 = _mm512_reduce_add_epu32(vs2) % BASE; + } + + adler = adler0 | (adler1 << 16); + + /* Process tail (len < 64). */ + if (len) { + goto rem_peel; + } + + return adler; +} + +Z_INTERNAL uint32_t adler32_fold_copy_avx512_vnni(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) { + if (src == NULL) return 1L; + if (len == 0) return adler; + + uint32_t adler0, adler1; + adler1 = (adler >> 16) & 0xffff; + adler0 = adler & 0xffff; + +rem_peel_copy: + if (len < 32) { + /* This handles the remaining copies, just call normal adler checksum after this */ + __mmask32 storemask = (0xFFFFFFFFUL >> (32 - len)); + __m256i copy_vec = _mm256_maskz_loadu_epi8(storemask, src); + _mm256_mask_storeu_epi8(dst, storemask, copy_vec); + + return adler32_ssse3(adler, src, len); + } + + const __m256i dot2v = _mm256_set_epi8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + + const __m256i zero = _mm256_setzero_si256(); + __m256i vs1, vs2; + + while (len >= 32) { + vs1 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler0)); + vs2 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler1)); + size_t k = MIN(len, NMAX); + k -= k % 32; + len -= k; + __m256i vs1_0 = vs1; + __m256i vs3 = _mm256_setzero_si256(); + /* We might get a tad bit more ILP here if we sum to a second register in the loop */ + __m256i vs2_1 = _mm256_setzero_si256(); + __m256i vbuf0, vbuf1; + + /* Remainder peeling */ + if (k % 64) { + vbuf1 = _mm256_loadu_si256((__m256i*)src); + _mm256_storeu_si256((__m256i*)dst, vbuf1); + dst += 32; + + src += 32; + k -= 32; + + __m256i vs1_sad = _mm256_sad_epu8(vbuf1, zero); + vs1 = _mm256_add_epi32(vs1, vs1_sad); + vs3 = _mm256_add_epi32(vs3, vs1_0); + vs2 = _mm256_dpbusd_epi32(vs2, vbuf1, dot2v); + vs1_0 = vs1; + } + + /* Manually unrolled this loop by 2 for an decent amount of ILP */ + while (k >= 64) { + /* + vs1 = adler + sum(c[i]) + vs2 = sum2 + 64 vs1 + sum( (64-i+1) c[i] ) + */ + vbuf0 = _mm256_loadu_si256((__m256i*)src); + vbuf1 = _mm256_loadu_si256((__m256i*)(src + 32)); + _mm256_storeu_si256((__m256i*)dst, vbuf0); + _mm256_storeu_si256((__m256i*)(dst + 32), vbuf1); + dst += 64; + src += 64; + k -= 64; + + __m256i vs1_sad = _mm256_sad_epu8(vbuf0, zero); + vs1 = _mm256_add_epi32(vs1, vs1_sad); + vs3 = _mm256_add_epi32(vs3, vs1_0); + /* multiply-add, resulting in 16 ints. Fuse with sum stage from prior versions, as we now have the dp + * instructions to eliminate them */ + vs2 = _mm256_dpbusd_epi32(vs2, vbuf0, dot2v); + + vs3 = _mm256_add_epi32(vs3, vs1); + vs1_sad = _mm256_sad_epu8(vbuf1, zero); + vs1 = _mm256_add_epi32(vs1, vs1_sad); + vs2_1 = _mm256_dpbusd_epi32(vs2_1, vbuf1, dot2v); + vs1_0 = vs1; + } + + vs3 = _mm256_slli_epi32(vs3, 5); + vs2 = _mm256_add_epi32(vs2, vs3); + vs2 = _mm256_add_epi32(vs2, vs2_1); + + adler0 = partial_hsum256(vs1) % BASE; + adler1 = hsum256(vs2) % BASE; + } + + adler = adler0 | (adler1 << 16); + + /* Process tail (len < 64). */ + if (len) { + goto rem_peel_copy; + } + + return adler; +} + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_sse42.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_sse42.c new file mode 100644 index 000000000..df0739d16 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_sse42.c @@ -0,0 +1,120 @@ +/* adler32_sse42.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2011 Mark Adler + * Authors: + * Adam Stylinski + * Brian Bockelman + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "adler32_p.h" +#include "adler32_ssse3_p.h" +#include + +#ifdef X86_SSE42 + +Z_INTERNAL uint32_t adler32_fold_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) { + uint32_t adler0, adler1; + adler1 = (adler >> 16) & 0xffff; + adler0 = adler & 0xffff; + +rem_peel: + if (len < 16) { + return adler32_copy_len_16(adler0, src, dst, len, adler1); + } + + __m128i vbuf, vbuf_0; + __m128i vs1_0, vs3, vs1, vs2, vs2_0, v_sad_sum1, v_short_sum2, v_short_sum2_0, + v_sad_sum2, vsum2, vsum2_0; + __m128i zero = _mm_setzero_si128(); + const __m128i dot2v = _mm_setr_epi8(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17); + const __m128i dot2v_0 = _mm_setr_epi8(16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1); + const __m128i dot3v = _mm_set1_epi16(1); + size_t k; + + while (len >= 16) { + + k = MIN(len, NMAX); + k -= k % 16; + len -= k; + + vs1 = _mm_cvtsi32_si128(adler0); + vs2 = _mm_cvtsi32_si128(adler1); + + vs3 = _mm_setzero_si128(); + vs2_0 = _mm_setzero_si128(); + vs1_0 = vs1; + + while (k >= 32) { + /* + vs1 = adler + sum(c[i]) + vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] ) + */ + vbuf = _mm_loadu_si128((__m128i*)src); + vbuf_0 = _mm_loadu_si128((__m128i*)(src + 16)); + src += 32; + k -= 32; + + v_sad_sum1 = _mm_sad_epu8(vbuf, zero); + v_sad_sum2 = _mm_sad_epu8(vbuf_0, zero); + _mm_storeu_si128((__m128i*)dst, vbuf); + _mm_storeu_si128((__m128i*)(dst + 16), vbuf_0); + dst += 32; + + v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v); + v_short_sum2_0 = _mm_maddubs_epi16(vbuf_0, dot2v_0); + + vs1 = _mm_add_epi32(v_sad_sum1, vs1); + vs3 = _mm_add_epi32(vs1_0, vs3); + + vsum2 = _mm_madd_epi16(v_short_sum2, dot3v); + vsum2_0 = _mm_madd_epi16(v_short_sum2_0, dot3v); + vs1 = _mm_add_epi32(v_sad_sum2, vs1); + vs2 = _mm_add_epi32(vsum2, vs2); + vs2_0 = _mm_add_epi32(vsum2_0, vs2_0); + vs1_0 = vs1; + } + + vs2 = _mm_add_epi32(vs2_0, vs2); + vs3 = _mm_slli_epi32(vs3, 5); + vs2 = _mm_add_epi32(vs3, vs2); + vs3 = _mm_setzero_si128(); + + while (k >= 16) { + /* + vs1 = adler + sum(c[i]) + vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] ) + */ + vbuf = _mm_loadu_si128((__m128i*)src); + src += 16; + k -= 16; + + v_sad_sum1 = _mm_sad_epu8(vbuf, zero); + v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v_0); + + vs1 = _mm_add_epi32(v_sad_sum1, vs1); + vs3 = _mm_add_epi32(vs1_0, vs3); + vsum2 = _mm_madd_epi16(v_short_sum2, dot3v); + vs2 = _mm_add_epi32(vsum2, vs2); + vs1_0 = vs1; + + _mm_storeu_si128((__m128i*)dst, vbuf); + dst += 16; + } + + vs3 = _mm_slli_epi32(vs3, 4); + vs2 = _mm_add_epi32(vs2, vs3); + + adler0 = partial_hsum(vs1) % BASE; + adler1 = hsum(vs2) % BASE; + } + + /* If this is true, there's fewer than 16 elements remaining */ + if (len) { + goto rem_peel; + } + + return adler0 | (adler1 << 16); +} + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_ssse3.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_ssse3.c new file mode 100644 index 000000000..15e2f78ba --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_ssse3.c @@ -0,0 +1,156 @@ +/* adler32_ssse3.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2011 Mark Adler + * Authors: + * Adam Stylinski + * Brian Bockelman + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "adler32_p.h" +#include "adler32_ssse3_p.h" + +#ifdef X86_SSSE3 + +#include + +Z_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const uint8_t *buf, size_t len) { + uint32_t sum2; + + /* split Adler-32 into component sums */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (UNLIKELY(len == 1)) + return adler32_len_1(adler, buf, sum2); + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (UNLIKELY(buf == NULL)) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (UNLIKELY(len < 16)) + return adler32_len_16(adler, buf, len, sum2); + + const __m128i dot2v = _mm_setr_epi8(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17); + const __m128i dot2v_0 = _mm_setr_epi8(16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1); + const __m128i dot3v = _mm_set1_epi16(1); + const __m128i zero = _mm_setzero_si128(); + + __m128i vbuf, vs1_0, vs3, vs1, vs2, vs2_0, v_sad_sum1, v_short_sum2, v_short_sum2_0, + vbuf_0, v_sad_sum2, vsum2, vsum2_0; + + /* If our buffer is unaligned (likely), make the determination whether + * or not there's enough of a buffer to consume to make the scalar, aligning + * additions worthwhile or if it's worth it to just eat the cost of an unaligned + * load. This is a pretty simple test, just test if 16 - the remainder + len is + * < 16 */ + size_t max_iters = NMAX; + size_t rem = (uintptr_t)buf & 15; + size_t align_offset = 16 - rem; + size_t k = 0; + if (rem) { + if (len < 16 + align_offset) { + /* Let's eat the cost of this one unaligned load so that + * we don't completely skip over the vectorization. Doing + * 16 bytes at a time unaligned is better than 16 + <= 15 + * sums */ + vbuf = _mm_loadu_si128((__m128i*)buf); + len -= 16; + buf += 16; + vs1 = _mm_cvtsi32_si128(adler); + vs2 = _mm_cvtsi32_si128(sum2); + vs3 = _mm_setzero_si128(); + vs1_0 = vs1; + goto unaligned_jmp; + } + + for (size_t i = 0; i < align_offset; ++i) { + adler += *(buf++); + sum2 += adler; + } + + /* lop off the max number of sums based on the scalar sums done + * above */ + len -= align_offset; + max_iters -= align_offset; + } + + + while (len >= 16) { + vs1 = _mm_cvtsi32_si128(adler); + vs2 = _mm_cvtsi32_si128(sum2); + vs3 = _mm_setzero_si128(); + vs2_0 = _mm_setzero_si128(); + vs1_0 = vs1; + + k = (len < max_iters ? len : max_iters); + k -= k % 16; + len -= k; + + while (k >= 32) { + /* + vs1 = adler + sum(c[i]) + vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] ) + */ + vbuf = _mm_load_si128((__m128i*)buf); + vbuf_0 = _mm_load_si128((__m128i*)(buf + 16)); + buf += 32; + k -= 32; + + v_sad_sum1 = _mm_sad_epu8(vbuf, zero); + v_sad_sum2 = _mm_sad_epu8(vbuf_0, zero); + vs1 = _mm_add_epi32(v_sad_sum1, vs1); + vs3 = _mm_add_epi32(vs1_0, vs3); + + vs1 = _mm_add_epi32(v_sad_sum2, vs1); + v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v); + vsum2 = _mm_madd_epi16(v_short_sum2, dot3v); + v_short_sum2_0 = _mm_maddubs_epi16(vbuf_0, dot2v_0); + vs2 = _mm_add_epi32(vsum2, vs2); + vsum2_0 = _mm_madd_epi16(v_short_sum2_0, dot3v); + vs2_0 = _mm_add_epi32(vsum2_0, vs2_0); + vs1_0 = vs1; + } + + vs2 = _mm_add_epi32(vs2_0, vs2); + vs3 = _mm_slli_epi32(vs3, 5); + vs2 = _mm_add_epi32(vs3, vs2); + vs3 = _mm_setzero_si128(); + + while (k >= 16) { + /* + vs1 = adler + sum(c[i]) + vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] ) + */ + vbuf = _mm_load_si128((__m128i*)buf); + buf += 16; + k -= 16; + +unaligned_jmp: + v_sad_sum1 = _mm_sad_epu8(vbuf, zero); + vs1 = _mm_add_epi32(v_sad_sum1, vs1); + vs3 = _mm_add_epi32(vs1_0, vs3); + v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v_0); + vsum2 = _mm_madd_epi16(v_short_sum2, dot3v); + vs2 = _mm_add_epi32(vsum2, vs2); + vs1_0 = vs1; + } + + vs3 = _mm_slli_epi32(vs3, 4); + vs2 = _mm_add_epi32(vs2, vs3); + + /* We don't actually need to do a full horizontal sum, since psadbw is actually doing + * a partial reduction sum implicitly and only summing to integers in vector positions + * 0 and 2. This saves us some contention on the shuffle port(s) */ + adler = partial_hsum(vs1) % BASE; + sum2 = hsum(vs2) % BASE; + max_iters = NMAX; + } + + /* Process tail (len < 16). */ + return adler32_len_16(adler, buf, len, sum2); +} + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_ssse3_p.h b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_ssse3_p.h new file mode 100644 index 000000000..d7ec3fe0d --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/adler32_ssse3_p.h @@ -0,0 +1,29 @@ +/* adler32_ssse3_p.h -- adler32 ssse3 utility functions + * Copyright (C) 2022 Adam Stylinski + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef ADLER32_SSSE3_P_H_ +#define ADLER32_SSSE3_P_H_ + +#ifdef X86_SSSE3 + +#include +#include + +static inline uint32_t partial_hsum(__m128i x) { + __m128i second_int = _mm_srli_si128(x, 8); + __m128i sum = _mm_add_epi32(x, second_int); + return _mm_cvtsi128_si32(sum); +} + +static inline uint32_t hsum(__m128i x) { + __m128i sum1 = _mm_unpackhi_epi64(x, x); + __m128i sum2 = _mm_add_epi32(x, sum1); + __m128i sum3 = _mm_shuffle_epi32(sum2, 0x01); + __m128i sum4 = _mm_add_epi32(sum2, sum3); + return _mm_cvtsi128_si32(sum4); +} +#endif + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_avx2.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_avx2.c new file mode 100644 index 000000000..70620b915 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_avx2.c @@ -0,0 +1,133 @@ +/* chunkset_avx2.c -- AVX2 inline functions to copy small data chunks. + * For conditions of distribution and use, see copyright notice in zlib.h + */ +#include "zbuild.h" + +#ifdef X86_AVX2 +#include +#include "../generic/chunk_permute_table.h" + +typedef __m256i chunk_t; + +#define CHUNK_SIZE 32 + +#define HAVE_CHUNKMEMSET_2 +#define HAVE_CHUNKMEMSET_4 +#define HAVE_CHUNKMEMSET_8 +#define HAVE_CHUNK_MAG + +/* Populate don't cares so that this is a direct lookup (with some indirection into the permute table), because dist can + * never be 0 - 2, we'll start with an offset, subtracting 3 from the input */ +static const lut_rem_pair perm_idx_lut[29] = { + { 0, 2}, /* 3 */ + { 0, 0}, /* don't care */ + { 1 * 32, 2}, /* 5 */ + { 2 * 32, 2}, /* 6 */ + { 3 * 32, 4}, /* 7 */ + { 0 * 32, 0}, /* don't care */ + { 4 * 32, 5}, /* 9 */ + { 5 * 32, 22}, /* 10 */ + { 6 * 32, 21}, /* 11 */ + { 7 * 32, 20}, /* 12 */ + { 8 * 32, 6}, /* 13 */ + { 9 * 32, 4}, /* 14 */ + {10 * 32, 2}, /* 15 */ + { 0 * 32, 0}, /* don't care */ + {11 * 32, 15}, /* 17 */ + {11 * 32 + 16, 14}, /* 18 */ + {11 * 32 + 16 * 2, 13}, /* 19 */ + {11 * 32 + 16 * 3, 12}, /* 20 */ + {11 * 32 + 16 * 4, 11}, /* 21 */ + {11 * 32 + 16 * 5, 10}, /* 22 */ + {11 * 32 + 16 * 6, 9}, /* 23 */ + {11 * 32 + 16 * 7, 8}, /* 24 */ + {11 * 32 + 16 * 8, 7}, /* 25 */ + {11 * 32 + 16 * 9, 6}, /* 26 */ + {11 * 32 + 16 * 10, 5}, /* 27 */ + {11 * 32 + 16 * 11, 4}, /* 28 */ + {11 * 32 + 16 * 12, 3}, /* 29 */ + {11 * 32 + 16 * 13, 2}, /* 30 */ + {11 * 32 + 16 * 14, 1} /* 31 */ +}; + +static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { + int16_t tmp; + memcpy(&tmp, from, sizeof(tmp)); + *chunk = _mm256_set1_epi16(tmp); +} + +static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { + int32_t tmp; + memcpy(&tmp, from, sizeof(tmp)); + *chunk = _mm256_set1_epi32(tmp); +} + +static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { + int64_t tmp; + memcpy(&tmp, from, sizeof(tmp)); + *chunk = _mm256_set1_epi64x(tmp); +} + +static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { + *chunk = _mm256_loadu_si256((__m256i *)s); +} + +static inline void storechunk(uint8_t *out, chunk_t *chunk) { + _mm256_storeu_si256((__m256i *)out, *chunk); +} + +static inline chunk_t GET_CHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) { + lut_rem_pair lut_rem = perm_idx_lut[dist - 3]; + __m256i ret_vec; + /* While technically we only need to read 4 or 8 bytes into this vector register for a lot of cases, GCC is + * compiling this to a shared load for all branches, preferring the simpler code. Given that the buf value isn't in + * GPRs to begin with the 256 bit load is _probably_ just as inexpensive */ + *chunk_rem = lut_rem.remval; + + /* See note in chunkset_ssse3.c for why this is ok */ + __msan_unpoison(buf + dist, 32 - dist); + + if (dist < 16) { + /* This simpler case still requires us to shuffle in 128 bit lanes, so we must apply a static offset after + * broadcasting the first vector register to both halves. This is _marginally_ faster than doing two separate + * shuffles and combining the halves later */ + const __m256i permute_xform = + _mm256_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16); + __m256i perm_vec = _mm256_load_si256((__m256i*)(permute_table+lut_rem.idx)); + __m128i ret_vec0 = _mm_loadu_si128((__m128i*)buf); + perm_vec = _mm256_add_epi8(perm_vec, permute_xform); + ret_vec = _mm256_inserti128_si256(_mm256_castsi128_si256(ret_vec0), ret_vec0, 1); + ret_vec = _mm256_shuffle_epi8(ret_vec, perm_vec); + } else if (dist == 16) { + __m128i ret_vec0 = _mm_loadu_si128((__m128i*)buf); + return _mm256_inserti128_si256(_mm256_castsi128_si256(ret_vec0), ret_vec0, 1); + } else { + __m128i ret_vec0 = _mm_loadu_si128((__m128i*)buf); + __m128i ret_vec1 = _mm_loadu_si128((__m128i*)(buf + 16)); + /* Take advantage of the fact that only the latter half of the 256 bit vector will actually differ */ + __m128i perm_vec1 = _mm_load_si128((__m128i*)(permute_table + lut_rem.idx)); + __m128i xlane_permutes = _mm_cmpgt_epi8(_mm_set1_epi8(16), perm_vec1); + __m128i xlane_res = _mm_shuffle_epi8(ret_vec0, perm_vec1); + /* Since we can't wrap twice, we can simply keep the later half exactly how it is instead of having to _also_ + * shuffle those values */ + __m128i latter_half = _mm_blendv_epi8(ret_vec1, xlane_res, xlane_permutes); + ret_vec = _mm256_inserti128_si256(_mm256_castsi128_si256(ret_vec0), latter_half, 1); + } + + return ret_vec; +} + +#define CHUNKSIZE chunksize_avx2 +#define CHUNKCOPY chunkcopy_avx2 +#define CHUNKUNROLL chunkunroll_avx2 +#define CHUNKMEMSET chunkmemset_avx2 +#define CHUNKMEMSET_SAFE chunkmemset_safe_avx2 + +#include "chunkset_tpl.h" + +#define INFLATE_FAST inflate_fast_avx2 + +#include "inffast_tpl.h" + +#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/chunkset_sse.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_sse2.c similarity index 89% rename from internal-complibs/zlib-ng-2.0.7/arch/x86/chunkset_sse.c rename to internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_sse2.c index 6b43d4a85..c402c0ee1 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/chunkset_sse.c +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_sse2.c @@ -1,9 +1,8 @@ -/* chunkset_sse.c -- SSE inline functions to copy small data chunks. +/* chunkset_sse2.c -- SSE2 inline functions to copy small data chunks. * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zbuild.h" -#include "zutil.h" #ifdef X86_SSE2 #include @@ -44,11 +43,14 @@ static inline void storechunk(uint8_t *out, chunk_t *chunk) { #define CHUNKSIZE chunksize_sse2 #define CHUNKCOPY chunkcopy_sse2 -#define CHUNKCOPY_SAFE chunkcopy_safe_sse2 #define CHUNKUNROLL chunkunroll_sse2 #define CHUNKMEMSET chunkmemset_sse2 #define CHUNKMEMSET_SAFE chunkmemset_safe_sse2 #include "chunkset_tpl.h" +#define INFLATE_FAST inflate_fast_sse2 + +#include "inffast_tpl.h" + #endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_ssse3.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_ssse3.c new file mode 100644 index 000000000..722ecd3d5 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/chunkset_ssse3.c @@ -0,0 +1,93 @@ +/* chunkset_ssse3.c -- SSSE3 inline functions to copy small data chunks. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" + +#if defined(X86_SSSE3) +#include +#include "../generic/chunk_permute_table.h" + +typedef __m128i chunk_t; + +#define CHUNK_SIZE 16 + +#define HAVE_CHUNKMEMSET_2 +#define HAVE_CHUNKMEMSET_4 +#define HAVE_CHUNKMEMSET_8 +#define HAVE_CHUNK_MAG + +static const lut_rem_pair perm_idx_lut[13] = { + {0, 1}, /* 3 */ + {0, 0}, /* don't care */ + {1 * 32, 1}, /* 5 */ + {2 * 32, 4}, /* 6 */ + {3 * 32, 2}, /* 7 */ + {0 * 32, 0}, /* don't care */ + {4 * 32, 7}, /* 9 */ + {5 * 32, 6}, /* 10 */ + {6 * 32, 5}, /* 11 */ + {7 * 32, 4}, /* 12 */ + {8 * 32, 3}, /* 13 */ + {9 * 32, 2}, /* 14 */ + {10 * 32, 1},/* 15 */ +}; + + +static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { + int16_t tmp; + memcpy(&tmp, from, sizeof(tmp)); + *chunk = _mm_set1_epi16(tmp); +} + +static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { + int32_t tmp; + memcpy(&tmp, from, sizeof(tmp)); + *chunk = _mm_set1_epi32(tmp); +} + +static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { + int64_t tmp; + memcpy(&tmp, from, sizeof(tmp)); + *chunk = _mm_set1_epi64x(tmp); +} + +static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { + *chunk = _mm_loadu_si128((__m128i *)s); +} + +static inline void storechunk(uint8_t *out, chunk_t *chunk) { + _mm_storeu_si128((__m128i *)out, *chunk); +} + +static inline chunk_t GET_CHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) { + lut_rem_pair lut_rem = perm_idx_lut[dist - 3]; + __m128i perm_vec, ret_vec; + /* Important to note: + * This is _not_ to subvert the memory sanitizer but to instead unpoison some + * bytes we willingly and purposefully load uninitialized that we swizzle over + * in a vector register, anyway. If what we assume is wrong about what is used, + * the memory sanitizer will still usefully flag it */ + __msan_unpoison(buf + dist, 16 - dist); + ret_vec = _mm_loadu_si128((__m128i*)buf); + *chunk_rem = lut_rem.remval; + + perm_vec = _mm_load_si128((__m128i*)(permute_table + lut_rem.idx)); + ret_vec = _mm_shuffle_epi8(ret_vec, perm_vec); + + return ret_vec; +} + +#define CHUNKSIZE chunksize_ssse3 +#define CHUNKMEMSET chunkmemset_ssse3 +#define CHUNKMEMSET_SAFE chunkmemset_safe_ssse3 +#define CHUNKCOPY chunkcopy_ssse3 +#define CHUNKUNROLL chunkunroll_ssse3 + +#include "chunkset_tpl.h" + +#define INFLATE_FAST inflate_fast_ssse3 + +#include "inffast_tpl.h" + +#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/compare258_avx.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/compare256_avx2.c similarity index 61% rename from internal-complibs/zlib-ng-2.0.7/arch/x86/compare258_avx.c rename to internal-complibs/zlib-ng-2.2.2/arch/x86/compare256_avx2.c index d9108fdeb..d2c835e4e 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/compare258_avx.c +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/compare256_avx2.c @@ -1,11 +1,11 @@ -/* compare258_avx.c -- AVX2 version of compare258 +/* compare256_avx2.c -- AVX2 version of compare256 * Copyright Mika T. Lindqvist * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "../../zbuild.h" -#include "../../zutil.h" - +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" #include "fallback_builtins.h" #if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) @@ -15,8 +15,7 @@ # include #endif -/* UNALIGNED_OK, AVX2 intrinsic comparison */ -static inline uint32_t compare256_unaligned_avx2_static(const unsigned char *src0, const unsigned char *src1) { +static inline uint32_t compare256_avx2_static(const uint8_t *src0, const uint8_t *src1) { uint32_t len = 0; do { @@ -47,20 +46,18 @@ static inline uint32_t compare256_unaligned_avx2_static(const unsigned char *src return 256; } -static inline uint32_t compare258_unaligned_avx2_static(const unsigned char *src0, const unsigned char *src1) { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return (*src0 == *src1); - - return compare256_unaligned_avx2_static(src0+2, src1+2) + 2; +Z_INTERNAL uint32_t compare256_avx2(const uint8_t *src0, const uint8_t *src1) { + return compare256_avx2_static(src0, src1); } -Z_INTERNAL uint32_t compare258_unaligned_avx2(const unsigned char *src0, const unsigned char *src1) { - return compare258_unaligned_avx2_static(src0, src1); -} +#define LONGEST_MATCH longest_match_avx2 +#define COMPARE256 compare256_avx2_static + +#include "match_tpl.h" -#define LONGEST_MATCH longest_match_unaligned_avx2 -#define COMPARE256 compare256_unaligned_avx2_static -#define COMPARE258 compare258_unaligned_avx2_static +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_avx2 +#define COMPARE256 compare256_avx2_static #include "match_tpl.h" diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/compare256_sse2.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/compare256_sse2.c new file mode 100644 index 000000000..216bb3a70 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/compare256_sse2.c @@ -0,0 +1,97 @@ +/* compare256_sse2.c -- SSE2 version of compare256 + * Copyright Adam Stylinski + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" +#include "fallback_builtins.h" + +#if defined(X86_SSE2) && defined(HAVE_BUILTIN_CTZ) + +#include + +static inline uint32_t compare256_sse2_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + int align_offset = ((uintptr_t)src0) & 15; + const uint8_t *end0 = src0 + 256; + const uint8_t *end1 = src1 + 256; + __m128i xmm_src0, xmm_src1, xmm_cmp; + + /* Do the first load unaligned, than all subsequent ones we have at least + * one aligned load. Sadly aligning both loads is probably unrealistic */ + xmm_src0 = _mm_loadu_si128((__m128i*)src0); + xmm_src1 = _mm_loadu_si128((__m128i*)src1); + xmm_cmp = _mm_cmpeq_epi8(xmm_src0, xmm_src1); + + unsigned mask = (unsigned)_mm_movemask_epi8(xmm_cmp); + + /* Compiler _may_ turn this branch into a ptest + movemask, + * since a lot of those uops are shared and fused */ + if (mask != 0xFFFF) { + uint32_t match_byte = (uint32_t)__builtin_ctz(~mask); + return len + match_byte; + } + + int align_adv = 16 - align_offset; + len += align_adv; + src0 += align_adv; + src1 += align_adv; + + /* Do a flooring division (should just be a shift right) */ + int num_iter = (256 - len) / 16; + + for (int i = 0; i < num_iter; ++i) { + xmm_src0 = _mm_load_si128((__m128i*)src0); + xmm_src1 = _mm_loadu_si128((__m128i*)src1); + xmm_cmp = _mm_cmpeq_epi8(xmm_src0, xmm_src1); + + mask = (unsigned)_mm_movemask_epi8(xmm_cmp); + + /* Compiler _may_ turn this branch into a ptest + movemask, + * since a lot of those uops are shared and fused */ + if (mask != 0xFFFF) { + uint32_t match_byte = (uint32_t)__builtin_ctz(~mask); + return len + match_byte; + } + + len += 16, src0 += 16, src1 += 16; + } + + if (align_offset) { + src0 = end0 - 16; + src1 = end1 - 16; + len = 256 - 16; + + xmm_src0 = _mm_loadu_si128((__m128i*)src0); + xmm_src1 = _mm_loadu_si128((__m128i*)src1); + xmm_cmp = _mm_cmpeq_epi8(xmm_src0, xmm_src1); + + mask = (unsigned)_mm_movemask_epi8(xmm_cmp); + + if (mask != 0xFFFF) { + uint32_t match_byte = (uint32_t)__builtin_ctz(~mask); + return len + match_byte; + } + } + + return 256; +} + +Z_INTERNAL uint32_t compare256_sse2(const uint8_t *src0, const uint8_t *src1) { + return compare256_sse2_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_sse2 +#define COMPARE256 compare256_sse2_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_sse2 +#define COMPARE256 compare256_sse2_static + +#include "match_tpl.h" + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_fold_pclmulqdq_tpl.h b/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_fold_pclmulqdq_tpl.h new file mode 100644 index 000000000..1ffe201dd --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_fold_pclmulqdq_tpl.h @@ -0,0 +1,199 @@ +/* + * Compute the CRC32 using a parallelized folding approach with the PCLMULQDQ + * instruction. + * + * A white paper describing this algorithm can be found at: + * doc/crc-pclmulqdq.pdf + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * Copyright (C) 2016 Marian Beermann (support for initial value) + * Authors: + * Wajdi Feghali + * Jim Guilford + * Vinodh Gopal + * Erdinc Ozturk + * Jim Kukunas + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef COPY +Z_INTERNAL void CRC32_FOLD_COPY(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len) { +#else +Z_INTERNAL void CRC32_FOLD(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc) { +#endif + unsigned long algn_diff; + __m128i xmm_t0, xmm_t1, xmm_t2, xmm_t3; + __m128i xmm_crc0, xmm_crc1, xmm_crc2, xmm_crc3; + __m128i xmm_crc_part = _mm_setzero_si128(); + char ALIGNED_(16) partial_buf[16] = { 0 }; +#ifndef COPY + __m128i xmm_initial = _mm_cvtsi32_si128(init_crc); + int32_t first = init_crc != 0; + + /* The CRC functions don't call this for input < 16, as a minimum of 16 bytes of input is needed + * for the aligning load that occurs. If there's an initial CRC, to carry it forward through + * the folded CRC there must be 16 - src % 16 + 16 bytes available, which by definition can be + * up to 15 bytes + one full vector load. */ + assert(len >= 16 || first == 0); +#endif + crc32_fold_load((__m128i *)crc->fold, &xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); + + if (len < 16) { + if (len == 0) + return; + + memcpy(partial_buf, src, len); + xmm_crc_part = _mm_load_si128((const __m128i *)partial_buf); +#ifdef COPY + memcpy(dst, partial_buf, len); +#endif + goto partial; + } + + algn_diff = ((uintptr_t)16 - ((uintptr_t)src & 0xF)) & 0xF; + if (algn_diff) { + xmm_crc_part = _mm_loadu_si128((__m128i *)src); +#ifdef COPY + _mm_storeu_si128((__m128i *)dst, xmm_crc_part); + dst += algn_diff; +#else + XOR_INITIAL128(xmm_crc_part); + + if (algn_diff < 4 && init_crc != 0) { + xmm_t0 = xmm_crc_part; + if (len >= 32) { + xmm_crc_part = _mm_loadu_si128((__m128i*)src + 1); + fold_1(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); + xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t0); + } else { + memcpy(partial_buf, src + 16, len - 16); + xmm_crc_part = _mm_load_si128((__m128i*)partial_buf); + fold_1(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); + xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t0); + src += 16; + len -= 16; +#ifdef COPY + dst -= algn_diff; +#endif + goto partial; + } + + src += 16; + len -= 16; + } +#endif + + partial_fold(algn_diff, &xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3, &xmm_crc_part); + + src += algn_diff; + len -= algn_diff; + } + +#ifdef X86_VPCLMULQDQ + if (len >= 256) { +#ifdef COPY + size_t n = fold_16_vpclmulqdq_copy(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3, dst, src, len); + dst += n; +#else + size_t n = fold_16_vpclmulqdq(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3, src, len, + xmm_initial, first); + first = 0; +#endif + len -= n; + src += n; + } +#endif + + while (len >= 64) { + len -= 64; + xmm_t0 = _mm_load_si128((__m128i *)src); + xmm_t1 = _mm_load_si128((__m128i *)src + 1); + xmm_t2 = _mm_load_si128((__m128i *)src + 2); + xmm_t3 = _mm_load_si128((__m128i *)src + 3); + src += 64; + + fold_4(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); +#ifdef COPY + _mm_storeu_si128((__m128i *)dst, xmm_t0); + _mm_storeu_si128((__m128i *)dst + 1, xmm_t1); + _mm_storeu_si128((__m128i *)dst + 2, xmm_t2); + _mm_storeu_si128((__m128i *)dst + 3, xmm_t3); + dst += 64; +#else + XOR_INITIAL128(xmm_t0); +#endif + + xmm_crc0 = _mm_xor_si128(xmm_crc0, xmm_t0); + xmm_crc1 = _mm_xor_si128(xmm_crc1, xmm_t1); + xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t2); + xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t3); + } + + /* + * len = num bytes left - 64 + */ + if (len >= 48) { + len -= 48; + + xmm_t0 = _mm_load_si128((__m128i *)src); + xmm_t1 = _mm_load_si128((__m128i *)src + 1); + xmm_t2 = _mm_load_si128((__m128i *)src + 2); + src += 48; +#ifdef COPY + _mm_storeu_si128((__m128i *)dst, xmm_t0); + _mm_storeu_si128((__m128i *)dst + 1, xmm_t1); + _mm_storeu_si128((__m128i *)dst + 2, xmm_t2); + dst += 48; +#else + XOR_INITIAL128(xmm_t0); +#endif + fold_3(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); + + xmm_crc1 = _mm_xor_si128(xmm_crc1, xmm_t0); + xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t1); + xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t2); + } else if (len >= 32) { + len -= 32; + + xmm_t0 = _mm_load_si128((__m128i *)src); + xmm_t1 = _mm_load_si128((__m128i *)src + 1); + src += 32; +#ifdef COPY + _mm_storeu_si128((__m128i *)dst, xmm_t0); + _mm_storeu_si128((__m128i *)dst + 1, xmm_t1); + dst += 32; +#else + XOR_INITIAL128(xmm_t0); +#endif + fold_2(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); + + xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t0); + xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t1); + } else if (len >= 16) { + len -= 16; + xmm_t0 = _mm_load_si128((__m128i *)src); + src += 16; +#ifdef COPY + _mm_storeu_si128((__m128i *)dst, xmm_t0); + dst += 16; +#else + XOR_INITIAL128(xmm_t0); +#endif + fold_1(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); + + xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t0); + } + +partial: + if (len) { + memcpy(&xmm_crc_part, src, len); +#ifdef COPY + _mm_storeu_si128((__m128i *)partial_buf, xmm_crc_part); + memcpy(dst, partial_buf, len); +#endif + partial_fold(len, &xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3, &xmm_crc_part); + } + + crc32_fold_save((__m128i *)crc->fold, &xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_fold_vpclmulqdq_tpl.h b/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_fold_vpclmulqdq_tpl.h new file mode 100644 index 000000000..3ea5c3305 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_fold_vpclmulqdq_tpl.h @@ -0,0 +1,107 @@ +/* crc32_fold_vpclmulqdq_tpl.h -- VPCMULQDQ-based CRC32 folding template. + * Copyright Wangyang Guo (wangyang.guo@intel.com) + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef COPY +static size_t fold_16_vpclmulqdq_copy(__m128i *xmm_crc0, __m128i *xmm_crc1, + __m128i *xmm_crc2, __m128i *xmm_crc3, uint8_t *dst, const uint8_t *src, size_t len) { +#else +static size_t fold_16_vpclmulqdq(__m128i *xmm_crc0, __m128i *xmm_crc1, + __m128i *xmm_crc2, __m128i *xmm_crc3, const uint8_t *src, size_t len, + __m128i init_crc, int32_t first) { + __m512i zmm_initial = _mm512_zextsi128_si512(init_crc); +#endif + __m512i zmm_t0, zmm_t1, zmm_t2, zmm_t3; + __m512i zmm_crc0, zmm_crc1, zmm_crc2, zmm_crc3; + __m512i z0, z1, z2, z3; + size_t len_tmp = len; + const __m512i zmm_fold4 = _mm512_set4_epi32( + 0x00000001, 0x54442bd4, 0x00000001, 0xc6e41596); + const __m512i zmm_fold16 = _mm512_set4_epi32( + 0x00000001, 0x1542778a, 0x00000001, 0x322d1430); + + // zmm register init + zmm_crc0 = _mm512_setzero_si512(); + zmm_t0 = _mm512_loadu_si512((__m512i *)src); +#ifndef COPY + XOR_INITIAL512(zmm_t0); +#endif + zmm_crc1 = _mm512_loadu_si512((__m512i *)src + 1); + zmm_crc2 = _mm512_loadu_si512((__m512i *)src + 2); + zmm_crc3 = _mm512_loadu_si512((__m512i *)src + 3); + + /* already have intermediate CRC in xmm registers + * fold4 with 4 xmm_crc to get zmm_crc0 + */ + zmm_crc0 = _mm512_inserti32x4(zmm_crc0, *xmm_crc0, 0); + zmm_crc0 = _mm512_inserti32x4(zmm_crc0, *xmm_crc1, 1); + zmm_crc0 = _mm512_inserti32x4(zmm_crc0, *xmm_crc2, 2); + zmm_crc0 = _mm512_inserti32x4(zmm_crc0, *xmm_crc3, 3); + z0 = _mm512_clmulepi64_epi128(zmm_crc0, zmm_fold4, 0x01); + zmm_crc0 = _mm512_clmulepi64_epi128(zmm_crc0, zmm_fold4, 0x10); + zmm_crc0 = _mm512_ternarylogic_epi32(zmm_crc0, z0, zmm_t0, 0x96); + +#ifdef COPY + _mm512_storeu_si512((__m512i *)dst, zmm_t0); + _mm512_storeu_si512((__m512i *)dst + 1, zmm_crc1); + _mm512_storeu_si512((__m512i *)dst + 2, zmm_crc2); + _mm512_storeu_si512((__m512i *)dst + 3, zmm_crc3); + dst += 256; +#endif + len -= 256; + src += 256; + + // fold-16 loops + while (len >= 256) { + zmm_t0 = _mm512_loadu_si512((__m512i *)src); + zmm_t1 = _mm512_loadu_si512((__m512i *)src + 1); + zmm_t2 = _mm512_loadu_si512((__m512i *)src + 2); + zmm_t3 = _mm512_loadu_si512((__m512i *)src + 3); + + z0 = _mm512_clmulepi64_epi128(zmm_crc0, zmm_fold16, 0x01); + z1 = _mm512_clmulepi64_epi128(zmm_crc1, zmm_fold16, 0x01); + z2 = _mm512_clmulepi64_epi128(zmm_crc2, zmm_fold16, 0x01); + z3 = _mm512_clmulepi64_epi128(zmm_crc3, zmm_fold16, 0x01); + + zmm_crc0 = _mm512_clmulepi64_epi128(zmm_crc0, zmm_fold16, 0x10); + zmm_crc1 = _mm512_clmulepi64_epi128(zmm_crc1, zmm_fold16, 0x10); + zmm_crc2 = _mm512_clmulepi64_epi128(zmm_crc2, zmm_fold16, 0x10); + zmm_crc3 = _mm512_clmulepi64_epi128(zmm_crc3, zmm_fold16, 0x10); + + zmm_crc0 = _mm512_ternarylogic_epi32(zmm_crc0, z0, zmm_t0, 0x96); + zmm_crc1 = _mm512_ternarylogic_epi32(zmm_crc1, z1, zmm_t1, 0x96); + zmm_crc2 = _mm512_ternarylogic_epi32(zmm_crc2, z2, zmm_t2, 0x96); + zmm_crc3 = _mm512_ternarylogic_epi32(zmm_crc3, z3, zmm_t3, 0x96); + +#ifdef COPY + _mm512_storeu_si512((__m512i *)dst, zmm_t0); + _mm512_storeu_si512((__m512i *)dst + 1, zmm_t1); + _mm512_storeu_si512((__m512i *)dst + 2, zmm_t2); + _mm512_storeu_si512((__m512i *)dst + 3, zmm_t3); + dst += 256; +#endif + len -= 256; + src += 256; + } + // zmm_crc[0,1,2,3] -> zmm_crc0 + z0 = _mm512_clmulepi64_epi128(zmm_crc0, zmm_fold4, 0x01); + zmm_crc0 = _mm512_clmulepi64_epi128(zmm_crc0, zmm_fold4, 0x10); + zmm_crc0 = _mm512_ternarylogic_epi32(zmm_crc0, z0, zmm_crc1, 0x96); + + z0 = _mm512_clmulepi64_epi128(zmm_crc0, zmm_fold4, 0x01); + zmm_crc0 = _mm512_clmulepi64_epi128(zmm_crc0, zmm_fold4, 0x10); + zmm_crc0 = _mm512_ternarylogic_epi32(zmm_crc0, z0, zmm_crc2, 0x96); + + z0 = _mm512_clmulepi64_epi128(zmm_crc0, zmm_fold4, 0x01); + zmm_crc0 = _mm512_clmulepi64_epi128(zmm_crc0, zmm_fold4, 0x10); + zmm_crc0 = _mm512_ternarylogic_epi32(zmm_crc0, z0, zmm_crc3, 0x96); + + // zmm_crc0 -> xmm_crc[0, 1, 2, 3] + *xmm_crc0 = _mm512_extracti32x4_epi32(zmm_crc0, 0); + *xmm_crc1 = _mm512_extracti32x4_epi32(zmm_crc0, 1); + *xmm_crc2 = _mm512_extracti32x4_epi32(zmm_crc0, 2); + *xmm_crc3 = _mm512_extracti32x4_epi32(zmm_crc0, 3); + + return (len_tmp - len); // return n bytes processed +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_pclmulqdq.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_pclmulqdq.c new file mode 100644 index 000000000..9383b7a2b --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_pclmulqdq.c @@ -0,0 +1,30 @@ +/* + * Compute the CRC32 using a parallelized folding approach with the PCLMULQDQ + * instruction. + * + * A white paper describing this algorithm can be found at: + * doc/crc-pclmulqdq.pdf + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * Copyright (C) 2016 Marian Beermann (support for initial value) + * Authors: + * Wajdi Feghali + * Jim Guilford + * Vinodh Gopal + * Erdinc Ozturk + * Jim Kukunas + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef X86_PCLMULQDQ_CRC + +#define CRC32_FOLD_COPY crc32_fold_pclmulqdq_copy +#define CRC32_FOLD crc32_fold_pclmulqdq +#define CRC32_FOLD_RESET crc32_fold_pclmulqdq_reset +#define CRC32_FOLD_FINAL crc32_fold_pclmulqdq_final +#define CRC32 crc32_pclmulqdq + +#include "crc32_pclmulqdq_tpl.h" + +#endif diff --git a/internal-complibs/zlib-ng-2.0.7/arch/x86/crc_folding.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_pclmulqdq_tpl.h similarity index 66% rename from internal-complibs/zlib-ng-2.0.7/arch/x86/crc_folding.c rename to internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_pclmulqdq_tpl.h index 4030db598..3a4f6af5a 100644 --- a/internal-complibs/zlib-ng-2.0.7/arch/x86/crc_folding.c +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_pclmulqdq_tpl.h @@ -3,9 +3,10 @@ * instruction. * * A white paper describing this algorithm can be found at: - * https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf + * doc/crc-pclmulqdq.pdf * * Copyright (C) 2013 Intel Corporation. All rights reserved. + * Copyright (C) 2016 Marian Beermann (support for initial value) * Authors: * Wajdi Feghali * Jim Guilford @@ -16,24 +17,28 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#ifdef X86_PCLMULQDQ_CRC +#include "zbuild.h" -#include "../../zbuild.h" -#include #include #include +#include // _mm_extract_epi32 +#ifdef X86_VPCLMULQDQ +# include +#endif -#include "crc_folding.h" - -Z_INTERNAL void crc_fold_init(deflate_state *const s) { - /* CRC_SAVE */ - _mm_storeu_si128((__m128i *)s->crc0 + 0, _mm_cvtsi32_si128(0x9db42487)); - _mm_storeu_si128((__m128i *)s->crc0 + 1, _mm_setzero_si128()); - _mm_storeu_si128((__m128i *)s->crc0 + 2, _mm_setzero_si128()); - _mm_storeu_si128((__m128i *)s->crc0 + 3, _mm_setzero_si128()); - - s->strm->adler = 0; -} +#include "crc32.h" +#include "crc32_braid_p.h" +#include "crc32_braid_tbl.h" +#include "x86_intrins.h" +#include + +#ifdef X86_VPCLMULQDQ +static size_t fold_16_vpclmulqdq(__m128i *xmm_crc0, __m128i *xmm_crc1, + __m128i *xmm_crc2, __m128i *xmm_crc3, const uint8_t *src, size_t len, __m128i init_crc, + int32_t first); +static size_t fold_16_vpclmulqdq_copy(__m128i *xmm_crc0, __m128i *xmm_crc1, + __m128i *xmm_crc2, __m128i *xmm_crc3, uint8_t *dst, const uint8_t *src, size_t len); +#endif static void fold_1(__m128i *xmm_crc0, __m128i *xmm_crc1, __m128i *xmm_crc2, __m128i *xmm_crc3) { const __m128i xmm_fold4 = _mm_set_epi32( 0x00000001, 0x54442bd4, @@ -183,7 +188,6 @@ static const unsigned ALIGNED_(32) pshufb_shf_table[60] = { static void partial_fold(const size_t len, __m128i *xmm_crc0, __m128i *xmm_crc1, __m128i *xmm_crc2, __m128i *xmm_crc3, __m128i *xmm_crc_part) { - const __m128i xmm_fold4 = _mm_set_epi32( 0x00000001, 0x54442bd4, 0x00000001, 0xc6e41596); const __m128i xmm_mask3 = _mm_set1_epi32((int32_t)0x80808080); @@ -192,7 +196,7 @@ static void partial_fold(const size_t len, __m128i *xmm_crc0, __m128i *xmm_crc1, __m128i xmm_a0_0, xmm_a0_1; __m128 ps_crc3, psa0_0, psa0_1, ps_res; - xmm_shl = _mm_load_si128((__m128i *)pshufb_shf_table + (len - 1)); + xmm_shl = _mm_load_si128((__m128i *)(pshufb_shf_table + (4 * (len - 1)))); xmm_shr = xmm_shl; xmm_shr = _mm_xor_si128(xmm_shr, xmm_mask3); @@ -227,146 +231,43 @@ static void partial_fold(const size_t len, __m128i *xmm_crc0, __m128i *xmm_crc1, *xmm_crc3 = _mm_castps_si128(ps_res); } -Z_INTERNAL void crc_fold_copy(deflate_state *const s, unsigned char *dst, const unsigned char *src, long len) { - unsigned long algn_diff; - __m128i xmm_t0, xmm_t1, xmm_t2, xmm_t3; - char ALIGNED_(16) partial_buf[16] = { 0 }; - - /* CRC_LOAD */ - __m128i xmm_crc0 = _mm_loadu_si128((__m128i *)s->crc0 + 0); - __m128i xmm_crc1 = _mm_loadu_si128((__m128i *)s->crc0 + 1); - __m128i xmm_crc2 = _mm_loadu_si128((__m128i *)s->crc0 + 2); - __m128i xmm_crc3 = _mm_loadu_si128((__m128i *)s->crc0 + 3); - __m128i xmm_crc_part; - - if (len < 16) { - if (len == 0) - return; - - memcpy(partial_buf, src, len); - xmm_crc_part = _mm_loadu_si128((const __m128i *)partial_buf); - memcpy(dst, partial_buf, len); - goto partial; - } - - algn_diff = ((uintptr_t)16 - ((uintptr_t)src & 0xF)) & 0xF; - if (algn_diff) { - xmm_crc_part = _mm_loadu_si128((__m128i *)src); - _mm_storeu_si128((__m128i *)dst, xmm_crc_part); - - dst += algn_diff; - src += algn_diff; - len -= algn_diff; - - partial_fold(algn_diff, &xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3, &xmm_crc_part); - } else { - xmm_crc_part = _mm_setzero_si128(); - } - - while ((len -= 64) >= 0) { - /* CRC_LOAD */ - xmm_t0 = _mm_load_si128((__m128i *)src); - xmm_t1 = _mm_load_si128((__m128i *)src + 1); - xmm_t2 = _mm_load_si128((__m128i *)src + 2); - xmm_t3 = _mm_load_si128((__m128i *)src + 3); - - fold_4(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); - - /* CRC_SAVE */ - _mm_storeu_si128((__m128i *)dst, xmm_t0); - _mm_storeu_si128((__m128i *)dst + 1, xmm_t1); - _mm_storeu_si128((__m128i *)dst + 2, xmm_t2); - _mm_storeu_si128((__m128i *)dst + 3, xmm_t3); - - xmm_crc0 = _mm_xor_si128(xmm_crc0, xmm_t0); - xmm_crc1 = _mm_xor_si128(xmm_crc1, xmm_t1); - xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t2); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t3); - - src += 64; - dst += 64; - } - - /* - * len = num bytes left - 64 - */ - if (len + 16 >= 0) { - len += 16; - - xmm_t0 = _mm_load_si128((__m128i *)src); - xmm_t1 = _mm_load_si128((__m128i *)src + 1); - xmm_t2 = _mm_load_si128((__m128i *)src + 2); - - fold_3(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); - - _mm_storeu_si128((__m128i *)dst, xmm_t0); - _mm_storeu_si128((__m128i *)dst + 1, xmm_t1); - _mm_storeu_si128((__m128i *)dst + 2, xmm_t2); - - xmm_crc1 = _mm_xor_si128(xmm_crc1, xmm_t0); - xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t1); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t2); - - if (len == 0) - goto done; - - dst += 48; - memcpy(&xmm_crc_part, (__m128i *)src + 3, len); - } else if (len + 32 >= 0) { - len += 32; - - xmm_t0 = _mm_load_si128((__m128i *)src); - xmm_t1 = _mm_load_si128((__m128i *)src + 1); - - fold_2(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); - - _mm_storeu_si128((__m128i *)dst, xmm_t0); - _mm_storeu_si128((__m128i *)dst + 1, xmm_t1); - - xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t0); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t1); - - if (len == 0) - goto done; - - dst += 32; - memcpy(&xmm_crc_part, (__m128i *)src + 2, len); - } else if (len + 48 >= 0) { - len += 48; - - xmm_t0 = _mm_load_si128((__m128i *)src); - - fold_1(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); - - _mm_storeu_si128((__m128i *)dst, xmm_t0); +static inline void crc32_fold_load(__m128i *fold, __m128i *fold0, __m128i *fold1, __m128i *fold2, __m128i *fold3) { + *fold0 = _mm_load_si128(fold + 0); + *fold1 = _mm_load_si128(fold + 1); + *fold2 = _mm_load_si128(fold + 2); + *fold3 = _mm_load_si128(fold + 3); +} - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t0); +static inline void crc32_fold_save(__m128i *fold, const __m128i *fold0, const __m128i *fold1, + const __m128i *fold2, const __m128i *fold3) { + _mm_storeu_si128(fold + 0, *fold0); + _mm_storeu_si128(fold + 1, *fold1); + _mm_storeu_si128(fold + 2, *fold2); + _mm_storeu_si128(fold + 3, *fold3); +} - if (len == 0) - goto done; +Z_INTERNAL uint32_t CRC32_FOLD_RESET(crc32_fold *crc) { + __m128i xmm_crc0 = _mm_cvtsi32_si128(0x9db42487); + __m128i xmm_zero = _mm_setzero_si128(); + crc32_fold_save((__m128i *)crc->fold, &xmm_crc0, &xmm_zero, &xmm_zero, &xmm_zero); + return 0; +} - dst += 16; - memcpy(&xmm_crc_part, (__m128i *)src + 1, len); - } else { - len += 64; - if (len == 0) - goto done; - memcpy(&xmm_crc_part, src, len); - } +#define ONCE(op) if (first) { first = 0; op; } +#define XOR_INITIAL128(where) ONCE(where = _mm_xor_si128(where, xmm_initial)) +#ifdef X86_VPCLMULQDQ +# define XOR_INITIAL512(where) ONCE(where = _mm512_xor_si512(where, zmm_initial)) +#endif - _mm_storeu_si128((__m128i *)partial_buf, xmm_crc_part); - memcpy(dst, partial_buf, len); - -partial: - partial_fold((size_t)len, &xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3, &xmm_crc_part); -done: - /* CRC_SAVE */ - _mm_storeu_si128((__m128i *)s->crc0 + 0, xmm_crc0); - _mm_storeu_si128((__m128i *)s->crc0 + 1, xmm_crc1); - _mm_storeu_si128((__m128i *)s->crc0 + 2, xmm_crc2); - _mm_storeu_si128((__m128i *)s->crc0 + 3, xmm_crc3); - _mm_storeu_si128((__m128i *)s->crc0 + 4, xmm_crc_part); -} +#ifdef X86_VPCLMULQDQ +# include "crc32_fold_vpclmulqdq_tpl.h" +#endif +#include "crc32_fold_pclmulqdq_tpl.h" +#define COPY +#ifdef X86_VPCLMULQDQ +# include "crc32_fold_vpclmulqdq_tpl.h" +#endif +#include "crc32_fold_pclmulqdq_tpl.h" static const unsigned ALIGNED_(16) crc_k[] = { 0xccaa009e, 0x00000000, /* rk1 */ @@ -385,18 +286,13 @@ static const unsigned ALIGNED_(16) crc_mask2[4] = { 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; -uint32_t Z_INTERNAL crc_fold_512to32(deflate_state *const s) { +Z_INTERNAL uint32_t CRC32_FOLD_FINAL(crc32_fold *crc) { const __m128i xmm_mask = _mm_load_si128((__m128i *)crc_mask); const __m128i xmm_mask2 = _mm_load_si128((__m128i *)crc_mask2); - - uint32_t crc; + __m128i xmm_crc0, xmm_crc1, xmm_crc2, xmm_crc3; __m128i x_tmp0, x_tmp1, x_tmp2, crc_fold; - /* CRC_LOAD */ - __m128i xmm_crc0 = _mm_loadu_si128((__m128i *)s->crc0 + 0); - __m128i xmm_crc1 = _mm_loadu_si128((__m128i *)s->crc0 + 1); - __m128i xmm_crc2 = _mm_loadu_si128((__m128i *)s->crc0 + 2); - __m128i xmm_crc3 = _mm_loadu_si128((__m128i *)s->crc0 + 3); + crc32_fold_load((__m128i *)crc->fold, &xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); /* * k1 @@ -421,7 +317,7 @@ uint32_t Z_INTERNAL crc_fold_512to32(deflate_state *const s) { /* * k5 */ - crc_fold = _mm_load_si128((__m128i *)crc_k + 1); + crc_fold = _mm_load_si128((__m128i *)(crc_k + 4)); xmm_crc0 = xmm_crc3; xmm_crc3 = _mm_clmulepi64_si128(xmm_crc3, crc_fold, 0); @@ -439,7 +335,7 @@ uint32_t Z_INTERNAL crc_fold_512to32(deflate_state *const s) { */ xmm_crc1 = xmm_crc3; xmm_crc2 = xmm_crc3; - crc_fold = _mm_load_si128((__m128i *)crc_k + 2); + crc_fold = _mm_load_si128((__m128i *)(crc_k + 8)); xmm_crc3 = _mm_clmulepi64_si128(xmm_crc3, crc_fold, 0); xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_crc2); @@ -450,8 +346,30 @@ uint32_t Z_INTERNAL crc_fold_512to32(deflate_state *const s) { xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_crc2); xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_crc1); - crc = (uint32_t)_mm_extract_epi32(xmm_crc3, 2); - return ~crc; + crc->value = ~((uint32_t)_mm_extract_epi32(xmm_crc3, 2)); + + return crc->value; } -#endif +static inline uint32_t crc32_small(uint32_t crc, const uint8_t *buf, size_t len) { + uint32_t c = (~crc) & 0xffffffff; + + while (len) { + len--; + DO1; + } + + return c ^ 0xffffffff; +} + +Z_INTERNAL uint32_t CRC32(uint32_t crc32, const uint8_t *buf, size_t len) { + /* For lens smaller than ~12, crc32_small method is faster. + * But there are also minimum requirements for the pclmul functions due to alignment */ + if (len < 16) + return crc32_small(crc32, buf, len); + + crc32_fold ALIGNED_(16) crc_state; + CRC32_FOLD_RESET(&crc_state); + CRC32_FOLD(&crc_state, buf, len, crc32); + return CRC32_FOLD_FINAL(&crc_state); +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_vpclmulqdq.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_vpclmulqdq.c new file mode 100644 index 000000000..cad35b14e --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/crc32_vpclmulqdq.c @@ -0,0 +1,17 @@ +/* crc32_vpclmulqdq.c -- VPCMULQDQ-based CRC32 folding implementation. + * Copyright Wangyang Guo (wangyang.guo@intel.com) + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef X86_VPCLMULQDQ_CRC + +#define X86_VPCLMULQDQ +#define CRC32_FOLD_COPY crc32_fold_vpclmulqdq_copy +#define CRC32_FOLD crc32_fold_vpclmulqdq +#define CRC32_FOLD_RESET crc32_fold_vpclmulqdq_reset +#define CRC32_FOLD_FINAL crc32_fold_vpclmulqdq_final +#define CRC32 crc32_vpclmulqdq + +#include "crc32_pclmulqdq_tpl.h" + +#endif diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/slide_hash_avx2.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/slide_hash_avx2.c new file mode 100644 index 000000000..853347323 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/slide_hash_avx2.c @@ -0,0 +1,40 @@ +/* + * AVX2 optimized hash slide, based on Intel's slide_sse implementation + * + * Copyright (C) 2017 Intel Corporation + * Authors: + * Arjan van de Ven + * Jim Kukunas + * Mika T. Lindqvist + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ +#include "zbuild.h" +#include "deflate.h" + +#include + +static inline void slide_hash_chain(Pos *table, uint32_t entries, const __m256i wsize) { + table += entries; + table -= 16; + + do { + __m256i value, result; + + value = _mm256_loadu_si256((__m256i *)table); + result = _mm256_subs_epu16(value, wsize); + _mm256_storeu_si256((__m256i *)table, result); + + table -= 16; + entries -= 16; + } while (entries > 0); +} + +Z_INTERNAL void slide_hash_avx2(deflate_state *s) { + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); + uint16_t wsize = (uint16_t)s->w_size; + const __m256i ymm_wsize = _mm256_set1_epi16((short)wsize); + + slide_hash_chain(s->head, HASH_SIZE, ymm_wsize); + slide_hash_chain(s->prev, wsize, ymm_wsize); +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/slide_hash_sse2.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/slide_hash_sse2.c new file mode 100644 index 000000000..6900a59d1 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/slide_hash_sse2.c @@ -0,0 +1,63 @@ +/* + * SSE optimized hash slide + * + * Copyright (C) 2017 Intel Corporation + * Authors: + * Arjan van de Ven + * Jim Kukunas + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ +#include "zbuild.h" +#include "deflate.h" + +#include +#include + +static inline void slide_hash_chain(Pos *table0, Pos *table1, uint32_t entries0, + uint32_t entries1, const __m128i wsize) { + uint32_t entries; + Pos *table; + __m128i value0, value1, result0, result1; + + int on_chain = 0; + +next_chain: + table = (on_chain) ? table1 : table0; + entries = (on_chain) ? entries1 : entries0; + + table += entries; + table -= 16; + + /* ZALLOC allocates this pointer unless the user chose a custom allocator. + * Our alloc function is aligned to 64 byte boundaries */ + do { + value0 = _mm_load_si128((__m128i *)table); + value1 = _mm_load_si128((__m128i *)(table + 8)); + result0 = _mm_subs_epu16(value0, wsize); + result1 = _mm_subs_epu16(value1, wsize); + _mm_store_si128((__m128i *)table, result0); + _mm_store_si128((__m128i *)(table + 8), result1); + + table -= 16; + entries -= 16; + } while (entries > 0); + + ++on_chain; + if (on_chain > 1) { + return; + } else { + goto next_chain; + } +} + +Z_INTERNAL void slide_hash_sse2(deflate_state *s) { + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); + uint16_t wsize = (uint16_t)s->w_size; + const __m128i xmm_wsize = _mm_set1_epi16((short)wsize); + + assert(((uintptr_t)s->head & 15) == 0); + assert(((uintptr_t)s->prev & 15) == 0); + + slide_hash_chain(s->head, s->prev, HASH_SIZE, wsize, xmm_wsize); +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_features.c b/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_features.c new file mode 100644 index 000000000..58cb4df34 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_features.c @@ -0,0 +1,115 @@ +/* x86_features.c - x86 feature check + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * Author: + * Jim Kukunas + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "x86_features.h" + +#ifdef _MSC_VER +# include +#else +// Newer versions of GCC and clang come with cpuid.h +# include +# ifdef X86_HAVE_XSAVE_INTRIN +# if __GNUC__ == 8 +# include +# else +# include +# endif +# endif +#endif + +#include + +static inline void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) { +#ifdef _MSC_VER + unsigned int registers[4]; + __cpuid((int *)registers, info); + + *eax = registers[0]; + *ebx = registers[1]; + *ecx = registers[2]; + *edx = registers[3]; +#else + *eax = *ebx = *ecx = *edx = 0; + __cpuid(info, *eax, *ebx, *ecx, *edx); +#endif +} + +static inline void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) { +#ifdef _MSC_VER + unsigned int registers[4]; + __cpuidex((int *)registers, info, subinfo); + + *eax = registers[0]; + *ebx = registers[1]; + *ecx = registers[2]; + *edx = registers[3]; +#else + *eax = *ebx = *ecx = *edx = 0; + __cpuid_count(info, subinfo, *eax, *ebx, *ecx, *edx); +#endif +} + +static inline uint64_t xgetbv(unsigned int xcr) { +#if defined(_MSC_VER) || defined(X86_HAVE_XSAVE_INTRIN) + return _xgetbv(xcr); +#else + uint32_t eax, edx; + __asm__ ( ".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c"(xcr)); + return (uint64_t)(edx) << 32 | eax; +#endif +} + +void Z_INTERNAL x86_check_features(struct x86_cpu_features *features) { + unsigned eax, ebx, ecx, edx; + unsigned maxbasic; + + cpuid(0, &maxbasic, &ebx, &ecx, &edx); + cpuid(1 /*CPU_PROCINFO_AND_FEATUREBITS*/, &eax, &ebx, &ecx, &edx); + + features->has_sse2 = edx & 0x4000000; + features->has_ssse3 = ecx & 0x200; + features->has_sse42 = ecx & 0x100000; + features->has_pclmulqdq = ecx & 0x2; + + if (ecx & 0x08000000) { + uint64_t xfeature = xgetbv(0); + + features->has_os_save_ymm = ((xfeature & 0x06) == 0x06); + features->has_os_save_zmm = ((xfeature & 0xe6) == 0xe6); + } + + if (maxbasic >= 7) { + cpuidex(7, 0, &eax, &ebx, &ecx, &edx); + + // check BMI1 bit + // Reference: https://software.intel.com/sites/default/files/article/405250/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family.pdf + features->has_vpclmulqdq = ecx & 0x400; + + // check AVX2 bit if the OS supports saving YMM registers + if (features->has_os_save_ymm) { + features->has_avx2 = ebx & 0x20; + } + + // check AVX512 bits if the OS supports saving ZMM registers + if (features->has_os_save_zmm) { + features->has_avx512f = ebx & 0x00010000; + if (features->has_avx512f) { + // According to the Intel Software Developer's Manual, AVX512F must be enabled too in order to enable + // AVX512(DQ,BW,VL). + features->has_avx512dq = ebx & 0x00020000; + features->has_avx512bw = ebx & 0x40000000; + features->has_avx512vl = ebx & 0x80000000; + } + features->has_avx512_common = features->has_avx512f && features->has_avx512dq && features->has_avx512bw \ + && features->has_avx512vl; + features->has_avx512vnni = ecx & 0x800; + } + } +} diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_features.h b/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_features.h new file mode 100644 index 000000000..6daa5e382 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_features.h @@ -0,0 +1,28 @@ +/* x86_features.h -- check for CPU features + * Copyright (C) 2013 Intel Corporation Jim Kukunas + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef X86_FEATURES_H_ +#define X86_FEATURES_H_ + +struct x86_cpu_features { + int has_avx2; + int has_avx512f; + int has_avx512dq; + int has_avx512bw; + int has_avx512vl; + int has_avx512_common; // Enabled when AVX512(F,DQ,BW,VL) are all enabled. + int has_avx512vnni; + int has_sse2; + int has_ssse3; + int has_sse42; + int has_pclmulqdq; + int has_vpclmulqdq; + int has_os_save_ymm; + int has_os_save_zmm; +}; + +void Z_INTERNAL x86_check_features(struct x86_cpu_features *features); + +#endif /* X86_FEATURES_H_ */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_functions.h b/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_functions.h new file mode 100644 index 000000000..5aa9b3174 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_functions.h @@ -0,0 +1,172 @@ +/* x86_functions.h -- x86 implementations for arch-specific functions. + * Copyright (C) 2013 Intel Corporation Jim Kukunas + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef X86_FUNCTIONS_H_ +#define X86_FUNCTIONS_H_ + +#ifdef X86_SSE2 +uint32_t chunksize_sse2(void); +uint8_t* chunkmemset_safe_sse2(uint8_t *out, unsigned dist, unsigned len, unsigned left); + +# ifdef HAVE_BUILTIN_CTZ + uint32_t compare256_sse2(const uint8_t *src0, const uint8_t *src1); + uint32_t longest_match_sse2(deflate_state *const s, Pos cur_match); + uint32_t longest_match_slow_sse2(deflate_state *const s, Pos cur_match); + void slide_hash_sse2(deflate_state *s); +# endif + void inflate_fast_sse2(PREFIX3(stream)* strm, uint32_t start); +#endif + +#ifdef X86_SSSE3 +uint32_t adler32_ssse3(uint32_t adler, const uint8_t *buf, size_t len); +uint8_t* chunkmemset_safe_ssse3(uint8_t *out, unsigned dist, unsigned len, unsigned left); +void inflate_fast_ssse3(PREFIX3(stream) *strm, uint32_t start); +#endif + +#ifdef X86_SSE42 +uint32_t adler32_fold_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +#endif + +#ifdef X86_AVX2 +uint32_t adler32_avx2(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t adler32_fold_copy_avx2(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +uint32_t chunksize_avx2(void); +uint8_t* chunkmemset_safe_avx2(uint8_t *out, unsigned dist, unsigned len, unsigned left); + +# ifdef HAVE_BUILTIN_CTZ + uint32_t compare256_avx2(const uint8_t *src0, const uint8_t *src1); + uint32_t longest_match_avx2(deflate_state *const s, Pos cur_match); + uint32_t longest_match_slow_avx2(deflate_state *const s, Pos cur_match); + void slide_hash_avx2(deflate_state *s); +# endif + void inflate_fast_avx2(PREFIX3(stream)* strm, uint32_t start); +#endif +#ifdef X86_AVX512 +uint32_t adler32_avx512(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t adler32_fold_copy_avx512(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +#endif +#ifdef X86_AVX512VNNI +uint32_t adler32_avx512_vnni(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t adler32_fold_copy_avx512_vnni(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +#endif + +#ifdef X86_PCLMULQDQ_CRC +uint32_t crc32_fold_pclmulqdq_reset(crc32_fold *crc); +void crc32_fold_pclmulqdq_copy(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len); +void crc32_fold_pclmulqdq(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc); +uint32_t crc32_fold_pclmulqdq_final(crc32_fold *crc); +uint32_t crc32_pclmulqdq(uint32_t crc32, const uint8_t *buf, size_t len); +#endif +#ifdef X86_VPCLMULQDQ_CRC +uint32_t crc32_fold_vpclmulqdq_reset(crc32_fold *crc); +void crc32_fold_vpclmulqdq_copy(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len); +void crc32_fold_vpclmulqdq(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc); +uint32_t crc32_fold_vpclmulqdq_final(crc32_fold *crc); +uint32_t crc32_vpclmulqdq(uint32_t crc32, const uint8_t *buf, size_t len); +#endif + + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +// X86 - SSE2 +# if (defined(X86_SSE2) && defined(__SSE2__)) || defined(__x86_64__) || defined(_M_X64) || defined(X86_NOCHECK_SSE2) +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_sse2 +# undef native_chunksize +# define native_chunksize chunksize_sse2 +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_sse2 +# undef native_slide_hash +# define native_slide_hash slide_hash_sse2 +# ifdef HAVE_BUILTIN_CTZ +# undef native_compare256 +# define native_compare256 compare256_sse2 +# undef native_longest_match +# define native_longest_match longest_match_sse2 +# undef native_longest_match_slow +# define native_longest_match_slow longest_match_slow_sse2 +# endif +#endif +// X86 - SSSE3 +# if defined(X86_SSSE3) && defined(__SSSE3__) +# undef native_adler32 +# define native_adler32 adler32_ssse3 +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_ssse3 +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_ssse3 +# endif +// X86 - SSE4.2 +# if defined(X86_SSE42) && defined(__SSE4_2__) +# undef native_adler32_fold_copy +# define native_adler32_fold_copy adler32_fold_copy_sse42 +# endif + +// X86 - PCLMUL +#if defined(X86_PCLMULQDQ_CRC) && defined(__PCLMUL__) +# undef native_crc32 +# define native_crc32 crc32_pclmulqdq +# undef native_crc32_fold +# define native_crc32_fold crc32_fold_pclmulqdq +# undef native_crc32_fold_copy +# define native_crc32_fold_copy crc32_fold_pclmulqdq_copy +# undef native_crc32_fold_final +# define native_crc32_fold_final crc32_fold_pclmulqdq_final +# undef native_crc32_fold_reset +# define native_crc32_fold_reset crc32_fold_pclmulqdq_reset +#endif +// X86 - AVX +# if defined(X86_AVX2) && defined(__AVX2__) +# undef native_adler32 +# define native_adler32 adler32_avx2 +# undef native_adler32_fold_copy +# define native_adler32_fold_copy adler32_fold_copy_avx2 +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_avx2 +# undef native_chunksize +# define native_chunksize chunksize_avx2 +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_avx2 +# undef native_slide_hash +# define native_slide_hash slide_hash_avx2 +# ifdef HAVE_BUILTIN_CTZ +# undef native_compare256 +# define native_compare256 compare256_avx2 +# undef native_longest_match +# define native_longest_match longest_match_avx2 +# undef native_longest_match_slow +# define native_longest_match_slow longest_match_slow_avx2 +# endif +# endif + +// X86 - AVX512 (F,DQ,BW,Vl) +# if defined(X86_AVX512) && defined(__AVX512F__) && defined(__AVX512DQ__) && defined(__AVX512BW__) && defined(__AVX512VL__) +# undef native_adler32 +# define native_adler32 adler32_avx512 +# undef native_adler32_fold_copy +# define native_adler32_fold_copy adler32_fold_copy_avx512 +// X86 - AVX512 (VNNI) +# if defined(X86_AVX512VNNI) && defined(__AVX512VNNI__) +# undef native_adler32 +# define native_adler32 adler32_avx512_vnni +# undef native_adler32_fold_copy +# define native_adler32_fold_copy adler32_fold_copy_avx512_vnni +# endif +// X86 - VPCLMULQDQ +# if defined(__PCLMUL__) && defined(__AVX512F__) && defined(__VPCLMULQDQ__) +# undef native_crc32 +# define native_crc32 crc32_vpclmulqdq +# undef native_crc32_fold +# define native_crc32_fold crc32_fold_vpclmulqdq +# undef native_crc32_fold_copy +# define native_crc32_fold_copy crc32_fold_vpclmulqdq_copy +# undef native_crc32_fold_final +# define native_crc32_fold_final crc32_fold_vpclmulqdq_final +# undef native_crc32_fold_reset +# define native_crc32_fold_reset crc32_fold_vpclmulqdq_reset +# endif +# endif +#endif + +#endif /* X86_FUNCTIONS_H_ */ diff --git a/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_intrins.h b/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_intrins.h new file mode 100644 index 000000000..a2ec0027c --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch/x86/x86_intrins.h @@ -0,0 +1,92 @@ +#ifndef X86_INTRINS_H +#define X86_INTRINS_H + +/* Unfortunately GCC didn't support these things until version 10. + * Similarly, AppleClang didn't support them in Xcode 9.2 but did in 9.3. + */ +#ifdef __AVX2__ +#include + +#if (!defined(__clang__) && !defined(__NVCOMPILER) && defined(__GNUC__) && __GNUC__ < 10) \ + || (defined(__apple_build_version__) && __apple_build_version__ < 9020039) +static inline __m256i _mm256_zextsi128_si256(__m128i a) { + __m128i r; + __asm__ volatile ("vmovdqa %1,%0" : "=x" (r) : "x" (a)); + return _mm256_castsi128_si256(r); +} + +#ifdef __AVX512F__ +static inline __m512i _mm512_zextsi128_si512(__m128i a) { + __m128i r; + __asm__ volatile ("vmovdqa %1,%0" : "=x" (r) : "x" (a)); + return _mm512_castsi128_si512(r); +} +#endif // __AVX512F__ +#endif // gcc/AppleClang version test + +#endif // __AVX2__ + +/* GCC <9 is missing some AVX512 intrinsics. + */ +#ifdef __AVX512F__ +#if (!defined(__clang__) && !defined(__NVCOMPILER) && defined(__GNUC__) && __GNUC__ < 9) +#include + +#define PACK(c0, c1, c2, c3) (((int)(unsigned char)(c0) << 24) | ((int)(unsigned char)(c1) << 16) | \ + ((int)(unsigned char)(c2) << 8) | ((int)(unsigned char)(c3))) + +static inline __m512i _mm512_set_epi8(char __q63, char __q62, char __q61, char __q60, + char __q59, char __q58, char __q57, char __q56, + char __q55, char __q54, char __q53, char __q52, + char __q51, char __q50, char __q49, char __q48, + char __q47, char __q46, char __q45, char __q44, + char __q43, char __q42, char __q41, char __q40, + char __q39, char __q38, char __q37, char __q36, + char __q35, char __q34, char __q33, char __q32, + char __q31, char __q30, char __q29, char __q28, + char __q27, char __q26, char __q25, char __q24, + char __q23, char __q22, char __q21, char __q20, + char __q19, char __q18, char __q17, char __q16, + char __q15, char __q14, char __q13, char __q12, + char __q11, char __q10, char __q09, char __q08, + char __q07, char __q06, char __q05, char __q04, + char __q03, char __q02, char __q01, char __q00) { + return _mm512_set_epi32(PACK(__q63, __q62, __q61, __q60), PACK(__q59, __q58, __q57, __q56), + PACK(__q55, __q54, __q53, __q52), PACK(__q51, __q50, __q49, __q48), + PACK(__q47, __q46, __q45, __q44), PACK(__q43, __q42, __q41, __q40), + PACK(__q39, __q38, __q37, __q36), PACK(__q35, __q34, __q33, __q32), + PACK(__q31, __q30, __q29, __q28), PACK(__q27, __q26, __q25, __q24), + PACK(__q23, __q22, __q21, __q20), PACK(__q19, __q18, __q17, __q16), + PACK(__q15, __q14, __q13, __q12), PACK(__q11, __q10, __q09, __q08), + PACK(__q07, __q06, __q05, __q04), PACK(__q03, __q02, __q01, __q00)); +} + +#undef PACK + +#endif // gcc version test +#endif // __AVX512F__ + +/* Missing zero-extension AVX and AVX512 intrinsics. + * Fixed in Microsoft Visual Studio 2017 version 15.7 + * https://developercommunity.visualstudio.com/t/missing-zero-extension-avx-and-avx512-intrinsics/175737 + */ +#if defined(_MSC_VER) && _MSC_VER < 1914 +#ifdef __AVX2__ +static inline __m256i _mm256_zextsi128_si256(__m128i a) { + return _mm256_inserti128_si256(_mm256_setzero_si256(), a, 0); +} +#endif // __AVX2__ + +#ifdef __AVX512F__ +static inline __m512i _mm512_zextsi128_si512(__m128i a) { + return _mm512_inserti32x4(_mm512_setzero_si512(), a, 0); +} +#endif // __AVX512F__ +#endif // defined(_MSC_VER) && _MSC_VER < 1914 + +/* Visual C++ toolchains before v142 have constant overflow in AVX512 intrinsics */ +#if defined(_MSC_VER) && defined(__AVX512F__) && !defined(_MM_K0_REG8) +# undef _mm512_extracti32x4_epi32 +# define _mm512_extracti32x4_epi32(v1, e1) _mm512_maskz_extracti32x4_epi32(UINT8_MAX, v1, e1) +#endif +#endif // include guard X86_INTRINS_H diff --git a/internal-complibs/zlib-ng-2.2.2/arch_functions.h b/internal-complibs/zlib-ng-2.2.2/arch_functions.h new file mode 100644 index 000000000..9a7f8d937 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/arch_functions.h @@ -0,0 +1,29 @@ +/* arch_functions.h -- Arch-specific function prototypes. + * Copyright (C) 2017 Hans Kristian Rosbach + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef CPU_FUNCTIONS_H_ +#define CPU_FUNCTIONS_H_ + +#include "zbuild.h" +#include "zutil.h" +#include "crc32.h" +#include "deflate.h" +#include "fallback_builtins.h" + +#include "arch/generic/generic_functions.h" + +#if defined(X86_FEATURES) +# include "arch/x86/x86_functions.h" +#elif defined(ARM_FEATURES) +# include "arch/arm/arm_functions.h" +#elif defined(PPC_FEATURES) || defined(POWER_FEATURES) +# include "arch/power/power_functions.h" +#elif defined(S390_FEATURES) +# include "arch/s390/s390_functions.h" +#elif defined(RISCV_FEATURES) +# include "arch/riscv/riscv_functions.h" +#endif + +#endif diff --git a/internal-complibs/zlib-ng-2.0.7/chunkset_tpl.h b/internal-complibs/zlib-ng-2.2.2/chunkset_tpl.h similarity index 52% rename from internal-complibs/zlib-ng-2.0.7/chunkset_tpl.h rename to internal-complibs/zlib-ng-2.2.2/chunkset_tpl.h index 68728d4a5..f5cc5c045 100644 --- a/internal-complibs/zlib-ng-2.0.7/chunkset_tpl.h +++ b/internal-complibs/zlib-ng-2.2.2/chunkset_tpl.h @@ -2,6 +2,13 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ +#include "zbuild.h" +#include + +#if CHUNK_SIZE == 32 && defined(X86_SSSE3) +extern uint8_t* chunkmemset_ssse3(uint8_t *out, unsigned dist, unsigned len); +#endif + /* Returns the chunk size */ Z_INTERNAL uint32_t CHUNKSIZE(void) { return sizeof(chunk_t); @@ -17,70 +24,26 @@ Z_INTERNAL uint32_t CHUNKSIZE(void) { (chunk_t bytes or fewer) will fall straight through the loop without iteration, which will hopefully make the branch prediction more reliable. */ -Z_INTERNAL uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) { +#ifndef HAVE_CHUNKCOPY +static inline uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) { Assert(len > 0, "chunkcopy should never have a length 0"); chunk_t chunk; - int32_t align = (--len % sizeof(chunk_t)) + 1; + int32_t align = ((len - 1) % sizeof(chunk_t)) + 1; loadchunk(from, &chunk); storechunk(out, &chunk); out += align; from += align; - len /= sizeof(chunk_t); + len -= align; while (len > 0) { loadchunk(from, &chunk); storechunk(out, &chunk); out += sizeof(chunk_t); from += sizeof(chunk_t); - --len; + len -= sizeof(chunk_t); } return out; } - -/* Behave like chunkcopy, but avoid writing beyond of legal output. */ -Z_INTERNAL uint8_t* CHUNKCOPY_SAFE(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) { - unsigned safelen = (unsigned)((safe - out) + 1); - len = MIN(len, safelen); -#if CHUNK_SIZE >= 32 - while (len >= 32) { - memcpy(out, from, 32); - out += 32; - from += 32; - len -= 32; - } #endif -#if CHUNK_SIZE >= 16 - while (len >= 16) { - memcpy(out, from, 16); - out += 16; - from += 16; - len -= 16; - } -#endif -#if CHUNK_SIZE >= 8 - while (len >= 8) { - memcpy(out, from, 8); - out += 8; - from += 8; - len -= 8; - } -#endif - if (len >= 4) { - memcpy(out, from, 4); - out += 4; - from += 4; - len -= 4; - } - if (len >= 2) { - memcpy(out, from, 2); - out += 2; - from += 2; - len -= 2; - } - if (len == 1) { - *out++ = *from++; - } - return out; -} /* Perform short copies until distance can be rewritten as being at least sizeof chunk_t. @@ -90,7 +53,8 @@ Z_INTERNAL uint8_t* CHUNKCOPY_SAFE(uint8_t *out, uint8_t const *from, unsigned l This assumption holds because inflate_fast() starts every iteration with at least 258 bytes of output space available (258 being the maximum length output from a single token; see inflate_fast()'s assumptions below). */ -Z_INTERNAL uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) { +#ifndef HAVE_CHUNKUNROLL +static inline uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) { unsigned char const *from = out - *dist; chunk_t chunk; while (*dist < *len && *dist < sizeof(chunk_t)) { @@ -102,6 +66,30 @@ Z_INTERNAL uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) { } return out; } +#endif + +#ifndef HAVE_CHUNK_MAG +/* Loads a magazine to feed into memory of the pattern */ +static inline chunk_t GET_CHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) { + /* This code takes string of length dist from "from" and repeats + * it for as many times as can fit in a chunk_t (vector register) */ + uint32_t cpy_dist; + uint32_t bytes_remaining = sizeof(chunk_t); + chunk_t chunk_load; + uint8_t *cur_chunk = (uint8_t *)&chunk_load; + while (bytes_remaining) { + cpy_dist = MIN(dist, bytes_remaining); + memcpy(cur_chunk, buf, cpy_dist); + bytes_remaining -= cpy_dist; + cur_chunk += cpy_dist; + /* This allows us to bypass an expensive integer division since we're effectively + * counting in this loop, anyway */ + *chunk_rem = cpy_dist; + } + + return chunk_load; +} +#endif /* Copy DIST bytes from OUT - DIST into OUT + DIST * k, for 0 <= k < LEN/DIST. Return OUT + LEN. */ @@ -109,67 +97,72 @@ Z_INTERNAL uint8_t* CHUNKMEMSET(uint8_t *out, unsigned dist, unsigned len) { /* Debug performance related issues when len < sizeof(uint64_t): Assert(len >= sizeof(uint64_t), "chunkmemset should be called on larger chunks"); */ Assert(dist > 0, "chunkmemset cannot have a distance 0"); - - unsigned char *from = out - dist; - chunk_t chunk; - unsigned sz = sizeof(chunk); - if (len < sz) { - while (len != 0) { - *out++ = *from++; - --len; - } - return out; + /* Only AVX2 */ +#if CHUNK_SIZE == 32 && defined(X86_SSSE3) + if (len <= 16) { + return chunkmemset_ssse3(out, dist, len); } +#endif + + uint8_t *from = out - dist; -#ifdef HAVE_CHUNKMEMSET_1 if (dist == 1) { - chunkmemset_1(from, &chunk); - } else -#endif + memset(out, *from, len); + return out + len; + } else if (dist > sizeof(chunk_t)) { + return CHUNKCOPY(out, out - dist, len); + } + + chunk_t chunk_load; + uint32_t chunk_mod = 0; + + /* TODO: possibly build up a permutation table for this if not an even modulus */ #ifdef HAVE_CHUNKMEMSET_2 if (dist == 2) { - chunkmemset_2(from, &chunk); + chunkmemset_2(from, &chunk_load); } else #endif #ifdef HAVE_CHUNKMEMSET_4 if (dist == 4) { - chunkmemset_4(from, &chunk); + chunkmemset_4(from, &chunk_load); } else #endif #ifdef HAVE_CHUNKMEMSET_8 if (dist == 8) { - chunkmemset_8(from, &chunk); + chunkmemset_8(from, &chunk_load); + } else if (dist == sizeof(chunk_t)) { + loadchunk(from, &chunk_load); } else #endif - if (dist == sz) { - loadchunk(from, &chunk); - } else if (dist < sz) { - unsigned char *end = out + len - 1; - while (len > dist) { - out = CHUNKCOPY_SAFE(out, from, dist, end); - len -= dist; - } - if (len > 0) { - out = CHUNKCOPY_SAFE(out, from, len, end); + { + chunk_load = GET_CHUNK_MAG(from, &chunk_mod, dist); + } + + /* If we're lucky enough and dist happens to be an even modulus of our vector length, + * we can do two stores per loop iteration, which for most ISAs, especially x86, is beneficial */ + if (chunk_mod == 0) { + while (len >= (2 * sizeof(chunk_t))) { + storechunk(out, &chunk_load); + storechunk(out + sizeof(chunk_t), &chunk_load); + out += 2 * sizeof(chunk_t); + len -= 2 * sizeof(chunk_t); } - return out; - } else { - out = CHUNKUNROLL(out, &dist, &len); - return CHUNKCOPY(out, out - dist, len); } - unsigned rem = len % sz; - len -= rem; - while (len) { - storechunk(out, &chunk); - out += sz; - len -= sz; + /* If we don't have a "dist" length that divides evenly into a vector + * register, we can write the whole vector register but we need only + * advance by the amount of the whole string that fits in our chunk_t. + * If we do divide evenly into the vector length, adv_amount = chunk_t size*/ + uint32_t adv_amount = sizeof(chunk_t) - chunk_mod; + while (len >= sizeof(chunk_t)) { + storechunk(out, &chunk_load); + len -= adv_amount; + out += adv_amount; } - /* Last, deal with the case when LEN is not a multiple of SZ. */ - if (rem) { - memcpy(out, from, rem); - out += rem; + if (len) { + memcpy(out, &chunk_load, len); + out += len; } return out; diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/detect-arch.c b/internal-complibs/zlib-ng-2.2.2/cmake/detect-arch.c similarity index 94% rename from internal-complibs/zlib-ng-2.0.7/cmake/detect-arch.c rename to internal-complibs/zlib-ng-2.2.2/cmake/detect-arch.c index 43ddb126a..92590182c 100644 --- a/internal-complibs/zlib-ng-2.0.7/cmake/detect-arch.c +++ b/internal-complibs/zlib-ng-2.2.2/cmake/detect-arch.c @@ -12,7 +12,7 @@ #error archfound i686 // ARM -#elif defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) +#elif defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) || defined(_M_ARM64EC) #error archfound aarch64 #elif defined(__arm__) || defined(__arm) || defined(_M_ARM) || defined(__TARGET_ARCH_ARM) #if defined(__ARM64_ARCH_8__) || defined(__ARMv8__) || defined(__ARMv8_A__) @@ -101,6 +101,14 @@ #error archfound riscv32 #endif +// LOONGARCH +#elif defined(__loongarch_lp64) + #error archfound loongarch64 + +// Emscripten (WebAssembly) +#elif defined(__EMSCRIPTEN__) + #error archfound wasm32 + // return 'unrecognized' if we do not know what architecture this is #else #error archfound unrecognized diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/detect-arch.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/detect-arch.cmake similarity index 88% rename from internal-complibs/zlib-ng-2.0.7/cmake/detect-arch.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/detect-arch.cmake index f0547ba31..dfdc6013c 100644 --- a/internal-complibs/zlib-ng-2.0.7/cmake/detect-arch.cmake +++ b/internal-complibs/zlib-ng-2.2.2/cmake/detect-arch.cmake @@ -13,9 +13,11 @@ elseif(MSVC) set(ARCH "x86_64") elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM" OR "${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARMV7") set(ARCH "arm") - elseif ("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM64") + elseif ("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM64" OR "${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM64EC") set(ARCH "aarch64") endif() +elseif(EMSCRIPTEN) + set(ARCH "wasm32") elseif(CMAKE_CROSSCOMPILING) set(ARCH ${CMAKE_C_COMPILER_TARGET}) else() @@ -49,7 +51,7 @@ endif() if("${ARCH}" MATCHES "(x86_64|AMD64|i[3-6]86)") set(BASEARCH "x86") set(BASEARCH_X86_FOUND TRUE) -elseif("${ARCH}" MATCHES "(arm(v[0-9])?|aarch64)") +elseif("${ARCH}" MATCHES "(arm(v[0-9])?|aarch64|cortex)") set(BASEARCH "arm") set(BASEARCH_ARM_FOUND TRUE) elseif("${ARCH}" MATCHES "ppc(64(le)?)?|powerpc(64(le)?)?") @@ -88,6 +90,12 @@ elseif("${ARCH}" MATCHES "rs6000") elseif("${ARCH}" MATCHES "riscv(32|64)") set(BASEARCH "riscv") set(BASEARCH_RISCV_FOUND TRUE) +elseif("${ARCH}" MATCHES "loongarch64") + set(BASEARCH "loongarch") + set(BASEARCH_LOONGARCH_FOUND TRUE) +elseif("${ARCH}" MATCHES "wasm32") + set(BASEARCH "wasm32") + set(BASEARCH_WASM32_FOUND TRUE) else() set(BASEARCH "x86") set(BASEARCH_X86_FOUND TRUE) diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/detect-coverage.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/detect-coverage.cmake similarity index 61% rename from internal-complibs/zlib-ng-2.0.7/cmake/detect-coverage.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/detect-coverage.cmake index 96478f677..8e67a085c 100644 --- a/internal-complibs/zlib-ng-2.0.7/cmake/detect-coverage.cmake +++ b/internal-complibs/zlib-ng-2.2.2/cmake/detect-coverage.cmake @@ -13,9 +13,9 @@ macro(add_code_coverage) set(CMAKE_REQUIRED_LINK_OPTIONS) if(HAVE_COVERAGE) - set(CMAKE_C_FLAGS "-O0 ${CMAKE_C_FLAGS} -coverage") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -coverage") + add_compile_options(-coverage) + add_link_options(-coverage) + message(STATUS "Code coverage enabled using: -coverage") else() # Some versions of GCC don't support -coverage shorthand if(CMAKE_VERSION VERSION_LESS 3.14) @@ -28,11 +28,19 @@ macro(add_code_coverage) set(CMAKE_REQUIRED_LINK_OPTIONS) if(HAVE_TEST_COVERAGE) - set(CMAKE_C_FLAGS "-O0 ${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs -fprofile-values") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov -fprofile-arcs") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov -fprofile-arcs") + add_compile_options(-ftest-coverage -fprofile-arcs -fprofile-values) + add_link_options(-lgcov -fprofile-arcs) + message(STATUS "Code coverage enabled using: -ftest-coverage") else() message(WARNING "Compiler does not support code coverage") + set(WITH_CODE_COVERAGE OFF) endif() endif() + + # Set optimization level to zero for code coverage builds + if (WITH_CODE_COVERAGE) + # Use CMake compiler flag variables due to add_compile_options failure on Windows GCC + set(CMAKE_C_FLAGS "-O0 ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-O0 ${CMAKE_CXX_FLAGS}") + endif() endmacro() diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/detect-install-dirs.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/detect-install-dirs.cmake new file mode 100644 index 000000000..a7c774f47 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/detect-install-dirs.cmake @@ -0,0 +1,43 @@ +# detect-install-dirs.cmake -- Detect install directory parameters +# Copyright (C) 2021 Hans Kristian Rosbach +# Licensed under the Zlib license, see LICENSE.md for details + +# Determine installation directory for executables +if (DEFINED BIN_INSTALL_DIR) + set(BIN_INSTALL_DIR "${BIN_INSTALL_DIR}" CACHE PATH "Installation directory for executables (Deprecated)" FORCE) + set(CMAKE_INSTALL_BINDIR "${BIN_INSTALL_DIR}") +elseif (DEFINED INSTALL_BIN_DIR) + set(CMAKE_INSTALL_BINDIR "${INSTALL_BIN_DIR}") +endif() + +# Determine installation directory for libraries +if (DEFINED LIB_INSTALL_DIR) + set(LIB_INSTALL_DIR "${LIB_INSTALL_DIR}" CACHE PATH "Installation directory for libraries (Deprecated)" FORCE) + set(CMAKE_INSTALL_LIBDIR "${LIB_INSTALL_DIR}") +elseif (DEFINED INSTALL_LIB_DIR) + set(CMAKE_INSTALL_LIBDIR "${INSTALL_LIB_DIR}") +endif() + +# Determine installation directory for include files +if (DEFINED INC_INSTALL_DIR) + set(INC_INSTALL_DIR "${INC_INSTALL_DIR}" CACHE PATH "Installation directory for headers (Deprecated)" FORCE) + set(CMAKE_INSTALL_INCLUDEDIR "${INC_INSTALL_DIR}") +elseif (DEFINED INSTALL_INC_DIR) + set(CMAKE_INSTALL_INCLUDEDIR "${INSTALL_INC_DIR}") +endif() + +# Define GNU standard installation directories +include(GNUInstallDirs) + +# Determine installation directory for pkgconfig files +if (DEFINED PKGCONFIG_INSTALL_DIR) + set(PKGCONFIG_INSTALL_DIR "${PKGCONFIG_INSTALL_DIR}" CACHE PATH "Installation directory for pkgconfig (.pc) files" FORCE) +elseif (DEFINED INSTALL_PKGCONFIG_DIR) + set(PKGCONFIG_INSTALL_DIR "${INSTALL_PKGCONFIG_DIR}" CACHE PATH "Installation directory for pkgconfig (.pc) files" FORCE) +elseif (DEFINED CMAKE_INSTALL_PKGCONFIGDIR) + set(PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_PKGCONFIGDIR}" CACHE PATH "Installation directory for pkgconfig (.pc) files" FORCE) +elseif (DEFINED CMAKE_INSTALL_FULL_PKGCONFIGDIR) + set(PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_FULL_PKGCONFIGDIR}" CACHE PATH "Installation directory for pkgconfig (.pc) files" FORCE) +else() + set(PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") +endif() diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/detect-intrinsics.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/detect-intrinsics.cmake new file mode 100644 index 000000000..1906f2154 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/detect-intrinsics.cmake @@ -0,0 +1,604 @@ +# detect-intrinsics.cmake -- Detect compiler intrinsics support +# Licensed under the Zlib license, see LICENSE.md for details + +macro(check_acle_compiler_flag) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + check_c_compiler_flag("-march=armv8-a+crc" HAVE_MARCH_ARMV8_CRC) + if(HAVE_MARCH_ARMV8_CRC) + set(ACLEFLAG "-march=armv8-a+crc" CACHE INTERNAL "Compiler option to enable ACLE support") + else() + check_c_compiler_flag("-march=armv8-a+crc+simd" HAVE_MARCH_ARMV8_CRC_SIMD) + if(HAVE_MARCH_ARMV8_CRC_SIMD) + set(ACLEFLAG "-march=armv8-a+crc+simd" CACHE INTERNAL "Compiler option to enable ACLE support") + endif() + endif() + endif() + endif() + # Check whether compiler supports ARMv8 CRC intrinsics + set(CMAKE_REQUIRED_FLAGS "${ACLEFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#if defined(_MSC_VER) + #include + #else + #include + #endif + unsigned int f(unsigned int a, unsigned int b) { + return __crc32w(a, b); + } + int main(void) { return 0; }" + HAVE_ACLE_FLAG + ) + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_armv6_compiler_flag) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + check_c_compiler_flag("-march=armv6" HAVE_MARCH_ARMV6) + if(HAVE_MARCH_ARMV6) + set(ARMV6FLAG "-march=armv6" CACHE INTERNAL "Compiler option to enable ARMv6 support") + endif() + endif() + endif() + # Check whether compiler supports ARMv6 inline asm + set(CMAKE_REQUIRED_FLAGS "${ARMV6FLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "unsigned int f(unsigned int a, unsigned int b) { + unsigned int c; + __asm__ __volatile__ ( \"uqsub16 %0, %1, %2\" : \"=r\" (c) : \"r\" (a), \"r\" (b) ); + return (int)c; + } + int main(void) { return f(1,2); }" + HAVE_ARMV6_INLINE_ASM + ) + # Check whether compiler supports ARMv6 intrinsics + check_c_source_compiles( + "#if defined(_MSC_VER) + #include + #else + #include + #endif + unsigned int f(unsigned int a, unsigned int b) { + #if defined(_MSC_VER) + return _arm_uqsub16(a, b); + #else + return __uqsub16(a, b); + #endif + } + int main(void) { return f(1,2); }" + HAVE_ARMV6_INTRIN + ) + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_avx512_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE) + set(AVX512FLAG "-mavx512f -mavx512dq -mavx512bw -mavx512vl") + else() + set(AVX512FLAG "/arch:AVX512") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + # For CPUs that can benefit from AVX512, it seems GCC generates suboptimal + # instruction scheduling unless you specify a reasonable -mtune= target + set(AVX512FLAG "-mavx512f -mavx512dq -mavx512bw -mavx512vl") + if(NOT MSVC) + check_c_compiler_flag("-mtune=cascadelake" HAVE_CASCADE_LAKE) + if(HAVE_CASCADE_LAKE) + set(AVX512FLAG "${AVX512FLAG} -mtune=cascadelake") + else() + set(AVX512FLAG "${AVX512FLAG} -mtune=skylake-avx512") + endif() + unset(HAVE_CASCADE_LAKE) + endif() + elseif(MSVC) + set(AVX512FLAG "/arch:AVX512") + endif() + endif() + # Check whether compiler supports AVX512 intrinsics + set(CMAKE_REQUIRED_FLAGS "${AVX512FLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + __m512i f(__m512i y) { + __m512i x = _mm512_set1_epi8(2); + return _mm512_sub_epi8(x, y); + } + int main(void) { return 0; }" + HAVE_AVX512_INTRIN + ) +endmacro() + +macro(check_avx512vnni_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE OR CMAKE_C_COMPILER_ID MATCHES "IntelLLVM") + set(AVX512VNNIFLAG "-mavx512f -mavx512dq -mavx512bw -mavx512vl -mavx512vnni") + else() + set(AVX512VNNIFLAG "/arch:AVX512") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set(AVX512VNNIFLAG "-mavx512f -mavx512dq -mavx512bw -mavx512vl -mavx512vnni") + if(NOT MSVC) + check_c_compiler_flag("-mtune=cascadelake" HAVE_CASCADE_LAKE) + if(HAVE_CASCADE_LAKE) + set(AVX512VNNIFLAG "${AVX512VNNIFLAG} -mtune=cascadelake") + else() + set(AVX512VNNIFLAG "${AVX512VNNIFLAG} -mtune=skylake-avx512") + endif() + unset(HAVE_CASCADE_LAKE) + endif() + elseif(MSVC) + set(AVX512VNNIFLAG "/arch:AVX512") + endif() + endif() + # Check whether compiler supports AVX512vnni intrinsics + set(CMAKE_REQUIRED_FLAGS "${AVX512VNNIFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + __m512i f(__m512i x, __m512i y) { + __m512i z = _mm512_setzero_epi32(); + return _mm512_dpbusd_epi32(z, x, y); + } + int main(void) { return 0; }" + HAVE_AVX512VNNI_INTRIN + ) + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_avx2_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE) + set(AVX2FLAG "-mavx2") + else() + set(AVX2FLAG "/arch:AVX2") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set(AVX2FLAG "-mavx2") + elseif(MSVC) + set(AVX2FLAG "/arch:AVX2") + endif() + endif() + # Check whether compiler supports AVX2 intrinics + set(CMAKE_REQUIRED_FLAGS "${AVX2FLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + __m256i f(__m256i x) { + const __m256i y = _mm256_set1_epi16(1); + return _mm256_subs_epu16(x, y); + } + int main(void) { return 0; }" + HAVE_AVX2_INTRIN + ) + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_neon_compiler_flag) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + if("${ARCH}" MATCHES "aarch64") + set(NEONFLAG "-march=armv8-a+simd") + else() + set(NEONFLAG "-mfpu=neon") + endif() + endif() + endif() + # Check whether compiler supports NEON flag + set(CMAKE_REQUIRED_FLAGS "${NEONFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#if defined(_M_ARM64) || defined(_M_ARM64EC) + # include + #else + # include + #endif + int main() { return 0; }" + NEON_AVAILABLE FAIL_REGEX "not supported") + # Check whether compiler native flag is enough for NEON support + # Some GCC versions don't enable FPU (vector unit) when using -march=native + if(NEON_AVAILABLE AND NATIVEFLAG AND (NOT "${ARCH}" MATCHES "aarch64")) + check_c_source_compiles( + "#include + uint8x16_t f(uint8x16_t x, uint8x16_t y) { + return vaddq_u8(x, y); + } + int main(int argc, char* argv[]) { + uint8x16_t a = vdupq_n_u8(argc); + uint8x16_t b = vdupq_n_u8(argc); + uint8x16_t result = f(a, b); + return result[0]; + }" + ARM_NEON_SUPPORT_NATIVE + ) + if(NOT ARM_NEON_SUPPORT_NATIVE) + set(CMAKE_REQUIRED_FLAGS "${NATIVEFLAG} -mfpu=neon ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + uint8x16_t f(uint8x16_t x, uint8x16_t y) { + return vaddq_u8(x, y); + } + int main(int argc, char* argv[]) { + uint8x16_t a = vdupq_n_u8(argc); + uint8x16_t b = vdupq_n_u8(argc); + uint8x16_t result = f(a, b); + return result[0]; + }" + ARM_NEON_SUPPORT_NATIVE_MFPU + ) + if(ARM_NEON_SUPPORT_NATIVE_MFPU) + set(NEONFLAG "-mfpu=neon") + else() + # Remove local NEON_AVAILABLE variable and overwrite the cache + unset(NEON_AVAILABLE) + set(NEON_AVAILABLE "" CACHE INTERNAL "NEON support available" FORCE) + endif() + endif() + endif() + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_neon_ld4_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + if("${ARCH}" MATCHES "aarch64") + set(NEONFLAG "-march=armv8-a+simd") + else() + set(NEONFLAG "-mfpu=neon") + endif() + endif() + endif() + # Check whether compiler supports loading 4 neon vecs into a register range + set(CMAKE_REQUIRED_FLAGS "${NEONFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC)) + # include + #else + # include + #endif + int32x4x4_t f(int var[16]) { return vld1q_s32_x4(var); } + int main(void) { return 0; }" + NEON_HAS_LD4) + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_pclmulqdq_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "IntelLLVM") + set(PCLMULFLAG "-mpclmul") + endif() + endif() + # Check whether compiler supports PCLMULQDQ intrinsics + if(NOT (APPLE AND "${ARCH}" MATCHES "i386")) + # The pclmul code currently crashes on Mac in 32bit mode. Avoid for now. + set(CMAKE_REQUIRED_FLAGS "${PCLMULFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + #include + __m128i f(__m128i a, __m128i b) { return _mm_clmulepi64_si128(a, b, 0x10); } + int main(void) { return 0; }" + HAVE_PCLMULQDQ_INTRIN + ) + set(CMAKE_REQUIRED_FLAGS) + else() + set(HAVE_PCLMULQDQ_INTRIN OFF) + endif() +endmacro() + +macro(check_vpclmulqdq_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "IntelLLVM") + set(VPCLMULFLAG "-mvpclmulqdq -mavx512f") + endif() + endif() + # Check whether compiler supports VPCLMULQDQ intrinsics + if(NOT (APPLE AND "${ARCH}" MATCHES "i386")) + set(CMAKE_REQUIRED_FLAGS "${VPCLMULFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + #include + __m512i f(__m512i a) { + __m512i b = _mm512_setzero_si512(); + return _mm512_clmulepi64_epi128(a, b, 0x10); + } + int main(void) { return 0; }" + HAVE_VPCLMULQDQ_INTRIN + ) + set(CMAKE_REQUIRED_FLAGS) + else() + set(HAVE_VPCLMULQDQ_INTRIN OFF) + endif() +endmacro() + +macro(check_ppc_intrinsics) + # Check if compiler supports AltiVec + set(CMAKE_REQUIRED_FLAGS "-maltivec ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + int main(void) + { + vector int a = vec_splats(0); + vector int b = vec_splats(0); + a = vec_add(a, b); + return 0; + }" + HAVE_ALTIVEC + ) + set(CMAKE_REQUIRED_FLAGS) + + if(HAVE_ALTIVEC) + set(PPCFLAGS "-maltivec") + endif() + + set(CMAKE_REQUIRED_FLAGS "-maltivec -mno-vsx ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + int main(void) + { + vector int a = vec_splats(0); + vector int b = vec_splats(0); + a = vec_add(a, b); + return 0; + }" + HAVE_NOVSX + ) + set(CMAKE_REQUIRED_FLAGS) + + if(HAVE_NOVSX) + set(PPCFLAGS "${PPCFLAGS} -mno-vsx") + endif() + + # Check if we have what we need for AltiVec optimizations + set(CMAKE_REQUIRED_FLAGS "${PPCFLAGS} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + #ifdef __FreeBSD__ + #include + #endif + int main() { + #ifdef __FreeBSD__ + unsigned long hwcap; + elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); + return (hwcap & PPC_FEATURE_HAS_ALTIVEC); + #else + return (getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC); + #endif + }" + HAVE_VMX + ) + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_power8_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set(POWER8FLAG "-mcpu=power8") + endif() + endif() + # Check if we have what we need for POWER8 optimizations + set(CMAKE_REQUIRED_FLAGS "${POWER8FLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + #ifdef __FreeBSD__ + #include + #endif + int main() { + #ifdef __FreeBSD__ + unsigned long hwcap; + elf_aux_info(AT_HWCAP2, &hwcap, sizeof(hwcap)); + return (hwcap & PPC_FEATURE2_ARCH_2_07); + #else + return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07); + #endif + }" + HAVE_POWER8_INTRIN + ) + if(NOT HAVE_POWER8_INTRIN AND HAVE_LINUX_AUXVEC_H) + check_c_source_compiles( + "#include + #include + int main() { + return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07); + }" + HAVE_POWER8_INTRIN2 + ) + if(HAVE_POWER8_INTRIN2) + set(POWER8_NEED_AUXVEC_H 1) + set(HAVE_POWER8_INTRIN ${HAVE_POWER8_INTRIN2} CACHE INTERNAL "Have POWER8 intrinsics" FORCE) + unset(HAVE_POWER8_INTRIN2 CACHE) + endif() + endif() + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_rvv_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set(RISCVFLAG "-march=rv64gcv") + endif() + endif() + # Check whether compiler supports RVV + set(CMAKE_REQUIRED_FLAGS "${RISCVFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + int main() { + return 0; + }" + HAVE_RVV_INTRIN + ) + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_s390_intrinsics) + check_c_source_compiles( + "#include + #ifndef HWCAP_S390_VXRS + #define HWCAP_S390_VXRS (1 << 11) + #endif + int main() { + return (getauxval(AT_HWCAP) & HWCAP_S390_VXRS); + }" + HAVE_S390_INTRIN + ) +endmacro() + +macro(check_power9_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set(POWER9FLAG "-mcpu=power9") + endif() + endif() + # Check if we have what we need for POWER9 optimizations + set(CMAKE_REQUIRED_FLAGS "${POWER9FLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + #ifdef __FreeBSD__ + #include + #endif + int main() { + #ifdef __FreeBSD__ + unsigned long hwcap; + elf_aux_info(AT_HWCAP2, &hwcap, sizeof(hwcap)); + return (hwcap & PPC_FEATURE2_ARCH_3_00); + #else + return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_00); + #endif + }" + HAVE_POWER9_INTRIN + ) + if(NOT HAVE_POWER9_INTRIN AND HAVE_LINUX_AUXVEC_H) + check_c_source_compiles( + "#include + #include + int main() { + return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_00); + }" + HAVE_POWER9_INTRIN2 + ) + if(HAVE_POWER9_INTRIN2) + set(POWER9_NEED_AUXVEC_H 1) + set(HAVE_POWER9_INTRIN ${HAVE_POWER9_INTRIN2} CACHE INTERNAL "Have POWER9 intrinsics" FORCE) + unset(HAVE_POWER9_INTRIN2 CACHE) + endif() + endif() + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_sse2_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE) + set(SSE2FLAG "-msse2") + else() + set(SSE2FLAG "/arch:SSE2") + endif() + elseif(MSVC) + if(NOT "${ARCH}" MATCHES "x86_64") + set(SSE2FLAG "/arch:SSE2") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set(SSE2FLAG "-msse2") + endif() + endif() + # Check whether compiler supports SSE2 intrinsics + set(CMAKE_REQUIRED_FLAGS "${SSE2FLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + __m128i f(__m128i x, __m128i y) { return _mm_sad_epu8(x, y); } + int main(void) { return 0; }" + HAVE_SSE2_INTRIN + ) + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_ssse3_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE) + set(SSSE3FLAG "-mssse3") + else() + set(SSSE3FLAG "/arch:SSSE3") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set(SSSE3FLAG "-mssse3") + endif() + endif() + # Check whether compiler supports SSSE3 intrinsics + set(CMAKE_REQUIRED_FLAGS "${SSSE3FLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + __m128i f(__m128i u) { + __m128i v = _mm_set1_epi32(1); + return _mm_hadd_epi32(u, v); + } + int main(void) { return 0; }" + HAVE_SSSE3_INTRIN + ) +endmacro() + +macro(check_sse42_intrinsics) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE) + set(SSE42FLAG "-msse4.2") + else() + set(SSE42FLAG "/arch:SSE4.2") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set(SSE42FLAG "-msse4.2") + endif() + endif() + # Check whether compiler supports SSE4.2 intrinsics + set(CMAKE_REQUIRED_FLAGS "${SSE42FLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + unsigned int f(unsigned int a, unsigned int b) { return _mm_crc32_u32(a, b); } + int main(void) { return 0; }" + HAVE_SSE42_INTRIN + ) + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_vgfma_intrinsics) + if(NOT NATIVEFLAG) + set(VGFMAFLAG "-march=z13") + if(CMAKE_C_COMPILER_ID MATCHES "GNU") + set(VGFMAFLAG "${VGFMAFLAG} -mzarch") + endif() + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + set(VGFMAFLAG "${VGFMAFLAG} -fzvector") + endif() + endif() + # Check whether compiler supports "VECTOR GALOIS FIELD MULTIPLY SUM AND ACCUMULATE" intrinsic + set(CMAKE_REQUIRED_FLAGS "${VGFMAFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + int main(void) { + unsigned long long a __attribute__((vector_size(16))) = { 0 }; + unsigned long long b __attribute__((vector_size(16))) = { 0 }; + unsigned char c __attribute__((vector_size(16))) = { 0 }; + c = vec_gfmsum_accum_128(a, b, c); + return c[0]; + }" + HAVE_VGFMA_INTRIN FAIL_REGEX "not supported") + set(CMAKE_REQUIRED_FLAGS) +endmacro() + +macro(check_xsave_intrinsics) + if(NOT NATIVEFLAG AND NOT MSVC AND NOT CMAKE_C_COMPILER_ID MATCHES "Intel") + set(XSAVEFLAG "-mxsave") + endif() + set(CMAKE_REQUIRED_FLAGS "${XSAVEFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#ifdef _MSC_VER + # include + #elif __GNUC__ == 8 && __GNUC_MINOR__ > 1 + # include + #else + # include + #endif + unsigned int f(unsigned int a) { return (int) _xgetbv(a); } + int main(void) { return 0; }" + HAVE_XSAVE_INTRIN FAIL_REGEX "not supported") + set(CMAKE_REQUIRED_FLAGS) +endmacro() diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/detect-sanitizer.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/detect-sanitizer.cmake similarity index 67% rename from internal-complibs/zlib-ng-2.0.7/cmake/detect-sanitizer.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/detect-sanitizer.cmake index 8af1f8e0b..f9521ec2f 100644 --- a/internal-complibs/zlib-ng-2.0.7/cmake/detect-sanitizer.cmake +++ b/internal-complibs/zlib-ng-2.2.2/cmake/detect-sanitizer.cmake @@ -1,6 +1,22 @@ # detect-sanitizer.cmake -- Detect supported compiler sanitizer flags # Licensed under the Zlib license, see LICENSE.md for details +macro(add_common_sanitizer_flags) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + add_compile_options(-g3) + endif() + check_c_compiler_flag(-fno-omit-frame-pointer HAVE_NO_OMIT_FRAME_POINTER) + if(HAVE_NO_OMIT_FRAME_POINTER) + add_compile_options(-fno-omit-frame-pointer) + add_link_options(-fno-omit-frame-pointer) + endif() + check_c_compiler_flag(-fno-optimize-sibling-calls HAVE_NO_OPTIMIZE_SIBLING_CALLS) + if(HAVE_NO_OPTIMIZE_SIBLING_CALLS) + add_compile_options(-fno-optimize-sibling-calls) + add_link_options(-fno-optimize-sibling-calls) + endif() +endmacro() + macro(check_sanitizer_support known_checks supported_checks) set(available_checks "") @@ -14,7 +30,7 @@ macro(check_sanitizer_support known_checks supported_checks) set(compile_checks "${available_checks},${check}") endif() - set(CMAKE_REQUIRED_FLAGS "-fsanitize=${compile_checks}") + set(CMAKE_REQUIRED_FLAGS -fsanitize=${compile_checks}) check_c_source_compiles("int main() { return 0; }" HAVE_SANITIZER_${check} FAIL_REGEX "not supported|unrecognized command|unknown option") @@ -39,7 +55,9 @@ macro(add_address_sanitizer) check_sanitizer_support("${known_checks}" supported_checks) if(NOT ${supported_checks} STREQUAL "") message(STATUS "Address sanitizer is enabled: ${supported_checks}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${supported_checks}") + add_compile_options(-fsanitize=${supported_checks}) + add_link_options(-fsanitize=${supported_checks}) + add_common_sanitizer_flags() else() message(STATUS "Address sanitizer is not supported") endif() @@ -52,7 +70,9 @@ macro(add_address_sanitizer) check_sanitizer_support("leak" supported_checks) if(NOT ${supported_checks} STREQUAL "") message(STATUS "Leak sanitizer is enabled: ${supported_checks}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${supported_checks}") + add_compile_options(-fsanitize=${supported_checks}) + add_link_options(-fsanitize=${supported_checks}) + add_common_sanitizer_flags() else() message(STATUS "Leak sanitizer is not supported") endif() @@ -63,7 +83,15 @@ macro(add_memory_sanitizer) check_sanitizer_support("memory" supported_checks) if(NOT ${supported_checks} STREQUAL "") message(STATUS "Memory sanitizer is enabled: ${supported_checks}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${supported_checks}") + add_compile_options(-fsanitize=${supported_checks}) + add_link_options(-fsanitize=${supported_checks}) + add_common_sanitizer_flags() + + check_c_compiler_flag(-fsanitize-memory-track-origins HAVE_MEMORY_TRACK_ORIGINS) + if(HAVE_MEMORY_TRACK_ORIGINS) + add_compile_options(-fsanitize-memory-track-origins) + add_link_options(-fsanitize-memory-track-origins) + endif() else() message(STATUS "Memory sanitizer is not supported") endif() @@ -73,7 +101,9 @@ macro(add_thread_sanitizer) check_sanitizer_support("thread" supported_checks) if(NOT ${supported_checks} STREQUAL "") message(STATUS "Thread sanitizer is enabled: ${supported_checks}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${supported_checks}") + add_compile_options(-fsanitize=${supported_checks}) + add_link_options(-fsanitize=${supported_checks}) + add_common_sanitizer_flags() else() message(STATUS "Thread sanitizer is not supported") endif() @@ -120,14 +150,17 @@ macro(add_undefined_sanitizer) if(NOT ${supported_checks} STREQUAL "") message(STATUS "Undefined behavior sanitizer is enabled: ${supported_checks}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${supported_checks}") + add_compile_options(-fsanitize=${supported_checks}) + add_link_options(-fsanitize=${supported_checks}) # Group sanitizer flag -fsanitize=undefined will automatically add alignment, even if # it is not in our sanitize flag list, so we need to explicitly disable alignment sanitizing. if(WITH_UNALIGNED) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize=alignment") + add_compile_options(-fno-sanitize=alignment) endif() + + add_common_sanitizer_flags() else() - message(STATUS "UNdefined behavior sanitizer is not supported") + message(STATUS "Undefined behavior sanitizer is not supported") endif() endmacro() diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/fallback-macros.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/fallback-macros.cmake new file mode 100644 index 000000000..8bc6cf25b --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/fallback-macros.cmake @@ -0,0 +1,19 @@ +# fallback-macros.cmake -- CMake fallback macros +# Copyright (C) 2022 Nathan Moinvaziri +# Licensed under the Zlib license, see LICENSE.md for details + +# CMake less than version 3.5.2 +if(NOT COMMAND add_compile_options) + macro(add_compile_options options) + string(APPEND CMAKE_C_FLAGS ${options}) + string(APPEND CMAKE_CXX_FLAGS ${options}) + endmacro() +endif() + +# CMake less than version 3.14 +if(NOT COMMAND add_link_options) + macro(add_link_options options) + string(APPEND CMAKE_EXE_LINKER_FLAGS ${options}) + string(APPEND CMAKE_SHARED_LINKER_FLAGS ${options}) + endmacro() +endif() diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/toolchain-aarch64.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-aarch64.cmake similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/cmake/toolchain-aarch64.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/toolchain-aarch64.cmake diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/toolchain-arm.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-arm.cmake similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/cmake/toolchain-arm.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/toolchain-arm.cmake diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/toolchain-armhf.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-armhf.cmake similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/cmake/toolchain-armhf.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/toolchain-armhf.cmake diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-aarch64.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-aarch64.cmake new file mode 100644 index 000000000..4da1e2c79 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-aarch64.cmake @@ -0,0 +1,41 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_C_COMPILER_FRONTEND_VARIANT GNU) +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR wine) + +set(CMAKE_C_COMPILER_TARGET aarch64-w64-mingw32) +set(CMAKE_CXX_COMPILER_TARGET aarch64-w64-mingw32) +set(CMAKE_RC_COMPILER_TARGET aarch64-w64-mingw32) +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +# Required to propagate 'LLVM_MINGW_ROOT' variables to C compiler feature test. +set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES LLVM_MINGW_ROOT) + +if(NOT LLVM_MINGW_ROOT) + set(LLVM_MINGW_ROOT $ENV{LLVM_MINGW_ROOT}) +endif() +cmake_path(CONVERT "${LLVM_MINGW_ROOT}" TO_CMAKE_PATH_LIST LLVM_MINGW_ROOT) + +set(CMAKE_FIND_ROOT_PATH ${LLVM_MINGW_ROOT} ${LLVM_MINGW_ROOT}/aarch64-w64-mingw32) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-clang HINTS ${LLVM_MINGW_ROOT}/bin) +if(NOT C_COMPILER_FULL_PATH) +message(FATAL_ERROR "Compiler for ${CMAKE_C_COMPILER_TARGET} not found. Try setting llvm-mingw root path to LLVM_MINGW_ROOT variable!") +endif() +set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) + +find_program(CXX_COMPILER_FULL_PATH ${CMAKE_CXX_COMPILER_TARGET}-clang++ HINTS ${LLVM_MINGW_ROOT}/bin) +if(CXX_COMPILER_FULL_PATH) + set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) +endif() + +find_program(RC_COMPILER_FULL_PATH ${CMAKE_RC_COMPILER_TARGET}-windres HINTS ${LLVM_MINGW_ROOT}/bin) +if(RC_COMPILER_FULL_PATH) + set(CMAKE_RC_COMPILER ${RC_COMPILER_FULL_PATH}) +endif() + +add_compile_options($<$:-gcodeview>) +add_link_options(-Wl,-pdb=) diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-armv7.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-armv7.cmake new file mode 100644 index 000000000..d077309b8 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-armv7.cmake @@ -0,0 +1,41 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_C_COMPILER_FRONTEND_VARIANT GNU) +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR wine) + +set(CMAKE_C_COMPILER_TARGET armv7-w64-mingw32) +set(CMAKE_CXX_COMPILER_TARGET armv7-w64-mingw32) +set(CMAKE_RC_COMPILER_TARGET armv7-w64-mingw32) +set(CMAKE_SYSTEM_PROCESSOR armv7) + +# Required to propagate 'LLVM_MINGW_ROOT' variables to C compiler feature test. +set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES LLVM_MINGW_ROOT) + +if(NOT LLVM_MINGW_ROOT) + set(LLVM_MINGW_ROOT $ENV{LLVM_MINGW_ROOT}) +endif() +cmake_path(CONVERT "${LLVM_MINGW_ROOT}" TO_CMAKE_PATH_LIST LLVM_MINGW_ROOT) + +set(CMAKE_FIND_ROOT_PATH ${LLVM_MINGW_ROOT} ${LLVM_MINGW_ROOT}/armv7-w64-mingw32) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-clang HINTS ${LLVM_MINGW_ROOT}/bin) +if(NOT C_COMPILER_FULL_PATH) +message(FATAL_ERROR "Compiler for ${CMAKE_C_COMPILER_TARGET} not found. Try setting llvm-mingw root path to LLVM_MINGW_ROOT variable!") +endif() +set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) + +find_program(CXX_COMPILER_FULL_PATH ${CMAKE_CXX_COMPILER_TARGET}-clang++ HINTS ${LLVM_MINGW_ROOT}/bin) +if(CXX_COMPILER_FULL_PATH) + set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) +endif() + +find_program(RC_COMPILER_FULL_PATH ${CMAKE_RC_COMPILER_TARGET}-windres HINTS ${LLVM_MINGW_ROOT}/bin) +if(RC_COMPILER_FULL_PATH) + set(CMAKE_RC_COMPILER ${RC_COMPILER_FULL_PATH}) +endif() + +add_compile_options($<$:-gcodeview>) +add_link_options(-Wl,-pdb=) diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-i686.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-i686.cmake new file mode 100644 index 000000000..17a0aa790 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-i686.cmake @@ -0,0 +1,41 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_C_COMPILER_FRONTEND_VARIANT GNU) +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR wine) + +set(CMAKE_C_COMPILER_TARGET i686-w64-mingw32) +set(CMAKE_CXX_COMPILER_TARGET i686-w64-mingw32) +set(CMAKE_RC_COMPILER_TARGET i686-w64-mingw32) +set(CMAKE_SYSTEM_PROCESSOR i686) + +# Required to propagate 'LLVM_MINGW_ROOT' variables to C compiler feature test. +set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES LLVM_MINGW_ROOT) + +if(NOT LLVM_MINGW_ROOT) + set(LLVM_MINGW_ROOT $ENV{LLVM_MINGW_ROOT}) +endif() +cmake_path(CONVERT "${LLVM_MINGW_ROOT}" TO_CMAKE_PATH_LIST LLVM_MINGW_ROOT) + +set(CMAKE_FIND_ROOT_PATH ${LLVM_MINGW_ROOT} ${LLVM_MINGW_ROOT}/i686-w64-mingw32) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-clang HINTS ${LLVM_MINGW_ROOT}/bin) +if(NOT C_COMPILER_FULL_PATH) + message(FATAL_ERROR "Compiler for ${CMAKE_C_COMPILER_TARGET} not found. Try setting llvm-mingw root path to LLVM_MINGW_ROOT variable!") +endif() +set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) + +find_program(CXX_COMPILER_FULL_PATH ${CMAKE_CXX_COMPILER_TARGET}-clang++ HINTS ${LLVM_MINGW_ROOT}/bin) +if(CXX_COMPILER_FULL_PATH) + set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) +endif() + +find_program(RC_COMPILER_FULL_PATH ${CMAKE_RC_COMPILER_TARGET}-windres HINTS ${LLVM_MINGW_ROOT}/bin) +if(RC_COMPILER_FULL_PATH) + set(CMAKE_RC_COMPILER ${RC_COMPILER_FULL_PATH}) +endif() + +add_compile_options($<$:-gcodeview>) +add_link_options(-Wl,-pdb=) diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-x86_64.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-x86_64.cmake new file mode 100644 index 000000000..e51956241 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-llvm-mingw-x86_64.cmake @@ -0,0 +1,41 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_C_COMPILER_FRONTEND_VARIANT GNU) +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR wine) + +set(CMAKE_C_COMPILER_TARGET x86_64-w64-mingw32) +set(CMAKE_CXX_COMPILER_TARGET x86_64-w64-mingw32) +set(CMAKE_RC_COMPILER_TARGET x86_64-w64-mingw32) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +# Required to propagate 'LLVM_MINGW_ROOT' variables to C compiler feature test. +set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES LLVM_MINGW_ROOT) + +if(NOT LLVM_MINGW_ROOT) + set(LLVM_MINGW_ROOT $ENV{LLVM_MINGW_ROOT}) +endif() +cmake_path(CONVERT "${LLVM_MINGW_ROOT}" TO_CMAKE_PATH_LIST LLVM_MINGW_ROOT) + +set(CMAKE_FIND_ROOT_PATH ${LLVM_MINGW_ROOT} ${LLVM_MINGW_ROOT}/x86_64-w64-mingw32) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-clang HINTS ${LLVM_MINGW_ROOT}/bin) +if(NOT C_COMPILER_FULL_PATH) + message(FATAL_ERROR "Compiler for ${CMAKE_C_COMPILER_TARGET} not found. Try setting llvm-mingw root path to LLVM_MINGW_ROOT variable!") +endif() +set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) + +find_program(CXX_COMPILER_FULL_PATH ${CMAKE_CXX_COMPILER_TARGET}-clang++ HINTS ${LLVM_MINGW_ROOT}/bin) +if(CXX_COMPILER_FULL_PATH) + set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) +endif() + +find_program(RC_COMPILER_FULL_PATH ${CMAKE_RC_COMPILER_TARGET}-windres HINTS ${LLVM_MINGW_ROOT}/bin) +if(RC_COMPILER_FULL_PATH) + set(CMAKE_RC_COMPILER ${RC_COMPILER_FULL_PATH}) +endif() + +add_compile_options($<$:-gcodeview>) +add_link_options(-Wl,-pdb=) diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/toolchain-mingw-i686.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mingw-i686.cmake similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/cmake/toolchain-mingw-i686.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mingw-i686.cmake diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/toolchain-mingw-x86_64.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mingw-x86_64.cmake similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/cmake/toolchain-mingw-x86_64.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mingw-x86_64.cmake diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mips.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mips.cmake new file mode 100644 index 000000000..69a1025e3 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mips.cmake @@ -0,0 +1,29 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR mips) +set(CMAKE_SYSTEM_VERSION 1) + +if(NOT DEFINED CMAKE_C_COMPILER_TARGET) + set(CMAKE_C_COMPILER_TARGET mips-linux-gnu) +endif() +if(NOT DEFINED CMAKE_CXX_COMPILER_TARGET) + set(CMAKE_CXX_COMPILER_TARGET mips-linux-gnu) +endif() + +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR qemu-mips -L /usr/${CMAKE_C_COMPILER_TARGET}/) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) +if(NOT C_COMPILER_FULL_PATH) + message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") +endif() +set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) + +find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) +if(CXX_COMPILER_FULL_PATH) + set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) +endif() diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mips64.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mips64.cmake new file mode 100644 index 000000000..8ef3b6b00 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-mips64.cmake @@ -0,0 +1,29 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR mips64) +set(CMAKE_SYSTEM_VERSION 1) + +if(NOT DEFINED CMAKE_C_COMPILER_TARGET) + set(CMAKE_C_COMPILER_TARGET mips64-linux-gnuabi64) +endif() +if(NOT DEFINED CMAKE_CXX_COMPILER_TARGET) + set(CMAKE_CXX_COMPILER_TARGET mips64-linux-gnuabi64) +endif() + +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR qemu-mips64 -L /usr/${CMAKE_C_COMPILER_TARGET}/) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) +if(NOT C_COMPILER_FULL_PATH) + message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") +endif() +set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) + +find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) +if(CXX_COMPILER_FULL_PATH) + set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) +endif() diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/toolchain-powerpc.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc.cmake similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/cmake/toolchain-powerpc.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc.cmake diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64-clang.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64-clang.cmake new file mode 100644 index 000000000..f986796f6 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64-clang.cmake @@ -0,0 +1,16 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR ppc64) +set(CMAKE_SYSTEM_VERSION 1) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_C_COMPILER_TARGET powerpc64-linux-gnu) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_CXX_COMPILER_TARGET powerpc64-linux-gnu) + +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64 -cpu power9 -L /usr/${CMAKE_C_COMPILER_TARGET}/) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64-power9.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64-power9.cmake new file mode 100644 index 000000000..2ea190a4d --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64-power9.cmake @@ -0,0 +1,25 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR ppc64) +set(CMAKE_SYSTEM_VERSION 1) + +set(CMAKE_C_COMPILER_TARGET powerpc64-linux-gnu) +set(CMAKE_CXX_COMPILER_TARGET powerpc64-linux-gnu) + +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64 -cpu power9 -L /usr/${CMAKE_C_COMPILER_TARGET}/) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) +if(NOT C_COMPILER_FULL_PATH) + message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") +endif() +set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) + +find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) +if(CXX_COMPILER_FULL_PATH) + set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) +endif() diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/toolchain-powerpc64.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64.cmake similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/cmake/toolchain-powerpc64.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64.cmake diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64le-clang.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64le-clang.cmake new file mode 100644 index 000000000..b3423c590 --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64le-clang.cmake @@ -0,0 +1,16 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR ppc64le) +set(CMAKE_SYSTEM_VERSION 1) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_C_COMPILER_TARGET powerpc64le-linux-gnu) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_CXX_COMPILER_TARGET powerpc64le-linux-gnu) + +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64le -cpu power9 -L /usr/${CMAKE_C_COMPILER_TARGET}/) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64le-power9.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64le-power9.cmake new file mode 100644 index 000000000..5ac8c7a9c --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64le-power9.cmake @@ -0,0 +1,25 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR ppc64le) +set(CMAKE_SYSTEM_VERSION 1) + +set(CMAKE_C_COMPILER_TARGET powerpc64le-linux-gnu) +set(CMAKE_CXX_COMPILER_TARGET powerpc64le-linux-gnu) + +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64le -cpu power9 -L /usr/${CMAKE_C_COMPILER_TARGET}/) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +find_program(C_COMPILER_FULL_PATH NAMES ${CMAKE_C_COMPILER_TARGET}-gcc) +if(NOT C_COMPILER_FULL_PATH) + message(FATAL_ERROR "Cross-compiler for ${CMAKE_C_COMPILER_TARGET} not found") +endif() +set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) + +find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++) +if(CXX_COMPILER_FULL_PATH) + set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) +endif() diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/toolchain-powerpc64le.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64le.cmake similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/cmake/toolchain-powerpc64le.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/toolchain-powerpc64le.cmake diff --git a/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-riscv.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-riscv.cmake new file mode 100644 index 000000000..9cf8fdb7f --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-riscv.cmake @@ -0,0 +1,28 @@ +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_PROCESSOR "riscv64") + +# Avoid to use system path for cross-compile +set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH FALSE) + +set(TOOLCHAIN_PATH "" CACHE STRING "The toolchain path.") +if(NOT TOOLCHAIN_PATH) + set(TOOLCHAIN_PATH ${CMAKE_SOURCE_DIR}/prebuilt-riscv-toolchain-qemu/riscv-clang) +endif() + +set(TOOLCHAIN_PREFIX "riscv64-unknown-linux-gnu-" CACHE STRING "The toolchain prefix.") +set(QEMU_PATH "" CACHE STRING "The qemu path.") +if(NOT QEMU_PATH) + set(QEMU_PATH ${CMAKE_SOURCE_DIR}/prebuilt-riscv-toolchain-qemu/riscv-qemu/bin/qemu-riscv64) +endif() + +# toolchain setting +set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}clang") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}clang++") + +# disable auto-vectorizer +add_compile_options(-fno-vectorize -fno-slp-vectorize) + +# emulator setting +set(QEMU_CPU_OPTION "rv64,zba=true,zbb=true,zbc=true,zbs=true,v=true,vlen=512,elen=64,vext_spec=v1.0") +set(CMAKE_CROSSCOMPILING_EMULATOR ${QEMU_PATH} -cpu ${QEMU_CPU_OPTION} -L ${TOOLCHAIN_PATH}/sysroot/) diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/toolchain-s390x.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-s390x.cmake similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/cmake/toolchain-s390x.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/toolchain-s390x.cmake diff --git a/internal-complibs/zlib-ng-2.0.7/cmake/toolchain-sparc64.cmake b/internal-complibs/zlib-ng-2.2.2/cmake/toolchain-sparc64.cmake similarity index 100% rename from internal-complibs/zlib-ng-2.0.7/cmake/toolchain-sparc64.cmake rename to internal-complibs/zlib-ng-2.2.2/cmake/toolchain-sparc64.cmake diff --git a/internal-complibs/zlib-ng-2.2.2/compare256_rle.h b/internal-complibs/zlib-ng-2.2.2/compare256_rle.h new file mode 100644 index 000000000..0f3998d4a --- /dev/null +++ b/internal-complibs/zlib-ng-2.2.2/compare256_rle.h @@ -0,0 +1,134 @@ +/* compare256_rle.h -- 256 byte run-length encoding comparison + * Copyright (C) 2022 Nathan Moinvaziri + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "fallback_builtins.h" + +typedef uint32_t (*compare256_rle_func)(const uint8_t* src0, const uint8_t* src1); + +/* ALIGNED, byte comparison */ +static inline uint32_t compare256_rle_c(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + + do { + if (*src0 != *src1) + return len; + src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src1 += 1, len += 1; + } while (len < 256); + + return 256; +} + +#ifdef UNALIGNED_OK +/* 16-bit unaligned integer comparison */ +static inline uint32_t compare256_rle_unaligned_16(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + uint16_t src0_cmp, src1_cmp; + + memcpy(&src0_cmp, src0, sizeof(src0_cmp)); + + do { + memcpy(&src1_cmp, src1, sizeof(src1_cmp)); + if (src0_cmp != src1_cmp) + return len + (*src0 == *src1); + src1 += 2, len += 2; + memcpy(&src1_cmp, src1, sizeof(src1_cmp)); + if (src0_cmp != src1_cmp) + return len + (*src0 == *src1); + src1 += 2, len += 2; + memcpy(&src1_cmp, src1, sizeof(src1_cmp)); + if (src0_cmp != src1_cmp) + return len + (*src0 == *src1); + src1 += 2, len += 2; + memcpy(&src1_cmp, src1, sizeof(src1_cmp)); + if (src0_cmp != src1_cmp) + return len + (*src0 == *src1); + src1 += 2, len += 2; + } while (len < 256); + + return 256; +} + +#ifdef HAVE_BUILTIN_CTZ +/* 32-bit unaligned integer comparison */ +static inline uint32_t compare256_rle_unaligned_32(const uint8_t *src0, const uint8_t *src1) { + uint32_t sv, len = 0; + uint16_t src0_cmp; + + memcpy(&src0_cmp, src0, sizeof(src0_cmp)); + sv = ((uint32_t)src0_cmp << 16) | src0_cmp; + + do { + uint32_t mv, diff; + + memcpy(&mv, src1, sizeof(mv)); + + diff = sv ^ mv; + if (diff) { + uint32_t match_byte = __builtin_ctz(diff) / 8; + return len + match_byte; + } + + src1 += 4, len += 4; + } while (len < 256); + + return 256; +} + +#endif + +#if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) +/* 64-bit unaligned integer comparison */ +static inline uint32_t compare256_rle_unaligned_64(const uint8_t *src0, const uint8_t *src1) { + uint32_t src0_cmp32, len = 0; + uint16_t src0_cmp; + uint64_t sv; + + memcpy(&src0_cmp, src0, sizeof(src0_cmp)); + src0_cmp32 = ((uint32_t)src0_cmp << 16) | src0_cmp; + sv = ((uint64_t)src0_cmp32 << 32) | src0_cmp32; + + do { + uint64_t mv, diff; + + memcpy(&mv, src1, sizeof(mv)); + + diff = sv ^ mv; + if (diff) { + uint64_t match_byte = __builtin_ctzll(diff) / 8; + return len + (uint32_t)match_byte; + } + + src1 += 8, len += 8; + } while (len < 256); + + return 256; +} + +#endif + +#endif + diff --git a/internal-complibs/zlib-ng-2.0.7/compress.c b/internal-complibs/zlib-ng-2.2.2/compress.c similarity index 86% rename from internal-complibs/zlib-ng-2.0.7/compress.c rename to internal-complibs/zlib-ng-2.2.2/compress.c index 1cf5d5ff1..66118e4f4 100644 --- a/internal-complibs/zlib-ng-2.0.7/compress.c +++ b/internal-complibs/zlib-ng-2.2.2/compress.c @@ -5,11 +5,6 @@ #include "zbuild.h" #include "zutil.h" -#if defined(ZLIB_COMPAT) -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif /* =========================================================================== * Architecture-specific hooks. @@ -33,8 +28,8 @@ memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ -int Z_EXPORT PREFIX(compress2)(unsigned char *dest, z_size_t *destLen, const unsigned char *source, - z_size_t sourceLen, int level) { +int Z_EXPORT PREFIX(compress2)(unsigned char *dest, z_uintmax_t *destLen, const unsigned char *source, + z_uintmax_t sourceLen, int level) { PREFIX3(stream) stream; int err; const unsigned int max = (unsigned int)-1; @@ -68,14 +63,14 @@ int Z_EXPORT PREFIX(compress2)(unsigned char *dest, z_size_t *destLen, const uns err = PREFIX(deflate)(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH); } while (err == Z_OK); - *destLen = (z_size_t)stream.total_out; + *destLen = stream.total_out; PREFIX(deflateEnd)(&stream); return err == Z_STREAM_END ? Z_OK : err; } /* =========================================================================== */ -int Z_EXPORT PREFIX(compress)(unsigned char *dest, z_size_t *destLen, const unsigned char *source, z_size_t sourceLen) { +int Z_EXPORT PREFIX(compress)(unsigned char *dest, z_uintmax_t *destLen, const unsigned char *source, z_uintmax_t sourceLen) { return PREFIX(compress2)(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); } @@ -83,8 +78,8 @@ int Z_EXPORT PREFIX(compress)(unsigned char *dest, z_size_t *destLen, const unsi If the default memLevel or windowBits for deflateInit() is changed, then this function needs to be updated. */ -z_size_t Z_EXPORT PREFIX(compressBound)(z_size_t sourceLen) { - z_size_t complen = DEFLATE_BOUND_COMPLEN(sourceLen); +z_uintmax_t Z_EXPORT PREFIX(compressBound)(z_uintmax_t sourceLen) { + z_uintmax_t complen = DEFLATE_BOUND_COMPLEN(sourceLen); if (complen > 0) /* Architecture-specific code provided an upper bound. */ diff --git a/internal-complibs/zlib-ng-2.0.7/configure b/internal-complibs/zlib-ng-2.2.2/configure similarity index 52% rename from internal-complibs/zlib-ng-2.0.7/configure rename to internal-complibs/zlib-ng-2.2.2/configure index 6e978ebb1..83736bd38 100755 --- a/internal-complibs/zlib-ng-2.0.7/configure +++ b/internal-complibs/zlib-ng-2.2.2/configure @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # configure script for zlib. # # Normally configure builds both a static and a shared library. @@ -29,7 +29,7 @@ if [ -n "${CHOST}" ]; then CROSS_PREFIX="${CHOST}-" ARCH="$(echo "${NORM_CHOST}" | sed -e 's/-.*//')" else - ARCH="`uname -m`" + ARCH="$(uname -m)" fi case "${ARCH}" in @@ -76,6 +76,7 @@ RCFLAGS= RCOBJS= STRIP= ARCHS= +PC_CFLAGS= prefix=${prefix-/usr/local} exec_prefix=${exec_prefix-'${prefix}'} bindir=${bindir-'${exec_prefix}/bin'} @@ -86,34 +87,48 @@ mandir=${mandir-'${prefix}/share/man'} shared_ext='.so' shared=1 gzfileops=1 +unalignedok=1 compat=0 cover=0 build32=0 build64=0 +buildvpclmulqdq=1 buildacle=1 +buildarmv6=1 +buildaltivec=1 +buildpower8=1 +buildpower9=1 buildneon=1 builddfltccdeflate=0 builddfltccinflate=0 -with_sanitizer="" -with_fuzzers=0 +buildcrc32vx=1 floatabi= -native=0 forcesse2=0 -forcetzcnt=0 +# For CPUs that can benefit from AVX512, it seems GCC generates suboptimal +# instruction scheduling unless you specify a reasonable -mtune= target +avx512flag="-mavx512f -mavx512dq -mavx512bw -mavx512vl" +avx512vnniflag="${avx512flag} -mavx512vnni" avx2flag="-mavx2" sse2flag="-msse2" ssse3flag="-mssse3" -sse4flag="-msse4" sse42flag="-msse4.2" pclmulflag="-mpclmul" +vpclmulflag="-mvpclmulqdq -mavx512f" +xsaveflag="-mxsave" acleflag= neonflag= +armv6flag= noltoflag="-fno-lto" +vgfmaflag="-march=z13" +vmxflag="-maltivec" +symbol_prefix="" without_optimizations=0 without_new_strategies=0 +reducedmem=0 gcc=0 warn=0 debug=0 +visibility=1 old_cc="$CC" old_cflags="$CFLAGS" OBJC='$(OBJZ)' @@ -145,55 +160,64 @@ case "$1" in echo ' configure [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log echo ' [--static] [--32] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log + echo ' [--sprefix=SYMBOL_PREFIX] Adds a prefix to all exported symbols' | tee -a configure.log echo ' [--warn] Enables extra compiler warnings' | tee -a configure.log echo ' [--debug] Enables extra debug prints during operation' | tee -a configure.log echo ' [--zlib-compat] Compiles for zlib-compatible API instead of zlib-ng API' | tee -a configure.log - echo ' [--without-gzfileops] Compiles with the gzfile parts of the API enabled' | tee -a configure.log + echo ' [--without-unaligned] Compiles without fast unaligned access' | tee -a configure.log + echo ' [--without-gzfileops] Compiles without the gzfile parts of the API enabled' | tee -a configure.log echo ' [--without-optimizations] Compiles without support for optional instruction sets' | tee -a configure.log echo ' [--without-new-strategies] Compiles without using new additional deflate strategies' | tee -a configure.log echo ' [--without-acle] Compiles without ARM C Language Extensions' | tee -a configure.log echo ' [--without-neon] Compiles without ARM Neon SIMD instruction set' | tee -a configure.log + echo ' [--without-armv6] Compiles without ARMv6 SIMD instruction set' | tee -a configure.log + echo ' [--without-altivec] Compiles without PPC AltiVec support' | tee -a configure.log + echo ' [--without-power8] Compiles without Power8 instruction set' | tee -a configure.log echo ' [--with-dfltcc-deflate] Use DEFLATE CONVERSION CALL instruction for compression on IBM Z' | tee -a configure.log echo ' [--with-dfltcc-inflate] Use DEFLATE CONVERSION CALL instruction for decompression on IBM Z' | tee -a configure.log + echo ' [--without-crc32-vx] Build without vectorized CRC32 on IBM Z' | tee -a configure.log + echo ' [--with-reduced-mem] Reduced memory usage for special cases (reduces performance)' | tee -a configure.log echo ' [--force-sse2] Assume SSE2 instructions are always available (disabled by default on x86, enabled on x86_64)' | tee -a configure.log - echo ' [--force-tzcnt] Assume TZCNT instructions are always available (disabled by default)' | tee -a configure.log - echo ' [--with-sanitizer] Build with sanitizer (memory, address, undefined)' | tee -a configure.log - echo ' [--with-fuzzers] Build test/fuzz (disabled by default)' | tee -a configure.log - echo ' [--native] Compiles with full instruction set supported on this host' | tee -a configure.log exit 0 ;; - -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; - -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; - -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;; - --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;; - -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;; - -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;; + -p*=* | --prefix=*) prefix=$(echo $1 | sed 's/.*=//'); shift ;; + -e*=* | --eprefix=*) exec_prefix=$(echo $1 | sed 's/.*=//'); shift ;; + -m*=* | --sprefix=*) symbol_prefix=$(echo $1 | sed 's/.*=//'); shift ;; + -l*=* | --libdir=*) libdir=$(echo $1 | sed 's/.*=//'); shift ;; + --sharedlibdir=*) sharedlibdir=$(echo $1 | sed 's/.*=//'); shift ;; + -i*=* | --includedir=*) includedir=$(echo $1 | sed 's/.*=//');shift ;; + -u*=* | --uname=*) uname=$(echo $1 | sed 's/.*=//');shift ;; -p* | --prefix) prefix="$2"; shift; shift ;; -e* | --eprefix) exec_prefix="$2"; shift; shift ;; + -m* | --sprefix) symbol_prefix="$2"; shift; shift ;; -l* | --libdir) libdir="$2"; shift; shift ;; -i* | --includedir) includedir="$2"; shift; shift ;; -s* | --shared | --enable-shared) shared=1; shift ;; -t | --static) shared=0; shift ;; --zlib-compat) compat=1; shift ;; + --without-unaligned) unalignedok=0; shift ;; --without-gzfileops) gzfileops=0; shift ;; --cover) cover=1; shift ;; -3* | --32) build32=1; shift ;; -6* | --64) build64=1; shift ;; + --without-vpclmulqdq) buildvpclmulqdq=0; shift ;; --without-acle) buildacle=0; shift ;; --without-neon) buildneon=0; shift ;; + --without-armv6) buildarmv6=0; shift ;; + --without-altivec) buildaltivec=0 ; shift ;; + --without-power8) buildpower8=0 ; shift ;; + --without-power9) buildpower9=0 ; shift ;; --with-dfltcc-deflate) builddfltccdeflate=1; shift ;; --with-dfltcc-inflate) builddfltccinflate=1; shift ;; + --without-crc32-vx) buildcrc32vx=0; shift ;; + --with-reduced-mem) reducedmem=1; shift ;; --force-sse2) forcesse2=1; shift ;; - --force-tzcnt) forcetzcnt=1; shift ;; - -n | --native) native=1; shift ;; - -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; + -a*=* | --archs=*) ARCHS=$(echo $1 | sed 's/.*=//'); shift ;; --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; -noopt | --without-optimizations) without_optimizations=1; shift;; -oldstrat | --without-new-strategies) without_new_strategies=1; shift;; -w* | --warn) warn=1; shift ;; -d* | --debug) debug=1; shift ;; - --with-sanitizer=*) with_sanitizer=`echo $1 | sed 's/.*=//'`; shift ;; - --with-fuzzers) with_fuzzers=1; shift ;; *) echo "unknown option: $1" | tee -a configure.log @@ -208,13 +232,13 @@ test=ztest$$ # put arguments in log, also put test file in log if used in arguments show() { - case "$*" in + case "$@" in *$test.c*) echo "=== $test.c ===" >> configure.log cat $test.c >> configure.log echo "===" >> configure.log;; esac - echo $* >> configure.log + echo "$@" >> configure.log } # check for gcc vs. cc and set compile and link flags based on the system identified by uname @@ -224,26 +248,16 @@ int main() {return getchar();} EOF cc=${CC-${CROSS_PREFIX}gcc} -echo -n "Checking for compiler... " | tee -a configure.log +printf "Checking for compiler... " | tee -a configure.log case "$cc" in *gcc*) gcc=1 ;; *clang*) gcc=1 ;; esac -case `$cc -v 2>&1` in +case $($cc -v 2>&1) in *gcc*) gcc=1 ;; *clang*) gcc=1 ;; esac -if test $native -eq 1; then - avx2flag="" - sse2flag="" - ssse3flag="" - sse4flag="" - sse42flag="" - pclmulflag="" - noltoflag="" -fi - if test $build32 -eq 1; then CFLAGS="${CFLAGS} -m32" SFLAGS="${SFLAGS} -m32" @@ -271,28 +285,30 @@ MAPNAME=${LIBNAME2}.map # extract zlib version numbers from zlib.h if test $compat -eq 0; then - VER=`sed -n -e '/ZLIBNG_VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}/zlib-ng.h` - VER3=`sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}/zlib-ng.h` - VER2=`sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}/zlib-ng.h` - VER1=`sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}/zlib-ng.h` + VER=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}/zlib-ng.h.in) + VER3=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' < ${SRCDIR}/zlib-ng.h.in) + VER2=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\.[0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib-ng.h.in) + VER1=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib-ng.h.in) else - VER=`sed -n -e '/ZLIB_VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}/zlib.h` - VER3=`sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}/zlib.h` - VER2=`sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}/zlib.h` - VER1=`sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}/zlib.h` + VER=$(sed -n -e '/ZLIB_VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}/zlib.h.in) + VER3=$(sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' < ${SRCDIR}/zlib.h.in) + VER2=$(sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\.[0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib.h.in) + VER1=$(sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib.h.in) fi show $cc -c $test.c if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then echo "$cc" | tee -a configure.log CC="$cc" - CFLAGS="${CFLAGS} -std=c99" + if test "${CFLAGS#*"-std="}" = "$CFLAGS" ; then + CFLAGS="${CFLAGS} -std=c11" + fi # Re-check ARCH if the compiler is a cross-compiler. if $CC -print-multiarch 1> /dev/null 2>&1 && test -n "$($CC -print-multiarch)" 1> /dev/null 2>&1; then - CC_ARCH=`$CC $CFLAGS -print-multiarch | sed 's/-.*//g'` + CC_ARCH=$($CC $CFLAGS -print-multiarch | sed 's/-.*//g') else - CC_ARCH=`$CC $CFLAGS -dumpmachine | sed 's/-.*//g'` + CC_ARCH=$($CC $CFLAGS -dumpmachine | sed 's/-.*//g') fi case $CC_ARCH in i386 | i486 | i586 | i686) @@ -308,39 +324,17 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then ARCH=$CC_ARCH fi ;; arm | armeb) - if test $native -eq 0; then - ARCH=arm - else - ARCH=native - fi + ARCH=arm if test "${uname}" = "eabi"; then - # No ACLE support uname=arm - if test $buildacle -eq 1; then - echo ACLE support not available - buildacle=0 - fi - fi - if test $buildacle -eq 1; then - if test $native -eq 0; then - ARCH=armv8-a+crc - fi fi ;; armv8l) - if test $native -eq 0; then - ARCH=armv8-a - else - ARCH=native - fi ;; + ARCH=armv8-a ;; aarch64 | aarch64_be | arm64) if test "${uname}" = "elf"; then uname=aarch64 fi - if test $native -eq 0; then - ARCH=aarch64 - else - ARCH=native - fi ;; + ARCH=aarch64 ;; powerpc | ppc) ARCH=powerpc ;; powerpc64 | ppc64) @@ -355,35 +349,29 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then fi CFLAGS="${CFLAGS} -Wall" SFLAGS="${CFLAGS} -fPIC" - if test $native -eq 1; then - case $ARCH in - powerpc*) - NATIVE_FLAG="-mcpu=native" ;; - *) - NATIVE_FLAG="-march=native" ;; - esac - CFLAGS="${CFLAGS} ${NATIVE_FLAG}" - SFLAGS="${SFLAGS} ${NATIVE_FLAG}" - fi if test "$warn" -eq 1; then - CFLAGS="${CFLAGS} -Wextra -Wpedantic -Wno-implicit-fallthrough" + CFLAGS="${CFLAGS} -Wextra" fi if test $debug -eq 1; then CFLAGS="${CFLAGS} -DZLIB_DEBUG" SFLAGS="${SFLAGS} -DZLIB_DEBUG" + else + CFLAGS="${CFLAGS} -DNDEBUG" + SFLAGS="${SFLAGS} -DNDEBUG" fi if test -z "$uname"; then - uname=`(uname -s || echo unknown) 2>/dev/null` + uname=$( (uname -s || echo unknown) 2>/dev/null) fi case "$uname" in Linux* | linux* | GNU | GNU/* | solaris*) LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1},--version-script,${SRCDIR}/${MAPNAME}" ;; + LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1}" ;; *BSD | *bsd* | DragonFly) LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1},--version-script,${SRCDIR}/${MAPNAME}" + LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1}" LDCONFIG="ldconfig -m" ;; CYGWIN* | Cygwin* | cygwin*) + visibility=0 ARFLAGS="rcs" SFLAGS="${CFLAGS}" shared_ext='.dll' @@ -398,14 +386,18 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then SHAREDTARGET=$SHAREDLIB IMPORTLIB="${LIBNAME}.dll.a" LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB},--version-script,${SRCDIR}/${MAPNAME}" + LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB}" LDSHAREDLIBC="" - DEFFILE='win32/${LIBNAME2}.def' + if test $gzfileops -eq 0; then + DEFFILE='win32/${LIBNAME2}.def' + fi RC="${CROSS_PREFIX}windres" + RCFLAGS="-I ${BUILDDIR}" RCOBJS='zlibrc.o' STRIP="${CROSS_PREFIX}strip" EXE='.exe' ;; MSYS* | msys*) + visibility=0 ARFLAGS="rcs" SFLAGS="${CFLAGS}" shared_ext='.dll' @@ -422,12 +414,16 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then LDSHARED=${LDSHARED-"$cc"} LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB}" LDSHAREDLIBC="" - DEFFILE='win32/${LIBNAME2}.def' + if test $gzfileops -eq 0; then + DEFFILE='win32/${LIBNAME2}.def' + fi RC="${CROSS_PREFIX}windres" + RCFLAGS="-I ${BUILDDIR}" RCOBJS='zlibrc.o' STRIP="${CROSS_PREFIX}strip" EXE='.exe' ;; MINGW* | mingw*) + visibility=0 ARFLAGS="rcs" CFLAGS="${CFLAGS} -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1 -Wno-pedantic-ms-format" SFLAGS="${CFLAGS}" @@ -439,11 +435,14 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then SHAREDTARGET=$SHAREDLIB IMPORTLIB="${LIBNAME}.dll.a" LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,--out-implib=${IMPORTLIB} -Wl,--version-script=${SRCDIR}/${MAPNAME}" + LDSHAREDFLAGS="-shared -Wl,--out-implib=${IMPORTLIB}" LDSHAREDLIBC="" - DEFFILE='win32/${LIBNAME2}.def' + if test $gzfileops -eq 0; then + DEFFILE='win32/${LIBNAME2}.def' + fi RC="${CROSS_PREFIX}windres" - if [ "$CC" == "mingw32-gcc" ]; then + RCFLAGS="-I ${BUILDDIR}" + if [ "$CC" = "mingw32-gcc" ]; then case $ARCH in i386 | i486 | i586 | i686) RCFLAGS="${RCFLAGS} -F pe-i386";; esac; @@ -458,7 +457,7 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then HP-UX*) LDSHARED=${LDSHARED-"$cc"} LDSHAREDFLAGS="-shared" - case `(uname -m || echo unknown) 2>/dev/null` in + case $( (uname -m || echo unknown) 2>/dev/null) in ia64) shared_ext='.so' SHAREDLIB='${LIBNAME}.so' ;; @@ -473,8 +472,10 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then SHAREDLIBM=${LIBNAME}.$VER1$shared_ext SHAREDTARGET=$SHAREDLIBV LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3" - if libtool -V 2>&1 | grep Apple > /dev/null; then + LDSHAREDFLAGS="-dynamiclib -install_name @rpath/${SHAREDLIBM} -compatibility_version ${VER1} -current_version ${VER3}" + if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then + AR="${CROSS_PREFIX}libtool" + elif libtool -V 2>&1 | grep Apple > /dev/null; then AR="libtool" else AR="/usr/bin/libtool" @@ -482,7 +483,7 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then ARFLAGS="-o" ;; aarch64) LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1} -Wl,--version-script,${SRCDIR}/${MAPNAME}" + LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1}" LDSHAREDLIBC="-Wl,--start-group -lc -lrdimon -Wl,--end-group" ;; *) LDSHARED=${LDSHARED-"$cc"} @@ -494,14 +495,14 @@ else gcc=0 echo "$CC" | tee -a configure.log if test -z "$uname"; then - uname=`(uname -sr || echo unknown) 2>/dev/null` + uname=$( (uname -sr || echo unknown) 2>/dev/null) fi case "$uname" in HP-UX*) SFLAGS=${CFLAGS-"-O +z"} CFLAGS=${CFLAGS-"-O"} LDSHARED=${LDSHARED-"ld"} LDSHAREDFLAGS="-b" - case `(uname -m || echo unknown) 2>/dev/null` in + case $( (uname -m || echo unknown) 2>/dev/null) in ia64) shared_ext='.so' SHAREDLIB='${LIBNAME}.so' ;; @@ -522,6 +523,22 @@ else esac fi +# Symbol versioning +case "$uname" in + CYGWIN* | Cygwin* | cygwin* | MINGW* | mingw* | MSYS* | msys* | Darwin* | darwin*) + echo "Checking for Symbol versioning... No." + ;; + *) + if test $shared -eq 1; then + echo "Checking for Symbol versioning... Yes." + CFLAGS="${CFLAGS} -DHAVE_SYMVER" + SFLAGS="${SFLAGS} -DHAVE_SYMVER" + else + echo "Checking for Symbol versioning... No." + fi + ;; +esac + # Simplify some later conditionals case "$uname" in Linux* | linux*) @@ -546,15 +563,15 @@ EOF if ($CC -c $CFLAGS $test.c) 2>/dev/null; then try() { - show $* - test "`( $* ) 2>&1 | tee -a configure.log`" = "" + show "$@" + test "$( ("$@") 2>&1 | tee -a configure.log)" = "" } echo - using any output from compiler to indicate an error >> configure.log else try() { - show $* - ( $* ) >> configure.log 2>&1 + show "$@" + ( "$@" ) >> configure.log 2>&1 ret=$? if test $ret -ne 0; then echo "(exit code $ret)" >> configure.log @@ -576,89 +593,15 @@ fi echo >> configure.log -if test "$with_sanitizer" = "address"; then - echo -n "Checking for address sanitizer... " | tee -a configure.log - sanitizers="" - for san in address pointer-compare pointer-subtract; do - if try $CC -c $CFLAGS $test.c -fsanitize=$san ; then - if test -n "$sanitizers"; then - sanitizers="$sanitizers,$san" - else - sanitizers="$san" - fi - fi - done - - if test -n "$sanitizers"; then - echo "-fsanitize=$sanitizers" | tee -a configure.log - CFLAGS="$CFLAGS -fsanitize=$sanitizers" - SFLAGS="$SFLAGS -fsanitize=$sanitizers" - LDFLAGS="$LDFLAGS -fsanitize=$sanitizers" - else - echo No | tee -a configure.log - fi - - echo -n "Checking for leak sanitizer... " | tee -a configure.log - if try $CC -c $CFLAGS $test.c -fsanitize=leak; then - echo "-fsanitize=leak" | tee -a configure.log - CFLAGS="$CFLAGS -fsanitize=leak" - SFLAGS="$SFLAGS -fsanitize=leak" - LDFLAGS="$LDFLAGS -fsanitize=leak" - else - echo No | tee -a configure.log - fi - - echo >> configure.log -fi - -if test "$with_sanitizer" = "memory"; then - echo -n "Checking for memory sanitizer... " | tee -a configure.log - if try $CC -c $CFLAGS $test.c -fsanitize=memory ; then - echo "-fsanitize=memory" | tee -a configure.log - CFLAGS="$CFLAGS -fsanitize=memory" - SFLAGS="$SFLAGS -fsanitize=memory" - LDFLAGS="$LDFLAGS -fsanitize=memory" - else - echo No | tee -a configure.log - fi - - echo >> configure.log -fi - -if test "$with_sanitizer" = "undefined"; then - echo -n "Checking for undefined behavior sanitizer... " | tee -a configure.log - sanitizers="" - for san in array-bounds bool bounds builtin enum float-cast-overflow float-divide-by-zero function integer-divide-by-zero local-bounds null nonnull-attribute object-size pointer-overflow return returns-nonnull-attribute shift shift-base shift-exponent signed-integer-overflow undefined unsigned-integer-overflow unsigned-shift-base vla-bound vptr; do - if try $CC -c $CFLAGS $test.c -fsanitize=$san; then - if test -n "$sanitizers"; then - sanitizers="$sanitizers,$san" - else - sanitizers="$san" - fi - fi - done - - if test -n "$sanitizers"; then - echo "-fsanitize=$sanitizers" | tee -a configure.log - CFLAGS="$CFLAGS -fsanitize=$sanitizers" - SFLAGS="$SFLAGS -fsanitize=$sanitizers" - LDFLAGS="$LDFLAGS -fsanitize=$sanitizers" - else - echo No | tee -a configure.log - fi - - echo >> configure.log -fi - # see if shared library build supported cat > $test.c <> configure.log +# check for version script support +cat > $test.c < $test.map <> configure.log + # check for large file support, and if none, check for fseeko() cat > $test.c < @@ -783,9 +749,41 @@ else echo "Checking for strerror... No." | tee -a configure.log fi -# We need to remove zconf.h from source directory if building outside of it +# check for getauxval() or elf_aux_info() for architecture feature detection at run-time +cat > $test.c < +int main() { +#ifdef __FreeBSD__ + int test; + return elf_aux_info(AT_PAGESZ, &test, sizeof(test)); +#else + return getauxval(0); +#endif +} +EOF +if try $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then + echo "Checking for getauxval() or elf_aux_info() in sys/auxv.h... Yes." | tee -a configure.log + CFLAGS="${CFLAGS} -DHAVE_SYS_AUXV_H" + SFLAGS="${SFLAGS} -DHAVE_SYS_AUXV_H" +else + echo "Checking for getauxval() in sys/auxv.h... No." | tee -a configure.log +fi + +# We need to remove consigured files (zconf.h etc) from source directory if building outside of it if [ "$SRCDIR" != "$BUILDDIR" ]; then rm -f $SRCDIR/zconf${SUFFIX}.h + rm -f $SRCDIR/zlib${SUFFIX}.h + rm -f $SRCDIR/zlib_name_mangling${SUFFIX}.h +fi + +# Rename @ZLIB_SYMBOL_PREFIX@ to $symbol_prefix in gzread.c, zlib.h and zlib_name_mangling.h +sed < $SRCDIR/gzread.c.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > gzread.c +sed < $SRCDIR/zlib${SUFFIX}.h.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > zlib${SUFFIX}.h +if [ ! -z "$symbol_prefix" ]; then + sed < $SRCDIR/zlib_name_mangling${SUFFIX}.h.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > zlib_name_mangling${SUFFIX}.h +else + # symbol_prefix is not set, copy the empty mangling header + cp -p $SRCDIR/zlib_name_mangling.h.empty zlib_name_mangling${SUFFIX}.h fi # copy clean zconf.h for subsequent edits @@ -811,7 +809,7 @@ fi echo >> configure.log # check for ptrdiff_t and save result in zconf.h -echo -n "Checking for ptrdiff_t... " | tee -a configure.log +printf "Checking for ptrdiff_t... " | tee -a configure.log cat > $test.c < int fun(ptrdiff_t *a) { (void)a; return 0; } @@ -823,7 +821,7 @@ else sed < zconf${SUFFIX}.h "/^#ifdef NEED_PTRDIFF_T.* may be/s/def NEED_PTRDIFF_T\(.*\) may be/ 1\1 was/" > zconf${SUFFIX}.temp.h mv zconf${SUFFIX}.temp.h zconf${SUFFIX}.h - echo -n "Checking for sizeof(void *)... " | tee -a configure.log + printf "Checking for sizeof(void *)... " | tee -a configure.log cat > $test.c < #define COMPILE_TIME_ASSERT(pred) struct s { int x: (pred) ? 1 : -1; } @@ -861,12 +859,33 @@ if test $compat -eq 1; then esac fi +if [ ! -z "$DEFFILE" ]; then + mkdir -p win32 + sed < $SRCDIR/$DEFFILE.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > $DEFFILE +fi + # if --gzfileops was requested if test $gzfileops -eq 1; then CFLAGS="${CFLAGS} -DWITH_GZFILEOP" SFLAGS="${SFLAGS} -DWITH_GZFILEOP" OBJC="${OBJC} \$(OBJG)" PIC_OBJC="${PIC_OBJC} \$(PIC_OBJG)" +else + TESTOBJG="\$(OBJG)" + PIC_TESTOBJG="\$(OBJG)" +fi + +# set architecture alignment requirements +if test $unalignedok -eq 0; then + CFLAGS="${CFLAGS} -DNO_UNALIGNED" + SFLAGS="${SFLAGS} -DNO_UNALIGNED" + echo "Unaligned reads manually disabled." | tee -a configure.log +fi + +# enable reduced memory configuration +if test $reducedmem -eq 1; then + echo "Configuring for reduced memory environment." | tee -a configure.log + CFLAGS="${CFLAGS} -DHASH_SIZE=32768u -DGZBUFSIZE=8192 -DNO_LIT_MEM" fi # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X @@ -915,7 +934,7 @@ else fi # Check for -fno-lto compiler support -if test $gcc -eq 1 -a $without_optimizations -eq 0 -a $native -eq 0; then +if test $gcc -eq 1 -a $without_optimizations -eq 0; then cat > $test.c <