zstd-native-ruby 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CLAUDE.md +101 -0
- data/LICENSE +19 -0
- data/README.md +47 -0
- data/ext/zstd_ruby/extconf.rb +35 -0
- data/ext/zstd_ruby/zstd_ruby.c +221 -0
- data/lib/zstd_ruby.rb +68 -0
- data/vendor/zstd/CHANGELOG +863 -0
- data/vendor/zstd/CMakeLists.txt +11 -0
- data/vendor/zstd/CODE_OF_CONDUCT.md +5 -0
- data/vendor/zstd/CONTRIBUTING.md +494 -0
- data/vendor/zstd/COPYING +339 -0
- data/vendor/zstd/LICENSE +30 -0
- data/vendor/zstd/Makefile +470 -0
- data/vendor/zstd/Package.swift +36 -0
- data/vendor/zstd/README.md +244 -0
- data/vendor/zstd/SECURITY.md +15 -0
- data/vendor/zstd/TESTING.md +43 -0
- data/vendor/zstd/build/LICENSE +0 -0
- data/vendor/zstd/build/README.md +56 -0
- data/vendor/zstd/build/VS2008/fullbench/fullbench.vcproj +549 -0
- data/vendor/zstd/build/VS2008/fuzzer/fuzzer.vcproj +585 -0
- data/vendor/zstd/build/VS2008/zstd/zstd.vcproj +677 -0
- data/vendor/zstd/build/VS2008/zstd.sln +56 -0
- data/vendor/zstd/build/VS2008/zstdlib/zstdlib.vcproj +635 -0
- data/vendor/zstd/build/VS2010/CompileAsCpp.props +8 -0
- data/vendor/zstd/build/VS2010/datagen/datagen.vcxproj +170 -0
- data/vendor/zstd/build/VS2010/fullbench/fullbench.vcxproj +220 -0
- data/vendor/zstd/build/VS2010/fuzzer/fuzzer.vcxproj +224 -0
- data/vendor/zstd/build/VS2010/libzstd/libzstd.vcxproj +243 -0
- data/vendor/zstd/build/VS2010/libzstd-dll/libzstd-dll.rc +51 -0
- data/vendor/zstd/build/VS2010/libzstd-dll/libzstd-dll.vcxproj +250 -0
- data/vendor/zstd/build/VS2010/zstd/zstd.rc +51 -0
- data/vendor/zstd/build/VS2010/zstd/zstd.vcxproj +266 -0
- data/vendor/zstd/build/VS2010/zstd.sln +84 -0
- data/vendor/zstd/build/VS_scripts/README.md +64 -0
- data/vendor/zstd/build/VS_scripts/build.VS2010.cmd +7 -0
- data/vendor/zstd/build/VS_scripts/build.VS2012.cmd +6 -0
- data/vendor/zstd/build/VS_scripts/build.VS2013.cmd +7 -0
- data/vendor/zstd/build/VS_scripts/build.VS2015.cmd +7 -0
- data/vendor/zstd/build/VS_scripts/build.VS2017.cmd +7 -0
- data/vendor/zstd/build/VS_scripts/build.VS2017Community.cmd +7 -0
- data/vendor/zstd/build/VS_scripts/build.VS2017Enterprise.cmd +7 -0
- data/vendor/zstd/build/VS_scripts/build.VS2017Professional.cmd +7 -0
- data/vendor/zstd/build/VS_scripts/build.VSPreview.cmd +7 -0
- data/vendor/zstd/build/VS_scripts/build.generic.cmd +67 -0
- data/vendor/zstd/build/cmake/CMakeLists.txt +81 -0
- data/vendor/zstd/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake +138 -0
- data/vendor/zstd/build/cmake/CMakeModules/FindLibLZ4.cmake +49 -0
- data/vendor/zstd/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake +10 -0
- data/vendor/zstd/build/cmake/CMakeModules/JoinPaths.cmake +23 -0
- data/vendor/zstd/build/cmake/CMakeModules/ZstdBuild.cmake +42 -0
- data/vendor/zstd/build/cmake/CMakeModules/ZstdDependencies.cmake +30 -0
- data/vendor/zstd/build/cmake/CMakeModules/ZstdOptions.cmake +68 -0
- data/vendor/zstd/build/cmake/CMakeModules/ZstdPackage.cmake +42 -0
- data/vendor/zstd/build/cmake/CMakeModules/ZstdVersion.cmake +31 -0
- data/vendor/zstd/build/cmake/README.md +155 -0
- data/vendor/zstd/build/cmake/contrib/CMakeLists.txt +13 -0
- data/vendor/zstd/build/cmake/contrib/gen_html/CMakeLists.txt +30 -0
- data/vendor/zstd/build/cmake/contrib/pzstd/CMakeLists.txt +39 -0
- data/vendor/zstd/build/cmake/lib/CMakeLists.txt +298 -0
- data/vendor/zstd/build/cmake/lib/cmake_uninstall.cmake.in +22 -0
- data/vendor/zstd/build/cmake/programs/CMakeLists.txt +144 -0
- data/vendor/zstd/build/cmake/tests/CMakeLists.txt +118 -0
- data/vendor/zstd/build/cmake/zstdConfig.cmake.in +10 -0
- data/vendor/zstd/build/meson/GetZstdLibraryVersion.py +39 -0
- data/vendor/zstd/build/meson/InstallSymlink.py +55 -0
- data/vendor/zstd/build/meson/README.md +38 -0
- data/vendor/zstd/build/meson/contrib/gen_html/meson.build +30 -0
- data/vendor/zstd/build/meson/contrib/meson.build +12 -0
- data/vendor/zstd/build/meson/contrib/pzstd/meson.build +25 -0
- data/vendor/zstd/build/meson/lib/meson.build +175 -0
- data/vendor/zstd/build/meson/meson.build +155 -0
- data/vendor/zstd/build/meson/meson_options.txt +36 -0
- data/vendor/zstd/build/meson/programs/meson.build +124 -0
- data/vendor/zstd/build/meson/tests/meson.build +217 -0
- data/vendor/zstd/build/meson/tests/valgrindTest.py +90 -0
- data/vendor/zstd/build/single_file_libs/README.md +33 -0
- data/vendor/zstd/build/single_file_libs/build_decoder_test.sh +91 -0
- data/vendor/zstd/build/single_file_libs/build_library_test.sh +98 -0
- data/vendor/zstd/build/single_file_libs/combine.py +234 -0
- data/vendor/zstd/build/single_file_libs/combine.sh +249 -0
- data/vendor/zstd/build/single_file_libs/create_single_file_decoder.sh +19 -0
- data/vendor/zstd/build/single_file_libs/create_single_file_library.sh +19 -0
- data/vendor/zstd/build/single_file_libs/examples/README.md +11 -0
- data/vendor/zstd/build/single_file_libs/examples/emscripten.c +340 -0
- data/vendor/zstd/build/single_file_libs/examples/roundtrip.c +83 -0
- data/vendor/zstd/build/single_file_libs/examples/shell.html +31 -0
- data/vendor/zstd/build/single_file_libs/examples/simple.c +75 -0
- data/vendor/zstd/build/single_file_libs/examples/testcard-dxt1.inl +2731 -0
- data/vendor/zstd/build/single_file_libs/examples/testcard-zstd.inl +261 -0
- data/vendor/zstd/build/single_file_libs/examples/testcard.png +0 -0
- data/vendor/zstd/build/single_file_libs/zstd-in.c +91 -0
- data/vendor/zstd/build/single_file_libs/zstddeclib-in.c +62 -0
- data/vendor/zstd/contrib/VS2005/README.md +3 -0
- data/vendor/zstd/contrib/VS2005/fullbench/fullbench.vcproj +440 -0
- data/vendor/zstd/contrib/VS2005/fuzzer/fuzzer.vcproj +488 -0
- data/vendor/zstd/contrib/VS2005/zstd/zstd.vcproj +552 -0
- data/vendor/zstd/contrib/VS2005/zstd.sln +55 -0
- data/vendor/zstd/contrib/VS2005/zstdlib/zstdlib.vcproj +546 -0
- data/vendor/zstd/contrib/cleanTabs +2 -0
- data/vendor/zstd/contrib/diagnose_corruption/Makefile +35 -0
- data/vendor/zstd/contrib/diagnose_corruption/check_flipped_bits.c +400 -0
- data/vendor/zstd/contrib/docker/Dockerfile +20 -0
- data/vendor/zstd/contrib/docker/README.md +20 -0
- data/vendor/zstd/contrib/externalSequenceProducer/Makefile +40 -0
- data/vendor/zstd/contrib/externalSequenceProducer/README.md +14 -0
- data/vendor/zstd/contrib/externalSequenceProducer/main.c +108 -0
- data/vendor/zstd/contrib/externalSequenceProducer/sequence_producer.c +80 -0
- data/vendor/zstd/contrib/externalSequenceProducer/sequence_producer.h +26 -0
- data/vendor/zstd/contrib/freestanding_lib/freestanding.py +774 -0
- data/vendor/zstd/contrib/gen_html/Makefile +51 -0
- data/vendor/zstd/contrib/gen_html/README.md +31 -0
- data/vendor/zstd/contrib/gen_html/gen-zstd-manual.sh +9 -0
- data/vendor/zstd/contrib/gen_html/gen_html.cpp +225 -0
- data/vendor/zstd/contrib/largeNbDicts/Makefile +58 -0
- data/vendor/zstd/contrib/largeNbDicts/README.md +33 -0
- data/vendor/zstd/contrib/largeNbDicts/largeNbDicts.c +1087 -0
- data/vendor/zstd/contrib/linux-kernel/Makefile +108 -0
- data/vendor/zstd/contrib/linux-kernel/README.md +14 -0
- data/vendor/zstd/contrib/linux-kernel/btrfs-benchmark.sh +104 -0
- data/vendor/zstd/contrib/linux-kernel/btrfs-extract-benchmark.sh +99 -0
- data/vendor/zstd/contrib/linux-kernel/decompress_sources.h +34 -0
- data/vendor/zstd/contrib/linux-kernel/linux.mk +44 -0
- data/vendor/zstd/contrib/linux-kernel/linux_zstd.h +691 -0
- data/vendor/zstd/contrib/linux-kernel/mem.h +262 -0
- data/vendor/zstd/contrib/linux-kernel/squashfs-benchmark.sh +39 -0
- data/vendor/zstd/contrib/linux-kernel/test/Makefile +49 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/compiler.h +23 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/errno.h +15 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/kernel.h +19 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/limits.h +15 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/math64.h +15 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/module.h +20 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/printk.h +15 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/stddef.h +15 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/swab.h +16 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/types.h +16 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/unaligned.h +187 -0
- data/vendor/zstd/contrib/linux-kernel/test/include/linux/xxhash.h +745 -0
- data/vendor/zstd/contrib/linux-kernel/test/macro-test.sh +44 -0
- data/vendor/zstd/contrib/linux-kernel/test/static_test.c +52 -0
- data/vendor/zstd/contrib/linux-kernel/test/test.c +229 -0
- data/vendor/zstd/contrib/linux-kernel/zstd_common_module.c +29 -0
- data/vendor/zstd/contrib/linux-kernel/zstd_compress_module.c +286 -0
- data/vendor/zstd/contrib/linux-kernel/zstd_decompress_module.c +141 -0
- data/vendor/zstd/contrib/linux-kernel/zstd_deps.h +121 -0
- data/vendor/zstd/contrib/match_finders/README.md +42 -0
- data/vendor/zstd/contrib/match_finders/zstd_edist.c +558 -0
- data/vendor/zstd/contrib/match_finders/zstd_edist.h +70 -0
- data/vendor/zstd/contrib/premake/premake4.lua +6 -0
- data/vendor/zstd/contrib/premake/zstd.lua +81 -0
- data/vendor/zstd/contrib/pzstd/BUCK +72 -0
- data/vendor/zstd/contrib/pzstd/ErrorHolder.h +54 -0
- data/vendor/zstd/contrib/pzstd/Logging.h +73 -0
- data/vendor/zstd/contrib/pzstd/Makefile +265 -0
- data/vendor/zstd/contrib/pzstd/Options.cpp +424 -0
- data/vendor/zstd/contrib/pzstd/Options.h +71 -0
- data/vendor/zstd/contrib/pzstd/Pzstd.cpp +626 -0
- data/vendor/zstd/contrib/pzstd/Pzstd.h +153 -0
- data/vendor/zstd/contrib/pzstd/README.md +56 -0
- data/vendor/zstd/contrib/pzstd/SkippableFrame.cpp +30 -0
- data/vendor/zstd/contrib/pzstd/SkippableFrame.h +64 -0
- data/vendor/zstd/contrib/pzstd/images/Cspeed.png +0 -0
- data/vendor/zstd/contrib/pzstd/images/Dspeed.png +0 -0
- data/vendor/zstd/contrib/pzstd/main.cpp +27 -0
- data/vendor/zstd/contrib/pzstd/test/BUCK +37 -0
- data/vendor/zstd/contrib/pzstd/test/OptionsTest.cpp +536 -0
- data/vendor/zstd/contrib/pzstd/test/PzstdTest.cpp +147 -0
- data/vendor/zstd/contrib/pzstd/test/RoundTrip.h +86 -0
- data/vendor/zstd/contrib/pzstd/test/RoundTripTest.cpp +84 -0
- data/vendor/zstd/contrib/pzstd/utils/BUCK +75 -0
- data/vendor/zstd/contrib/pzstd/utils/Buffer.h +99 -0
- data/vendor/zstd/contrib/pzstd/utils/FileSystem.h +96 -0
- data/vendor/zstd/contrib/pzstd/utils/Likely.h +28 -0
- data/vendor/zstd/contrib/pzstd/utils/Portability.h +16 -0
- data/vendor/zstd/contrib/pzstd/utils/Range.h +133 -0
- data/vendor/zstd/contrib/pzstd/utils/ResourcePool.h +96 -0
- data/vendor/zstd/contrib/pzstd/utils/ScopeGuard.h +50 -0
- data/vendor/zstd/contrib/pzstd/utils/ThreadPool.h +58 -0
- data/vendor/zstd/contrib/pzstd/utils/WorkQueue.h +182 -0
- data/vendor/zstd/contrib/pzstd/utils/test/BUCK +35 -0
- data/vendor/zstd/contrib/pzstd/utils/test/BufferTest.cpp +89 -0
- data/vendor/zstd/contrib/pzstd/utils/test/RangeTest.cpp +82 -0
- data/vendor/zstd/contrib/pzstd/utils/test/ResourcePoolTest.cpp +72 -0
- data/vendor/zstd/contrib/pzstd/utils/test/ScopeGuardTest.cpp +28 -0
- data/vendor/zstd/contrib/pzstd/utils/test/ThreadPoolTest.cpp +71 -0
- data/vendor/zstd/contrib/pzstd/utils/test/WorkQueueTest.cpp +282 -0
- data/vendor/zstd/contrib/recovery/Makefile +35 -0
- data/vendor/zstd/contrib/recovery/recover_directory.c +152 -0
- data/vendor/zstd/contrib/seekable_format/README.md +42 -0
- data/vendor/zstd/contrib/seekable_format/examples/Makefile +55 -0
- data/vendor/zstd/contrib/seekable_format/examples/parallel_compression.c +254 -0
- data/vendor/zstd/contrib/seekable_format/examples/parallel_processing.c +191 -0
- data/vendor/zstd/contrib/seekable_format/examples/seekable_compression.c +136 -0
- data/vendor/zstd/contrib/seekable_format/examples/seekable_decompression.c +141 -0
- data/vendor/zstd/contrib/seekable_format/examples/seekable_decompression_mem.c +147 -0
- data/vendor/zstd/contrib/seekable_format/tests/Makefile +58 -0
- data/vendor/zstd/contrib/seekable_format/tests/seekable_tests.c +375 -0
- data/vendor/zstd/contrib/seekable_format/zstd_seekable.h +226 -0
- data/vendor/zstd/contrib/seekable_format/zstd_seekable_compression_format.md +116 -0
- data/vendor/zstd/contrib/seekable_format/zstdseek_compress.c +365 -0
- data/vendor/zstd/contrib/seekable_format/zstdseek_decompress.c +600 -0
- data/vendor/zstd/contrib/seqBench/Makefile +58 -0
- data/vendor/zstd/contrib/seqBench/seqBench.c +53 -0
- data/vendor/zstd/contrib/snap/snapcraft.yaml +28 -0
- data/vendor/zstd/doc/README.md +26 -0
- data/vendor/zstd/doc/decompressor_errata.md +148 -0
- data/vendor/zstd/doc/decompressor_permissive.md +80 -0
- data/vendor/zstd/doc/educational_decoder/Makefile +62 -0
- data/vendor/zstd/doc/educational_decoder/README.md +36 -0
- data/vendor/zstd/doc/educational_decoder/harness.c +119 -0
- data/vendor/zstd/doc/educational_decoder/zstd_decompress.c +2323 -0
- data/vendor/zstd/doc/educational_decoder/zstd_decompress.h +61 -0
- data/vendor/zstd/doc/images/CSpeed2.png +0 -0
- data/vendor/zstd/doc/images/DCspeed5.png +0 -0
- data/vendor/zstd/doc/images/DSpeed3.png +0 -0
- data/vendor/zstd/doc/images/cdict_v136.png +0 -0
- data/vendor/zstd/doc/images/dict-cr.png +0 -0
- data/vendor/zstd/doc/images/dict-cs.png +0 -0
- data/vendor/zstd/doc/images/dict-ds.png +0 -0
- data/vendor/zstd/doc/images/zstd_cdict_v1_3_5.png +0 -0
- data/vendor/zstd/doc/images/zstd_logo86.png +0 -0
- data/vendor/zstd/doc/zstd_compression_format.md +1772 -0
- data/vendor/zstd/doc/zstd_manual.html +2244 -0
- data/vendor/zstd/examples/Makefile +93 -0
- data/vendor/zstd/examples/README.md +46 -0
- data/vendor/zstd/examples/common.h +246 -0
- data/vendor/zstd/examples/dictionary_compression.c +107 -0
- data/vendor/zstd/examples/dictionary_decompression.c +99 -0
- data/vendor/zstd/examples/multiple_simple_compression.c +116 -0
- data/vendor/zstd/examples/multiple_streaming_compression.c +133 -0
- data/vendor/zstd/examples/simple_compression.c +68 -0
- data/vendor/zstd/examples/simple_decompression.c +65 -0
- data/vendor/zstd/examples/streaming_compression.c +146 -0
- data/vendor/zstd/examples/streaming_compression_thread_pool.c +180 -0
- data/vendor/zstd/examples/streaming_decompression.c +100 -0
- data/vendor/zstd/examples/streaming_memory_usage.c +137 -0
- data/vendor/zstd/lib/BUCK +232 -0
- data/vendor/zstd/lib/Makefile +389 -0
- data/vendor/zstd/lib/README.md +267 -0
- data/vendor/zstd/lib/common/allocations.h +55 -0
- data/vendor/zstd/lib/common/bits.h +205 -0
- data/vendor/zstd/lib/common/bitstream.h +454 -0
- data/vendor/zstd/lib/common/compiler.h +482 -0
- data/vendor/zstd/lib/common/cpu.h +249 -0
- data/vendor/zstd/lib/common/debug.c +30 -0
- data/vendor/zstd/lib/common/debug.h +107 -0
- data/vendor/zstd/lib/common/debug.o +0 -0
- data/vendor/zstd/lib/common/entropy_common.c +340 -0
- data/vendor/zstd/lib/common/entropy_common.o +0 -0
- data/vendor/zstd/lib/common/error_private.c +64 -0
- data/vendor/zstd/lib/common/error_private.h +158 -0
- data/vendor/zstd/lib/common/error_private.o +0 -0
- data/vendor/zstd/lib/common/fse.h +625 -0
- data/vendor/zstd/lib/common/fse_decompress.c +315 -0
- data/vendor/zstd/lib/common/fse_decompress.o +0 -0
- data/vendor/zstd/lib/common/huf.h +277 -0
- data/vendor/zstd/lib/common/mem.h +422 -0
- data/vendor/zstd/lib/common/pool.c +371 -0
- data/vendor/zstd/lib/common/pool.h +81 -0
- data/vendor/zstd/lib/common/pool.o +0 -0
- data/vendor/zstd/lib/common/portability_macros.h +190 -0
- data/vendor/zstd/lib/common/threading.c +196 -0
- data/vendor/zstd/lib/common/threading.h +142 -0
- data/vendor/zstd/lib/common/threading.o +0 -0
- data/vendor/zstd/lib/common/xxhash.c +18 -0
- data/vendor/zstd/lib/common/xxhash.h +7094 -0
- data/vendor/zstd/lib/common/xxhash.o +0 -0
- data/vendor/zstd/lib/common/zstd_common.c +57 -0
- data/vendor/zstd/lib/common/zstd_common.o +0 -0
- data/vendor/zstd/lib/common/zstd_deps.h +123 -0
- data/vendor/zstd/lib/common/zstd_internal.h +326 -0
- data/vendor/zstd/lib/common/zstd_trace.h +156 -0
- data/vendor/zstd/lib/compress/clevels.h +134 -0
- data/vendor/zstd/lib/compress/fse_compress.c +625 -0
- data/vendor/zstd/lib/compress/fse_compress.o +0 -0
- data/vendor/zstd/lib/compress/hist.c +446 -0
- data/vendor/zstd/lib/compress/hist.h +86 -0
- data/vendor/zstd/lib/compress/hist.o +0 -0
- data/vendor/zstd/lib/compress/huf_compress.c +1465 -0
- data/vendor/zstd/lib/compress/huf_compress.o +0 -0
- data/vendor/zstd/lib/compress/zstd_compress.c +8362 -0
- data/vendor/zstd/lib/compress/zstd_compress.o +0 -0
- data/vendor/zstd/lib/compress/zstd_compress_internal.h +1636 -0
- data/vendor/zstd/lib/compress/zstd_compress_literals.c +235 -0
- data/vendor/zstd/lib/compress/zstd_compress_literals.h +39 -0
- data/vendor/zstd/lib/compress/zstd_compress_literals.o +0 -0
- data/vendor/zstd/lib/compress/zstd_compress_sequences.c +442 -0
- data/vendor/zstd/lib/compress/zstd_compress_sequences.h +55 -0
- data/vendor/zstd/lib/compress/zstd_compress_sequences.o +0 -0
- data/vendor/zstd/lib/compress/zstd_compress_superblock.c +688 -0
- data/vendor/zstd/lib/compress/zstd_compress_superblock.h +32 -0
- data/vendor/zstd/lib/compress/zstd_compress_superblock.o +0 -0
- data/vendor/zstd/lib/compress/zstd_cwksp.h +765 -0
- data/vendor/zstd/lib/compress/zstd_double_fast.c +778 -0
- data/vendor/zstd/lib/compress/zstd_double_fast.h +42 -0
- data/vendor/zstd/lib/compress/zstd_double_fast.o +0 -0
- data/vendor/zstd/lib/compress/zstd_fast.c +985 -0
- data/vendor/zstd/lib/compress/zstd_fast.h +30 -0
- data/vendor/zstd/lib/compress/zstd_fast.o +0 -0
- data/vendor/zstd/lib/compress/zstd_lazy.c +2243 -0
- data/vendor/zstd/lib/compress/zstd_lazy.h +193 -0
- data/vendor/zstd/lib/compress/zstd_lazy.o +0 -0
- data/vendor/zstd/lib/compress/zstd_ldm.c +745 -0
- data/vendor/zstd/lib/compress/zstd_ldm.h +109 -0
- data/vendor/zstd/lib/compress/zstd_ldm.o +0 -0
- data/vendor/zstd/lib/compress/zstd_ldm_geartab.h +106 -0
- data/vendor/zstd/lib/compress/zstd_opt.c +1572 -0
- data/vendor/zstd/lib/compress/zstd_opt.h +72 -0
- data/vendor/zstd/lib/compress/zstd_opt.o +0 -0
- data/vendor/zstd/lib/compress/zstd_preSplit.c +238 -0
- data/vendor/zstd/lib/compress/zstd_preSplit.h +33 -0
- data/vendor/zstd/lib/compress/zstd_preSplit.o +0 -0
- data/vendor/zstd/lib/compress/zstdmt_compress.c +1924 -0
- data/vendor/zstd/lib/compress/zstdmt_compress.h +102 -0
- data/vendor/zstd/lib/compress/zstdmt_compress.o +0 -0
- data/vendor/zstd/lib/decompress/huf_decompress.c +1953 -0
- data/vendor/zstd/lib/decompress/huf_decompress.o +0 -0
- data/vendor/zstd/lib/decompress/huf_decompress_amd64.S +766 -0
- data/vendor/zstd/lib/decompress/zstd_ddict.c +244 -0
- data/vendor/zstd/lib/decompress/zstd_ddict.h +44 -0
- data/vendor/zstd/lib/decompress/zstd_ddict.o +0 -0
- data/vendor/zstd/lib/decompress/zstd_decompress.c +2410 -0
- data/vendor/zstd/lib/decompress/zstd_decompress.o +0 -0
- data/vendor/zstd/lib/decompress/zstd_decompress_block.c +2311 -0
- data/vendor/zstd/lib/decompress/zstd_decompress_block.h +73 -0
- data/vendor/zstd/lib/decompress/zstd_decompress_block.o +0 -0
- data/vendor/zstd/lib/decompress/zstd_decompress_internal.h +240 -0
- data/vendor/zstd/lib/deprecated/zbuff.h +214 -0
- data/vendor/zstd/lib/deprecated/zbuff_common.c +26 -0
- data/vendor/zstd/lib/deprecated/zbuff_compress.c +167 -0
- data/vendor/zstd/lib/deprecated/zbuff_decompress.c +77 -0
- data/vendor/zstd/lib/dictBuilder/cover.c +1333 -0
- data/vendor/zstd/lib/dictBuilder/cover.h +152 -0
- data/vendor/zstd/lib/dictBuilder/divsufsort.c +1913 -0
- data/vendor/zstd/lib/dictBuilder/divsufsort.h +57 -0
- data/vendor/zstd/lib/dictBuilder/fastcover.c +765 -0
- data/vendor/zstd/lib/dictBuilder/zdict.c +1137 -0
- data/vendor/zstd/lib/dll/example/Makefile +48 -0
- data/vendor/zstd/lib/dll/example/README.md +63 -0
- data/vendor/zstd/lib/dll/example/build_package.bat +55 -0
- data/vendor/zstd/lib/dll/example/fullbench-dll.sln +25 -0
- data/vendor/zstd/lib/dll/example/fullbench-dll.vcxproj +181 -0
- data/vendor/zstd/lib/install_oses.mk +17 -0
- data/vendor/zstd/lib/legacy/zstd_legacy.h +452 -0
- data/vendor/zstd/lib/legacy/zstd_v01.c +2128 -0
- data/vendor/zstd/lib/legacy/zstd_v01.h +94 -0
- data/vendor/zstd/lib/legacy/zstd_v02.c +3465 -0
- data/vendor/zstd/lib/legacy/zstd_v02.h +93 -0
- data/vendor/zstd/lib/legacy/zstd_v03.c +3105 -0
- data/vendor/zstd/lib/legacy/zstd_v03.h +93 -0
- data/vendor/zstd/lib/legacy/zstd_v04.c +3598 -0
- data/vendor/zstd/lib/legacy/zstd_v04.h +142 -0
- data/vendor/zstd/lib/legacy/zstd_v05.c +4005 -0
- data/vendor/zstd/lib/legacy/zstd_v05.h +162 -0
- data/vendor/zstd/lib/legacy/zstd_v06.c +4110 -0
- data/vendor/zstd/lib/legacy/zstd_v06.h +172 -0
- data/vendor/zstd/lib/legacy/zstd_v07.c +4490 -0
- data/vendor/zstd/lib/legacy/zstd_v07.h +187 -0
- data/vendor/zstd/lib/libzstd.mk +238 -0
- data/vendor/zstd/lib/libzstd.pc.in +17 -0
- data/vendor/zstd/lib/module.modulemap +35 -0
- data/vendor/zstd/lib/zdict.h +481 -0
- data/vendor/zstd/lib/zstd.h +3209 -0
- data/vendor/zstd/lib/zstd_errors.h +107 -0
- data/vendor/zstd/programs/BUCK +44 -0
- data/vendor/zstd/programs/Makefile +445 -0
- data/vendor/zstd/programs/README.md +344 -0
- data/vendor/zstd/programs/benchfn.c +256 -0
- data/vendor/zstd/programs/benchfn.h +173 -0
- data/vendor/zstd/programs/benchzstd.c +1270 -0
- data/vendor/zstd/programs/benchzstd.h +191 -0
- data/vendor/zstd/programs/datagen.c +186 -0
- data/vendor/zstd/programs/datagen.h +38 -0
- data/vendor/zstd/programs/dibio.c +447 -0
- data/vendor/zstd/programs/dibio.h +39 -0
- data/vendor/zstd/programs/fileio.c +3717 -0
- data/vendor/zstd/programs/fileio.h +171 -0
- data/vendor/zstd/programs/fileio_asyncio.c +663 -0
- data/vendor/zstd/programs/fileio_asyncio.h +195 -0
- data/vendor/zstd/programs/fileio_common.h +121 -0
- data/vendor/zstd/programs/fileio_types.h +86 -0
- data/vendor/zstd/programs/lorem.c +285 -0
- data/vendor/zstd/programs/lorem.h +32 -0
- data/vendor/zstd/programs/platform.h +217 -0
- data/vendor/zstd/programs/timefn.c +170 -0
- data/vendor/zstd/programs/timefn.h +59 -0
- data/vendor/zstd/programs/util.c +1731 -0
- data/vendor/zstd/programs/util.h +364 -0
- data/vendor/zstd/programs/windres/verrsrc.h +17 -0
- data/vendor/zstd/programs/windres/zstd.rc +51 -0
- data/vendor/zstd/programs/windres/zstd32.res +0 -0
- data/vendor/zstd/programs/windres/zstd64.res +0 -0
- data/vendor/zstd/programs/zstd.1 +580 -0
- data/vendor/zstd/programs/zstd.1.md +714 -0
- data/vendor/zstd/programs/zstdcli.c +1675 -0
- data/vendor/zstd/programs/zstdcli_trace.c +173 -0
- data/vendor/zstd/programs/zstdcli_trace.h +24 -0
- data/vendor/zstd/programs/zstdgrep +134 -0
- data/vendor/zstd/programs/zstdgrep.1 +26 -0
- data/vendor/zstd/programs/zstdgrep.1.md +30 -0
- data/vendor/zstd/programs/zstdless +8 -0
- data/vendor/zstd/programs/zstdless.1 +14 -0
- data/vendor/zstd/programs/zstdless.1.md +16 -0
- data/vendor/zstd/tests/DEPRECATED-test-zstd-speed.py +378 -0
- data/vendor/zstd/tests/Makefile +485 -0
- data/vendor/zstd/tests/README.md +184 -0
- data/vendor/zstd/tests/automated_benchmarking.py +326 -0
- data/vendor/zstd/tests/checkTag.c +65 -0
- data/vendor/zstd/tests/check_size.py +31 -0
- data/vendor/zstd/tests/cli-tests/README.md +258 -0
- data/vendor/zstd/tests/cli-tests/basic/args.sh +10 -0
- data/vendor/zstd/tests/cli-tests/basic/args.sh.exit +1 -0
- data/vendor/zstd/tests/cli-tests/basic/args.sh.stderr.glob +28 -0
- data/vendor/zstd/tests/cli-tests/basic/help.sh +10 -0
- data/vendor/zstd/tests/cli-tests/basic/help.sh.stdout.glob +34 -0
- data/vendor/zstd/tests/cli-tests/basic/memlimit.sh +40 -0
- data/vendor/zstd/tests/cli-tests/basic/memlimit.sh.stderr.exact +13 -0
- data/vendor/zstd/tests/cli-tests/basic/memlimit.sh.stdout.exact +13 -0
- data/vendor/zstd/tests/cli-tests/basic/output_dir.sh +7 -0
- data/vendor/zstd/tests/cli-tests/basic/output_dir.sh.stderr.exact +2 -0
- data/vendor/zstd/tests/cli-tests/basic/output_dir.sh.stdout.exact +2 -0
- data/vendor/zstd/tests/cli-tests/basic/version.sh +6 -0
- data/vendor/zstd/tests/cli-tests/basic/version.sh.stdout.glob +2 -0
- data/vendor/zstd/tests/cli-tests/bin/cmp_size +44 -0
- data/vendor/zstd/tests/cli-tests/bin/datagen +3 -0
- data/vendor/zstd/tests/cli-tests/bin/die +4 -0
- data/vendor/zstd/tests/cli-tests/bin/println +2 -0
- data/vendor/zstd/tests/cli-tests/bin/unzstd +1 -0
- data/vendor/zstd/tests/cli-tests/bin/zstd +9 -0
- data/vendor/zstd/tests/cli-tests/bin/zstdcat +1 -0
- data/vendor/zstd/tests/cli-tests/bin/zstdgrep +2 -0
- data/vendor/zstd/tests/cli-tests/bin/zstdless +2 -0
- data/vendor/zstd/tests/cli-tests/cltools/setup +6 -0
- data/vendor/zstd/tests/cli-tests/cltools/zstdgrep.sh +8 -0
- data/vendor/zstd/tests/cli-tests/cltools/zstdgrep.sh.exit +1 -0
- data/vendor/zstd/tests/cli-tests/cltools/zstdgrep.sh.stderr.exact +1 -0
- data/vendor/zstd/tests/cli-tests/cltools/zstdgrep.sh.stdout.glob +4 -0
- data/vendor/zstd/tests/cli-tests/cltools/zstdless.sh +10 -0
- data/vendor/zstd/tests/cli-tests/cltools/zstdless.sh.stderr.exact +2 -0
- data/vendor/zstd/tests/cli-tests/cltools/zstdless.sh.stdout.glob +5 -0
- data/vendor/zstd/tests/cli-tests/common/format.sh +19 -0
- data/vendor/zstd/tests/cli-tests/common/mtime.sh +13 -0
- data/vendor/zstd/tests/cli-tests/common/permissions.sh +18 -0
- data/vendor/zstd/tests/cli-tests/common/platform.sh +47 -0
- data/vendor/zstd/tests/cli-tests/compression/adapt.sh +14 -0
- data/vendor/zstd/tests/cli-tests/compression/basic.sh +36 -0
- data/vendor/zstd/tests/cli-tests/compression/compress-literals.sh +10 -0
- data/vendor/zstd/tests/cli-tests/compression/format.sh +16 -0
- data/vendor/zstd/tests/cli-tests/compression/golden.sh +16 -0
- data/vendor/zstd/tests/cli-tests/compression/gzip-compat.sh +17 -0
- data/vendor/zstd/tests/cli-tests/compression/levels.sh +75 -0
- data/vendor/zstd/tests/cli-tests/compression/levels.sh.stderr.exact +80 -0
- data/vendor/zstd/tests/cli-tests/compression/long-distance-matcher.sh +7 -0
- data/vendor/zstd/tests/cli-tests/compression/multi-threaded.sh +22 -0
- data/vendor/zstd/tests/cli-tests/compression/multi-threaded.sh.stderr.exact +21 -0
- data/vendor/zstd/tests/cli-tests/compression/multiple-files.sh +21 -0
- data/vendor/zstd/tests/cli-tests/compression/multiple-files.sh.stdout.exact +12 -0
- data/vendor/zstd/tests/cli-tests/compression/row-match-finder.sh +7 -0
- data/vendor/zstd/tests/cli-tests/compression/setup +7 -0
- data/vendor/zstd/tests/cli-tests/compression/stream-size.sh +7 -0
- data/vendor/zstd/tests/cli-tests/compression/verbose-wlog.sh +11 -0
- data/vendor/zstd/tests/cli-tests/compression/verbose-wlog.sh.stderr.glob +5 -0
- data/vendor/zstd/tests/cli-tests/compression/verbose-wlog.sh.stdout.glob +5 -0
- data/vendor/zstd/tests/cli-tests/compression/window-resize.sh +9 -0
- data/vendor/zstd/tests/cli-tests/compression/window-resize.sh.stderr.ignore +0 -0
- data/vendor/zstd/tests/cli-tests/compression/window-resize.sh.stdout.glob +3 -0
- data/vendor/zstd/tests/cli-tests/decompression/detectErrors.sh +11 -0
- data/vendor/zstd/tests/cli-tests/decompression/golden.sh +7 -0
- data/vendor/zstd/tests/cli-tests/decompression/pass-through.sh +57 -0
- data/vendor/zstd/tests/cli-tests/decompression/pass-through.sh.stderr.exact +11 -0
- data/vendor/zstd/tests/cli-tests/decompression/pass-through.sh.stdout.exact +25 -0
- data/vendor/zstd/tests/cli-tests/determinism/basic.sh +36 -0
- data/vendor/zstd/tests/cli-tests/determinism/basic.sh.stderr.exact +0 -0
- data/vendor/zstd/tests/cli-tests/determinism/basic.sh.stdout.exact +880 -0
- data/vendor/zstd/tests/cli-tests/determinism/multithread.sh +45 -0
- data/vendor/zstd/tests/cli-tests/determinism/multithread.sh.stderr.exact +0 -0
- data/vendor/zstd/tests/cli-tests/determinism/multithread.sh.stdout.exact +260 -0
- data/vendor/zstd/tests/cli-tests/determinism/reuse.sh +44 -0
- data/vendor/zstd/tests/cli-tests/determinism/reuse.sh.stderr.exact +0 -0
- data/vendor/zstd/tests/cli-tests/determinism/reuse.sh.stdout.exact +19 -0
- data/vendor/zstd/tests/cli-tests/determinism/setup +5 -0
- data/vendor/zstd/tests/cli-tests/determinism/setup_once +30 -0
- data/vendor/zstd/tests/cli-tests/dict-builder/empty-input.sh +9 -0
- data/vendor/zstd/tests/cli-tests/dict-builder/empty-input.sh.stderr.exact +1 -0
- data/vendor/zstd/tests/cli-tests/dict-builder/no-inputs.sh +3 -0
- data/vendor/zstd/tests/cli-tests/dict-builder/no-inputs.sh.exit +1 -0
- data/vendor/zstd/tests/cli-tests/dict-builder/no-inputs.sh.stderr.exact +5 -0
- data/vendor/zstd/tests/cli-tests/dictionaries/dictionary-mismatch.sh +29 -0
- data/vendor/zstd/tests/cli-tests/dictionaries/dictionary-mismatch.sh.stderr.exact +7 -0
- data/vendor/zstd/tests/cli-tests/dictionaries/golden.sh +9 -0
- data/vendor/zstd/tests/cli-tests/dictionaries/setup +6 -0
- data/vendor/zstd/tests/cli-tests/dictionaries/setup_once +24 -0
- data/vendor/zstd/tests/cli-tests/file-handling/directory-mirror.sh +49 -0
- data/vendor/zstd/tests/cli-tests/file-handling/directory-mirror.sh.stderr.exact +0 -0
- data/vendor/zstd/tests/cli-tests/file-handling/directory-mirror.sh.stdout.exact +0 -0
- data/vendor/zstd/tests/cli-tests/file-stat/compress-file-to-dir-without-write-perm.sh +12 -0
- data/vendor/zstd/tests/cli-tests/file-stat/compress-file-to-dir-without-write-perm.sh.stderr.exact +30 -0
- data/vendor/zstd/tests/cli-tests/file-stat/compress-file-to-file.sh +9 -0
- data/vendor/zstd/tests/cli-tests/file-stat/compress-file-to-file.sh.stderr.glob +46 -0
- data/vendor/zstd/tests/cli-tests/file-stat/compress-file-to-stdout.sh +8 -0
- data/vendor/zstd/tests/cli-tests/file-stat/compress-file-to-stdout.sh.stderr.exact +24 -0
- data/vendor/zstd/tests/cli-tests/file-stat/compress-stdin-to-file.sh +8 -0
- data/vendor/zstd/tests/cli-tests/file-stat/compress-stdin-to-file.sh.stderr.glob +28 -0
- data/vendor/zstd/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh +8 -0
- data/vendor/zstd/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh.stderr.exact +18 -0
- data/vendor/zstd/tests/cli-tests/file-stat/decompress-file-to-file.sh +8 -0
- data/vendor/zstd/tests/cli-tests/file-stat/decompress-file-to-file.sh.stderr.glob +42 -0
- data/vendor/zstd/tests/cli-tests/file-stat/decompress-file-to-stdout.sh +7 -0
- data/vendor/zstd/tests/cli-tests/file-stat/decompress-file-to-stdout.sh.stderr.exact +18 -0
- data/vendor/zstd/tests/cli-tests/file-stat/decompress-stdin-to-file.sh +7 -0
- data/vendor/zstd/tests/cli-tests/file-stat/decompress-stdin-to-file.sh.stderr.glob +24 -0
- data/vendor/zstd/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh +7 -0
- data/vendor/zstd/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh.stderr.exact +14 -0
- data/vendor/zstd/tests/cli-tests/progress/no-progress.sh +46 -0
- data/vendor/zstd/tests/cli-tests/progress/no-progress.sh.stderr.glob +96 -0
- data/vendor/zstd/tests/cli-tests/progress/progress.sh +41 -0
- data/vendor/zstd/tests/cli-tests/progress/progress.sh.stderr.glob +62 -0
- data/vendor/zstd/tests/cli-tests/run.py +732 -0
- data/vendor/zstd/tests/cli-tests/zstd-symlinks/setup +6 -0
- data/vendor/zstd/tests/cli-tests/zstd-symlinks/zstdcat.sh +12 -0
- data/vendor/zstd/tests/cli-tests/zstd-symlinks/zstdcat.sh.stdout.exact +8 -0
- data/vendor/zstd/tests/datagencli.c +149 -0
- data/vendor/zstd/tests/decodecorpus.c +1998 -0
- data/vendor/zstd/tests/dict-files/zero-weight-dict +0 -0
- data/vendor/zstd/tests/external_matchfinder.c +140 -0
- data/vendor/zstd/tests/external_matchfinder.h +39 -0
- data/vendor/zstd/tests/fullbench.c +1210 -0
- data/vendor/zstd/tests/fuzz/Makefile +278 -0
- data/vendor/zstd/tests/fuzz/README.md +161 -0
- data/vendor/zstd/tests/fuzz/block_decompress.c +53 -0
- data/vendor/zstd/tests/fuzz/block_round_trip.c +103 -0
- data/vendor/zstd/tests/fuzz/decompress_cross_format.c +130 -0
- data/vendor/zstd/tests/fuzz/decompress_dstSize_tooSmall.c +74 -0
- data/vendor/zstd/tests/fuzz/dictionary_decompress.c +77 -0
- data/vendor/zstd/tests/fuzz/dictionary_loader.c +106 -0
- data/vendor/zstd/tests/fuzz/dictionary_round_trip.c +155 -0
- data/vendor/zstd/tests/fuzz/dictionary_stream_round_trip.c +209 -0
- data/vendor/zstd/tests/fuzz/fse_read_ncount.c +100 -0
- data/vendor/zstd/tests/fuzz/fuzz.h +57 -0
- data/vendor/zstd/tests/fuzz/fuzz.py +910 -0
- data/vendor/zstd/tests/fuzz/fuzz_data_producer.c +95 -0
- data/vendor/zstd/tests/fuzz/fuzz_data_producer.h +66 -0
- data/vendor/zstd/tests/fuzz/fuzz_helpers.c +47 -0
- data/vendor/zstd/tests/fuzz/fuzz_helpers.h +82 -0
- data/vendor/zstd/tests/fuzz/fuzz_third_party_seq_prod.h +116 -0
- data/vendor/zstd/tests/fuzz/generate_sequences.c +88 -0
- data/vendor/zstd/tests/fuzz/huf_decompress.c +68 -0
- data/vendor/zstd/tests/fuzz/huf_round_trip.c +137 -0
- data/vendor/zstd/tests/fuzz/raw_dictionary_round_trip.c +119 -0
- data/vendor/zstd/tests/fuzz/regression_driver.c +90 -0
- data/vendor/zstd/tests/fuzz/seekable_roundtrip.c +88 -0
- data/vendor/zstd/tests/fuzz/seq_prod_fuzz_example/Makefile +16 -0
- data/vendor/zstd/tests/fuzz/seq_prod_fuzz_example/README.md +12 -0
- data/vendor/zstd/tests/fuzz/seq_prod_fuzz_example/example_seq_prod.c +52 -0
- data/vendor/zstd/tests/fuzz/sequence_compression_api.c +452 -0
- data/vendor/zstd/tests/fuzz/simple_compress.c +60 -0
- data/vendor/zstd/tests/fuzz/simple_decompress.c +59 -0
- data/vendor/zstd/tests/fuzz/simple_round_trip.c +182 -0
- data/vendor/zstd/tests/fuzz/stream_decompress.c +119 -0
- data/vendor/zstd/tests/fuzz/stream_round_trip.c +218 -0
- data/vendor/zstd/tests/fuzz/zstd_frame_info.c +43 -0
- data/vendor/zstd/tests/fuzz/zstd_helpers.c +208 -0
- data/vendor/zstd/tests/fuzz/zstd_helpers.h +56 -0
- data/vendor/zstd/tests/fuzzer.c +5482 -0
- data/vendor/zstd/tests/golden-compression/PR-3517-block-splitter-corruption-test +1 -0
- data/vendor/zstd/tests/golden-compression/http +1 -0
- data/vendor/zstd/tests/golden-compression/huffman-compressed-larger +0 -0
- data/vendor/zstd/tests/golden-compression/large-literal-and-match-lengths +0 -0
- data/vendor/zstd/tests/golden-decompression/block-128k.zst +0 -0
- data/vendor/zstd/tests/golden-decompression/empty-block.zst +0 -0
- data/vendor/zstd/tests/golden-decompression/rle-first-block.zst +0 -0
- data/vendor/zstd/tests/golden-decompression/zeroSeq_2B.zst +0 -0
- data/vendor/zstd/tests/golden-decompression-errors/off0.bin.zst +0 -0
- data/vendor/zstd/tests/golden-decompression-errors/truncated_huff_state.zst +0 -0
- data/vendor/zstd/tests/golden-decompression-errors/zeroSeq_extraneous.zst +0 -0
- data/vendor/zstd/tests/golden-dictionaries/http-dict-missing-symbols +0 -0
- data/vendor/zstd/tests/gzip/Makefile +45 -0
- data/vendor/zstd/tests/gzip/gzip-env.sh +46 -0
- data/vendor/zstd/tests/gzip/helin-segv.sh +31 -0
- data/vendor/zstd/tests/gzip/help-version.sh +270 -0
- data/vendor/zstd/tests/gzip/hufts-segv.gz +0 -0
- data/vendor/zstd/tests/gzip/hufts.sh +34 -0
- data/vendor/zstd/tests/gzip/init.cfg +5 -0
- data/vendor/zstd/tests/gzip/init.sh +616 -0
- data/vendor/zstd/tests/gzip/keep.sh +51 -0
- data/vendor/zstd/tests/gzip/list.sh +31 -0
- data/vendor/zstd/tests/gzip/memcpy-abuse.sh +34 -0
- data/vendor/zstd/tests/gzip/mixed.sh +68 -0
- data/vendor/zstd/tests/gzip/null-suffix-clobber.sh +35 -0
- data/vendor/zstd/tests/gzip/stdin.sh +31 -0
- data/vendor/zstd/tests/gzip/test-driver.sh +150 -0
- data/vendor/zstd/tests/gzip/trailing-nul.sh +37 -0
- data/vendor/zstd/tests/gzip/unpack-invalid.sh +36 -0
- data/vendor/zstd/tests/gzip/z-suffix.sh +30 -0
- data/vendor/zstd/tests/gzip/zdiff.sh +48 -0
- data/vendor/zstd/tests/gzip/zgrep-context.sh +47 -0
- data/vendor/zstd/tests/gzip/zgrep-f.sh +43 -0
- data/vendor/zstd/tests/gzip/zgrep-signal.sh +64 -0
- data/vendor/zstd/tests/gzip/znew-k.sh +40 -0
- data/vendor/zstd/tests/invalidDictionaries.c +61 -0
- data/vendor/zstd/tests/largeDictionary.c +131 -0
- data/vendor/zstd/tests/legacy.c +262 -0
- data/vendor/zstd/tests/libzstd_builds.sh +104 -0
- data/vendor/zstd/tests/longmatch.c +123 -0
- data/vendor/zstd/tests/loremOut.c +50 -0
- data/vendor/zstd/tests/loremOut.h +15 -0
- data/vendor/zstd/tests/paramgrill.c +2965 -0
- data/vendor/zstd/tests/playTests.sh +1926 -0
- data/vendor/zstd/tests/poolTests.c +271 -0
- data/vendor/zstd/tests/rateLimiter.py +41 -0
- data/vendor/zstd/tests/regression/Makefile +60 -0
- data/vendor/zstd/tests/regression/README.md +28 -0
- data/vendor/zstd/tests/regression/config.c +404 -0
- data/vendor/zstd/tests/regression/config.h +91 -0
- data/vendor/zstd/tests/regression/data.c +631 -0
- data/vendor/zstd/tests/regression/data.h +121 -0
- data/vendor/zstd/tests/regression/levels.h +59 -0
- data/vendor/zstd/tests/regression/method.c +701 -0
- data/vendor/zstd/tests/regression/method.h +65 -0
- data/vendor/zstd/tests/regression/result.c +30 -0
- data/vendor/zstd/tests/regression/result.h +103 -0
- data/vendor/zstd/tests/regression/results.csv +1480 -0
- data/vendor/zstd/tests/regression/test.c +362 -0
- data/vendor/zstd/tests/roundTripCrash.c +241 -0
- data/vendor/zstd/tests/seqgen.c +260 -0
- data/vendor/zstd/tests/seqgen.h +58 -0
- data/vendor/zstd/tests/test-license.py +156 -0
- data/vendor/zstd/tests/test-variants.sh +115 -0
- data/vendor/zstd/tests/test-zstd-versions.py +308 -0
- data/vendor/zstd/tests/test_process_substitution.bash +92 -0
- data/vendor/zstd/tests/zstreamtest.c +3467 -0
- data/vendor/zstd/zlibWrapper/BUCK +22 -0
- data/vendor/zstd/zlibWrapper/Makefile +120 -0
- data/vendor/zstd/zlibWrapper/README.md +163 -0
- data/vendor/zstd/zlibWrapper/examples/example.c +598 -0
- data/vendor/zstd/zlibWrapper/examples/example_original.c +599 -0
- data/vendor/zstd/zlibWrapper/examples/fitblk.c +254 -0
- data/vendor/zstd/zlibWrapper/examples/fitblk_original.c +233 -0
- data/vendor/zstd/zlibWrapper/examples/minigzip.c +605 -0
- data/vendor/zstd/zlibWrapper/examples/zwrapbench.c +1018 -0
- data/vendor/zstd/zlibWrapper/gzclose.c +26 -0
- data/vendor/zstd/zlibWrapper/gzcompatibility.h +68 -0
- data/vendor/zstd/zlibWrapper/gzguts.h +229 -0
- data/vendor/zstd/zlibWrapper/gzlib.c +587 -0
- data/vendor/zstd/zlibWrapper/gzread.c +637 -0
- data/vendor/zstd/zlibWrapper/gzwrite.c +632 -0
- data/vendor/zstd/zlibWrapper/zstd_zlibwrapper.c +1200 -0
- data/vendor/zstd/zlibWrapper/zstd_zlibwrapper.h +91 -0
- metadata +738 -0
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under both the BSD-style license (found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
7
|
+
* in the COPYING file in the root directory of this source tree).
|
|
8
|
+
* You may select, at your option, one of the above-listed licenses.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/*-*************************************
|
|
12
|
+
* Dependencies
|
|
13
|
+
***************************************/
|
|
14
|
+
|
|
15
|
+
/* Currently relies on qsort when combining contiguous matches. This can probably
|
|
16
|
+
* be avoided but would require changes to the algorithm. The qsort is far from
|
|
17
|
+
* the bottleneck in this algorithm even for medium sized files so it's probably
|
|
18
|
+
* not worth trying to address */
|
|
19
|
+
#include <stdlib.h>
|
|
20
|
+
#include <assert.h>
|
|
21
|
+
|
|
22
|
+
#include "zstd_edist.h"
|
|
23
|
+
#include "mem.h"
|
|
24
|
+
|
|
25
|
+
/*-*************************************
|
|
26
|
+
* Constants
|
|
27
|
+
***************************************/
|
|
28
|
+
|
|
29
|
+
/* Just a sential for the entries of the diagonal matrix */
|
|
30
|
+
#define ZSTD_EDIST_DIAG_MAX (S32)(1 << 30)
|
|
31
|
+
|
|
32
|
+
/* How large should a snake be to be considered a 'big' snake.
|
|
33
|
+
* For an explanation of what a 'snake' is with respect to the
|
|
34
|
+
* edit distance matrix, see the linked paper in zstd_edist.h */
|
|
35
|
+
#define ZSTD_EDIST_SNAKE_THRESH 20
|
|
36
|
+
|
|
37
|
+
/* After how many iterations should we start to use the heuristic
|
|
38
|
+
* based on 'big' snakes */
|
|
39
|
+
#define ZSTD_EDIST_SNAKE_ITER_THRESH 200
|
|
40
|
+
|
|
41
|
+
/* After how many iterations should be just give up and take
|
|
42
|
+
* the best available edit script for this round */
|
|
43
|
+
#define ZSTD_EDIST_EXPENSIVE_THRESH 1024
|
|
44
|
+
|
|
45
|
+
/*-*************************************
|
|
46
|
+
* Structures
|
|
47
|
+
***************************************/
|
|
48
|
+
|
|
49
|
+
typedef struct {
|
|
50
|
+
U32 dictIdx;
|
|
51
|
+
U32 srcIdx;
|
|
52
|
+
U32 matchLength;
|
|
53
|
+
} ZSTD_eDist_match;
|
|
54
|
+
|
|
55
|
+
typedef struct {
|
|
56
|
+
const BYTE* dict;
|
|
57
|
+
const BYTE* src;
|
|
58
|
+
size_t dictSize;
|
|
59
|
+
size_t srcSize;
|
|
60
|
+
S32* forwardDiag; /* Entries of the forward diagonal stored here */
|
|
61
|
+
S32* backwardDiag; /* Entries of the backward diagonal stored here.
|
|
62
|
+
* Note: this buffer and the 'forwardDiag' buffer
|
|
63
|
+
* are contiguous. See the ZSTD_eDist_genSequences */
|
|
64
|
+
ZSTD_eDist_match* matches; /* Accumulate matches of length 1 in this buffer.
|
|
65
|
+
* In a subsequence post-processing step, we combine
|
|
66
|
+
* contiguous matches. */
|
|
67
|
+
U32 nbMatches;
|
|
68
|
+
} ZSTD_eDist_state;
|
|
69
|
+
|
|
70
|
+
typedef struct {
|
|
71
|
+
S32 dictMid; /* The mid diagonal for the dictionary */
|
|
72
|
+
S32 srcMid; /* The mid diagonal for the source */
|
|
73
|
+
int lowUseHeuristics; /* Should we use heuristics for the low part */
|
|
74
|
+
int highUseHeuristics; /* Should we use heuristics for the high part */
|
|
75
|
+
} ZSTD_eDist_partition;
|
|
76
|
+
|
|
77
|
+
/*-*************************************
|
|
78
|
+
* Internal
|
|
79
|
+
***************************************/
|
|
80
|
+
|
|
81
|
+
static void ZSTD_eDist_diag(ZSTD_eDist_state* state,
|
|
82
|
+
ZSTD_eDist_partition* partition,
|
|
83
|
+
S32 dictLow, S32 dictHigh, S32 srcLow,
|
|
84
|
+
S32 srcHigh, int useHeuristics)
|
|
85
|
+
{
|
|
86
|
+
S32* const forwardDiag = state->forwardDiag;
|
|
87
|
+
S32* const backwardDiag = state->backwardDiag;
|
|
88
|
+
const BYTE* const dict = state->dict;
|
|
89
|
+
const BYTE* const src = state->src;
|
|
90
|
+
|
|
91
|
+
S32 const diagMin = dictLow - srcHigh;
|
|
92
|
+
S32 const diagMax = dictHigh - srcLow;
|
|
93
|
+
S32 const forwardMid = dictLow - srcLow;
|
|
94
|
+
S32 const backwardMid = dictHigh - srcHigh;
|
|
95
|
+
|
|
96
|
+
S32 forwardMin = forwardMid;
|
|
97
|
+
S32 forwardMax = forwardMid;
|
|
98
|
+
S32 backwardMin = backwardMid;
|
|
99
|
+
S32 backwardMax = backwardMid;
|
|
100
|
+
int odd = (forwardMid - backwardMid) & 1;
|
|
101
|
+
U32 iterations;
|
|
102
|
+
|
|
103
|
+
forwardDiag[forwardMid] = dictLow;
|
|
104
|
+
backwardDiag[backwardMid] = dictHigh;
|
|
105
|
+
|
|
106
|
+
/* Main loop for updating diag entries. Unless useHeuristics is
|
|
107
|
+
* set to false, this loop will run until it finds the minimal
|
|
108
|
+
* edit script */
|
|
109
|
+
for (iterations = 1;;iterations++) {
|
|
110
|
+
S32 diag;
|
|
111
|
+
int bigSnake = 0;
|
|
112
|
+
|
|
113
|
+
if (forwardMin > diagMin) {
|
|
114
|
+
forwardMin--;
|
|
115
|
+
forwardDiag[forwardMin - 1] = -1;
|
|
116
|
+
} else {
|
|
117
|
+
forwardMin++;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (forwardMax < diagMax) {
|
|
121
|
+
forwardMax++;
|
|
122
|
+
forwardDiag[forwardMax + 1] = -1;
|
|
123
|
+
} else {
|
|
124
|
+
forwardMax--;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
for (diag = forwardMax; diag >= forwardMin; diag -= 2) {
|
|
128
|
+
S32 dictIdx;
|
|
129
|
+
S32 srcIdx;
|
|
130
|
+
S32 low = forwardDiag[diag - 1];
|
|
131
|
+
S32 high = forwardDiag[diag + 1];
|
|
132
|
+
S32 dictIdx0 = low < high ? high : low + 1;
|
|
133
|
+
|
|
134
|
+
for (dictIdx = dictIdx0, srcIdx = dictIdx0 - diag;
|
|
135
|
+
dictIdx < dictHigh && srcIdx < srcHigh && dict[dictIdx] == src[srcIdx];
|
|
136
|
+
dictIdx++, srcIdx++) continue;
|
|
137
|
+
|
|
138
|
+
if (dictIdx - dictIdx0 > ZSTD_EDIST_SNAKE_THRESH)
|
|
139
|
+
bigSnake = 1;
|
|
140
|
+
|
|
141
|
+
forwardDiag[diag] = dictIdx;
|
|
142
|
+
|
|
143
|
+
if (odd && backwardMin <= diag && diag <= backwardMax && backwardDiag[diag] <= dictIdx) {
|
|
144
|
+
partition->dictMid = dictIdx;
|
|
145
|
+
partition->srcMid = srcIdx;
|
|
146
|
+
partition->lowUseHeuristics = 0;
|
|
147
|
+
partition->highUseHeuristics = 0;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (backwardMin > diagMin) {
|
|
153
|
+
backwardMin--;
|
|
154
|
+
backwardDiag[backwardMin - 1] = ZSTD_EDIST_DIAG_MAX;
|
|
155
|
+
} else {
|
|
156
|
+
backwardMin++;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (backwardMax < diagMax) {
|
|
160
|
+
backwardMax++;
|
|
161
|
+
backwardDiag[backwardMax + 1] = ZSTD_EDIST_DIAG_MAX;
|
|
162
|
+
} else {
|
|
163
|
+
backwardMax--;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
for (diag = backwardMax; diag >= backwardMin; diag -= 2) {
|
|
168
|
+
S32 dictIdx;
|
|
169
|
+
S32 srcIdx;
|
|
170
|
+
S32 low = backwardDiag[diag - 1];
|
|
171
|
+
S32 high = backwardDiag[diag + 1];
|
|
172
|
+
S32 dictIdx0 = low < high ? low : high - 1;
|
|
173
|
+
|
|
174
|
+
for (dictIdx = dictIdx0, srcIdx = dictIdx0 - diag;
|
|
175
|
+
dictLow < dictIdx && srcLow < srcIdx && dict[dictIdx - 1] == src[srcIdx - 1];
|
|
176
|
+
dictIdx--, srcIdx--) continue;
|
|
177
|
+
|
|
178
|
+
if (dictIdx0 - dictIdx > ZSTD_EDIST_SNAKE_THRESH)
|
|
179
|
+
bigSnake = 1;
|
|
180
|
+
|
|
181
|
+
backwardDiag[diag] = dictIdx;
|
|
182
|
+
|
|
183
|
+
if (!odd && forwardMin <= diag && diag <= forwardMax && dictIdx <= forwardDiag[diag]) {
|
|
184
|
+
partition->dictMid = dictIdx;
|
|
185
|
+
partition->srcMid = srcIdx;
|
|
186
|
+
partition->lowUseHeuristics = 0;
|
|
187
|
+
partition->highUseHeuristics = 0;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (!useHeuristics)
|
|
193
|
+
continue;
|
|
194
|
+
|
|
195
|
+
/* Everything under this point is a heuristic. Using these will
|
|
196
|
+
* substantially speed up the match finding. In some cases, taking
|
|
197
|
+
* the total match finding time from several minutes to seconds.
|
|
198
|
+
* Of course, the caveat is that the edit script found may no longer
|
|
199
|
+
* be optimal */
|
|
200
|
+
|
|
201
|
+
/* Big snake heuristic */
|
|
202
|
+
if (iterations > ZSTD_EDIST_SNAKE_ITER_THRESH && bigSnake) {
|
|
203
|
+
{
|
|
204
|
+
S32 best = 0;
|
|
205
|
+
|
|
206
|
+
for (diag = forwardMax; diag >= forwardMin; diag -= 2) {
|
|
207
|
+
S32 diagDiag = diag - forwardMid;
|
|
208
|
+
S32 dictIdx = forwardDiag[diag];
|
|
209
|
+
S32 srcIdx = dictIdx - diag;
|
|
210
|
+
S32 v = (dictIdx - dictLow) * 2 - diagDiag;
|
|
211
|
+
|
|
212
|
+
if (v > 12 * (iterations + (diagDiag < 0 ? -diagDiag : diagDiag))) {
|
|
213
|
+
if (v > best
|
|
214
|
+
&& dictLow + ZSTD_EDIST_SNAKE_THRESH <= dictIdx && dictIdx <= dictHigh
|
|
215
|
+
&& srcLow + ZSTD_EDIST_SNAKE_THRESH <= srcIdx && srcIdx <= srcHigh) {
|
|
216
|
+
S32 k;
|
|
217
|
+
for (k = 1; dict[dictIdx - k] == src[srcIdx - k]; k++) {
|
|
218
|
+
if (k == ZSTD_EDIST_SNAKE_THRESH) {
|
|
219
|
+
best = v;
|
|
220
|
+
partition->dictMid = dictIdx;
|
|
221
|
+
partition->srcMid = srcIdx;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (best > 0) {
|
|
230
|
+
partition->lowUseHeuristics = 0;
|
|
231
|
+
partition->highUseHeuristics = 1;
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
{
|
|
237
|
+
S32 best = 0;
|
|
238
|
+
|
|
239
|
+
for (diag = backwardMax; diag >= backwardMin; diag -= 2) {
|
|
240
|
+
S32 diagDiag = diag - backwardMid;
|
|
241
|
+
S32 dictIdx = backwardDiag[diag];
|
|
242
|
+
S32 srcIdx = dictIdx - diag;
|
|
243
|
+
S32 v = (dictHigh - dictIdx) * 2 + diagDiag;
|
|
244
|
+
|
|
245
|
+
if (v > 12 * (iterations + (diagDiag < 0 ? -diagDiag : diagDiag))) {
|
|
246
|
+
if (v > best
|
|
247
|
+
&& dictLow < dictIdx && dictIdx <= dictHigh - ZSTD_EDIST_SNAKE_THRESH
|
|
248
|
+
&& srcLow < srcIdx && srcIdx <= srcHigh - ZSTD_EDIST_SNAKE_THRESH) {
|
|
249
|
+
int k;
|
|
250
|
+
for (k = 0; dict[dictIdx + k] == src[srcIdx + k]; k++) {
|
|
251
|
+
if (k == ZSTD_EDIST_SNAKE_THRESH - 1) {
|
|
252
|
+
best = v;
|
|
253
|
+
partition->dictMid = dictIdx;
|
|
254
|
+
partition->srcMid = srcIdx;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (best > 0) {
|
|
263
|
+
partition->lowUseHeuristics = 1;
|
|
264
|
+
partition->highUseHeuristics = 0;
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* More general 'too expensive' heuristic */
|
|
271
|
+
if (iterations >= ZSTD_EDIST_EXPENSIVE_THRESH) {
|
|
272
|
+
S32 forwardDictSrcBest;
|
|
273
|
+
S32 forwardDictBest = 0;
|
|
274
|
+
S32 backwardDictSrcBest;
|
|
275
|
+
S32 backwardDictBest = 0;
|
|
276
|
+
|
|
277
|
+
forwardDictSrcBest = -1;
|
|
278
|
+
for (diag = forwardMax; diag >= forwardMin; diag -= 2) {
|
|
279
|
+
S32 dictIdx = MIN(forwardDiag[diag], dictHigh);
|
|
280
|
+
S32 srcIdx = dictIdx - diag;
|
|
281
|
+
|
|
282
|
+
if (srcHigh < srcIdx) {
|
|
283
|
+
dictIdx = srcHigh + diag;
|
|
284
|
+
srcIdx = srcHigh;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (forwardDictSrcBest < dictIdx + srcIdx) {
|
|
288
|
+
forwardDictSrcBest = dictIdx + srcIdx;
|
|
289
|
+
forwardDictBest = dictIdx;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
backwardDictSrcBest = ZSTD_EDIST_DIAG_MAX;
|
|
294
|
+
for (diag = backwardMax; diag >= backwardMin; diag -= 2) {
|
|
295
|
+
S32 dictIdx = MAX(dictLow, backwardDiag[diag]);
|
|
296
|
+
S32 srcIdx = dictIdx - diag;
|
|
297
|
+
|
|
298
|
+
if (srcIdx < srcLow) {
|
|
299
|
+
dictIdx = srcLow + diag;
|
|
300
|
+
srcIdx = srcLow;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (dictIdx + srcIdx < backwardDictSrcBest) {
|
|
304
|
+
backwardDictSrcBest = dictIdx + srcIdx;
|
|
305
|
+
backwardDictBest = dictIdx;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if ((dictHigh + srcHigh) - backwardDictSrcBest < forwardDictSrcBest - (dictLow + srcLow)) {
|
|
310
|
+
partition->dictMid = forwardDictBest;
|
|
311
|
+
partition->srcMid = forwardDictSrcBest - forwardDictBest;
|
|
312
|
+
partition->lowUseHeuristics = 0;
|
|
313
|
+
partition->highUseHeuristics = 1;
|
|
314
|
+
} else {
|
|
315
|
+
partition->dictMid = backwardDictBest;
|
|
316
|
+
partition->srcMid = backwardDictSrcBest - backwardDictBest;
|
|
317
|
+
partition->lowUseHeuristics = 1;
|
|
318
|
+
partition->highUseHeuristics = 0;
|
|
319
|
+
}
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
static void ZSTD_eDist_insertMatch(ZSTD_eDist_state* state,
|
|
326
|
+
S32 const dictIdx, S32 const srcIdx)
|
|
327
|
+
{
|
|
328
|
+
state->matches[state->nbMatches].dictIdx = dictIdx;
|
|
329
|
+
state->matches[state->nbMatches].srcIdx = srcIdx;
|
|
330
|
+
state->matches[state->nbMatches].matchLength = 1;
|
|
331
|
+
state->nbMatches++;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
static int ZSTD_eDist_compare(ZSTD_eDist_state* state,
|
|
335
|
+
S32 dictLow, S32 dictHigh, S32 srcLow,
|
|
336
|
+
S32 srcHigh, int useHeuristics)
|
|
337
|
+
{
|
|
338
|
+
const BYTE* const dict = state->dict;
|
|
339
|
+
const BYTE* const src = state->src;
|
|
340
|
+
|
|
341
|
+
/* Found matches while traversing from the low end */
|
|
342
|
+
while (dictLow < dictHigh && srcLow < srcHigh && dict[dictLow] == src[srcLow]) {
|
|
343
|
+
ZSTD_eDist_insertMatch(state, dictLow, srcLow);
|
|
344
|
+
dictLow++;
|
|
345
|
+
srcLow++;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* Found matches while traversing from the high end */
|
|
349
|
+
while (dictLow < dictHigh && srcLow < srcHigh && dict[dictHigh - 1] == src[srcHigh - 1]) {
|
|
350
|
+
ZSTD_eDist_insertMatch(state, dictHigh - 1, srcHigh - 1);
|
|
351
|
+
dictHigh--;
|
|
352
|
+
srcHigh--;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/* If the low and high end end up touching. If we wanted to make
|
|
356
|
+
* note of the differences like most diffing algorithms do, we would
|
|
357
|
+
* do so here. In our case, we're only concerned with matches
|
|
358
|
+
* Note: if you wanted to find the edit distance of the algorithm,
|
|
359
|
+
* you could just accumulate the cost for an insertion/deletion
|
|
360
|
+
* below. */
|
|
361
|
+
if (dictLow == dictHigh) {
|
|
362
|
+
while (srcLow < srcHigh) {
|
|
363
|
+
/* Reaching this point means inserting src[srcLow] into
|
|
364
|
+
* the current position of dict */
|
|
365
|
+
srcLow++;
|
|
366
|
+
}
|
|
367
|
+
} else if (srcLow == srcHigh) {
|
|
368
|
+
while (dictLow < dictHigh) {
|
|
369
|
+
/* Reaching this point means deleting dict[dictLow] from
|
|
370
|
+
* the current position of dict */
|
|
371
|
+
dictLow++;
|
|
372
|
+
}
|
|
373
|
+
} else {
|
|
374
|
+
ZSTD_eDist_partition partition;
|
|
375
|
+
partition.dictMid = 0;
|
|
376
|
+
partition.srcMid = 0;
|
|
377
|
+
ZSTD_eDist_diag(state, &partition, dictLow, dictHigh,
|
|
378
|
+
srcLow, srcHigh, useHeuristics);
|
|
379
|
+
if (ZSTD_eDist_compare(state, dictLow, partition.dictMid,
|
|
380
|
+
srcLow, partition.srcMid, partition.lowUseHeuristics))
|
|
381
|
+
return 1;
|
|
382
|
+
if (ZSTD_eDist_compare(state, partition.dictMid, dictHigh,
|
|
383
|
+
partition.srcMid, srcHigh, partition.highUseHeuristics))
|
|
384
|
+
return 1;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return 0;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
static int ZSTD_eDist_matchComp(const void* p, const void* q)
|
|
391
|
+
{
|
|
392
|
+
S32 const l = ((ZSTD_eDist_match*)p)->srcIdx;
|
|
393
|
+
S32 const r = ((ZSTD_eDist_match*)q)->srcIdx;
|
|
394
|
+
return (l - r);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* The matches from the approach above will all be of the form
|
|
398
|
+
* (dictIdx, srcIdx, 1). This method combines contiguous matches
|
|
399
|
+
* of length MINMATCH or greater. Matches less than MINMATCH
|
|
400
|
+
* are discarded */
|
|
401
|
+
static void ZSTD_eDist_combineMatches(ZSTD_eDist_state* state)
|
|
402
|
+
{
|
|
403
|
+
/* Create a new buffer to put the combined matches into
|
|
404
|
+
* and memcpy to state->matches after */
|
|
405
|
+
ZSTD_eDist_match* combinedMatches =
|
|
406
|
+
ZSTD_malloc(state->nbMatches * sizeof(ZSTD_eDist_match),
|
|
407
|
+
ZSTD_defaultCMem);
|
|
408
|
+
|
|
409
|
+
U32 nbCombinedMatches = 1;
|
|
410
|
+
size_t i;
|
|
411
|
+
|
|
412
|
+
/* Make sure that the srcIdx and dictIdx are in sorted order.
|
|
413
|
+
* The combination step won't work otherwise */
|
|
414
|
+
qsort(state->matches, state->nbMatches, sizeof(ZSTD_eDist_match), ZSTD_eDist_matchComp);
|
|
415
|
+
|
|
416
|
+
memcpy(combinedMatches, state->matches, sizeof(ZSTD_eDist_match));
|
|
417
|
+
for (i = 1; i < state->nbMatches; i++) {
|
|
418
|
+
ZSTD_eDist_match const match = state->matches[i];
|
|
419
|
+
ZSTD_eDist_match const combinedMatch =
|
|
420
|
+
combinedMatches[nbCombinedMatches - 1];
|
|
421
|
+
if (combinedMatch.srcIdx + combinedMatch.matchLength == match.srcIdx &&
|
|
422
|
+
combinedMatch.dictIdx + combinedMatch.matchLength == match.dictIdx) {
|
|
423
|
+
combinedMatches[nbCombinedMatches - 1].matchLength++;
|
|
424
|
+
} else {
|
|
425
|
+
/* Discard matches that are less than MINMATCH */
|
|
426
|
+
if (combinedMatches[nbCombinedMatches - 1].matchLength < MINMATCH) {
|
|
427
|
+
nbCombinedMatches--;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
memcpy(combinedMatches + nbCombinedMatches,
|
|
431
|
+
state->matches + i, sizeof(ZSTD_eDist_match));
|
|
432
|
+
nbCombinedMatches++;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
memcpy(state->matches, combinedMatches, nbCombinedMatches * sizeof(ZSTD_eDist_match));
|
|
436
|
+
state->nbMatches = nbCombinedMatches;
|
|
437
|
+
ZSTD_free(combinedMatches, ZSTD_defaultCMem);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
static size_t ZSTD_eDist_convertMatchesToSequences(ZSTD_Sequence* sequences,
|
|
441
|
+
ZSTD_eDist_state* state)
|
|
442
|
+
{
|
|
443
|
+
const ZSTD_eDist_match* matches = state->matches;
|
|
444
|
+
size_t const nbMatches = state->nbMatches;
|
|
445
|
+
size_t const dictSize = state->dictSize;
|
|
446
|
+
size_t nbSequences = 0;
|
|
447
|
+
size_t i;
|
|
448
|
+
for (i = 0; i < nbMatches; i++) {
|
|
449
|
+
ZSTD_eDist_match const match = matches[i];
|
|
450
|
+
U32 const litLength = !i ? match.srcIdx :
|
|
451
|
+
match.srcIdx - (matches[i - 1].srcIdx + matches[i - 1].matchLength);
|
|
452
|
+
U32 const offset = (match.srcIdx + dictSize) - match.dictIdx;
|
|
453
|
+
U32 const matchLength = match.matchLength;
|
|
454
|
+
sequences[nbSequences].offset = offset;
|
|
455
|
+
sequences[nbSequences].litLength = litLength;
|
|
456
|
+
sequences[nbSequences].matchLength = matchLength;
|
|
457
|
+
nbSequences++;
|
|
458
|
+
}
|
|
459
|
+
return nbSequences;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/*-*************************************
|
|
463
|
+
* Internal utils
|
|
464
|
+
***************************************/
|
|
465
|
+
|
|
466
|
+
static size_t ZSTD_eDist_hamingDist(const BYTE* const a,
|
|
467
|
+
const BYTE* const b, size_t n)
|
|
468
|
+
{
|
|
469
|
+
size_t i;
|
|
470
|
+
size_t dist = 0;
|
|
471
|
+
for (i = 0; i < n; i++)
|
|
472
|
+
dist += a[i] != b[i];
|
|
473
|
+
return dist;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/* This is a pretty naive recursive implementation that should only
|
|
477
|
+
* be used for quick tests obviously. Don't try and run this on a
|
|
478
|
+
* GB file or something. There are faster implementations. Use those
|
|
479
|
+
* if you need to run it for large files. */
|
|
480
|
+
static size_t ZSTD_eDist_levenshteinDist(const BYTE* const s,
|
|
481
|
+
size_t const sn, const BYTE* const t,
|
|
482
|
+
size_t const tn)
|
|
483
|
+
{
|
|
484
|
+
size_t a, b, c;
|
|
485
|
+
|
|
486
|
+
if (!sn)
|
|
487
|
+
return tn;
|
|
488
|
+
if (!tn)
|
|
489
|
+
return sn;
|
|
490
|
+
|
|
491
|
+
if (s[sn - 1] == t[tn - 1])
|
|
492
|
+
return ZSTD_eDist_levenshteinDist(
|
|
493
|
+
s, sn - 1, t, tn - 1);
|
|
494
|
+
|
|
495
|
+
a = ZSTD_eDist_levenshteinDist(s, sn - 1, t, tn - 1);
|
|
496
|
+
b = ZSTD_eDist_levenshteinDist(s, sn, t, tn - 1);
|
|
497
|
+
c = ZSTD_eDist_levenshteinDist(s, sn - 1, t, tn);
|
|
498
|
+
|
|
499
|
+
if (a > b)
|
|
500
|
+
a = b;
|
|
501
|
+
if (a > c)
|
|
502
|
+
a = c;
|
|
503
|
+
|
|
504
|
+
return a + 1;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
static void ZSTD_eDist_validateMatches(ZSTD_eDist_match* matches,
|
|
508
|
+
size_t const nbMatches, const BYTE* const dict,
|
|
509
|
+
size_t const dictSize, const BYTE* const src,
|
|
510
|
+
size_t const srcSize)
|
|
511
|
+
{
|
|
512
|
+
size_t i;
|
|
513
|
+
for (i = 0; i < nbMatches; i++) {
|
|
514
|
+
ZSTD_eDist_match match = matches[i];
|
|
515
|
+
U32 const dictIdx = match.dictIdx;
|
|
516
|
+
U32 const srcIdx = match.srcIdx;
|
|
517
|
+
U32 const matchLength = match.matchLength;
|
|
518
|
+
|
|
519
|
+
assert(dictIdx + matchLength < dictSize);
|
|
520
|
+
assert(srcIdx + matchLength < srcSize);
|
|
521
|
+
assert(!memcmp(dict + dictIdx, src + srcIdx, matchLength));
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/*-*************************************
|
|
526
|
+
* API
|
|
527
|
+
***************************************/
|
|
528
|
+
|
|
529
|
+
size_t ZSTD_eDist_genSequences(ZSTD_Sequence* sequences,
|
|
530
|
+
const void* dict, size_t dictSize,
|
|
531
|
+
const void* src, size_t srcSize,
|
|
532
|
+
int useHeuristics)
|
|
533
|
+
{
|
|
534
|
+
size_t const nbDiags = dictSize + srcSize + 3;
|
|
535
|
+
S32* buffer = ZSTD_malloc(nbDiags * 2 * sizeof(S32), ZSTD_defaultCMem);
|
|
536
|
+
ZSTD_eDist_state state;
|
|
537
|
+
size_t nbSequences = 0;
|
|
538
|
+
|
|
539
|
+
state.dict = (const BYTE*)dict;
|
|
540
|
+
state.src = (const BYTE*)src;
|
|
541
|
+
state.dictSize = dictSize;
|
|
542
|
+
state.srcSize = srcSize;
|
|
543
|
+
state.forwardDiag = buffer;
|
|
544
|
+
state.backwardDiag = buffer + nbDiags;
|
|
545
|
+
state.forwardDiag += srcSize + 1;
|
|
546
|
+
state.backwardDiag += srcSize + 1;
|
|
547
|
+
state.matches = ZSTD_malloc(srcSize * sizeof(ZSTD_eDist_match), ZSTD_defaultCMem);
|
|
548
|
+
state.nbMatches = 0;
|
|
549
|
+
|
|
550
|
+
ZSTD_eDist_compare(&state, 0, dictSize, 0, srcSize, 1);
|
|
551
|
+
ZSTD_eDist_combineMatches(&state);
|
|
552
|
+
nbSequences = ZSTD_eDist_convertMatchesToSequences(sequences, &state);
|
|
553
|
+
|
|
554
|
+
ZSTD_free(buffer, ZSTD_defaultCMem);
|
|
555
|
+
ZSTD_free(state.matches, ZSTD_defaultCMem);
|
|
556
|
+
|
|
557
|
+
return nbSequences;
|
|
558
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under both the BSD-style license (found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
7
|
+
* in the COPYING file in the root directory of this source tree).
|
|
8
|
+
* You may select, at your option, one of the above-listed licenses.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* This match finder leverages techniques used in file comparison algorithms
|
|
12
|
+
* to find matches between a dictionary and a source file.
|
|
13
|
+
*
|
|
14
|
+
* The original motivation for studying this approach was to try and optimize
|
|
15
|
+
* Zstandard for the use case of patching: the most common scenario being
|
|
16
|
+
* updating an existing software package with the next version. When patching,
|
|
17
|
+
* the difference between the old version of the package and the new version
|
|
18
|
+
* is generally tiny (most of the new file will be identical to
|
|
19
|
+
* the old one). In more technical terms, the edit distance (the minimal number
|
|
20
|
+
* of changes required to take one sequence of bytes to another) between the
|
|
21
|
+
* files would be small relative to the size of the file.
|
|
22
|
+
*
|
|
23
|
+
* Various 'diffing' algorithms utilize this notion of edit distance and
|
|
24
|
+
* the corresponding concept of a minimal edit script between two
|
|
25
|
+
* sequences to identify the regions within two files where they differ.
|
|
26
|
+
* The core algorithm used in this match finder is described in:
|
|
27
|
+
*
|
|
28
|
+
* "An O(ND) Difference Algorithm and its Variations", Eugene W. Myers,
|
|
29
|
+
* Algorithmica Vol. 1, 1986, pp. 251-266,
|
|
30
|
+
* <https://doi.org/10.1007/BF01840446>.
|
|
31
|
+
*
|
|
32
|
+
* Additional algorithmic heuristics for speed improvement have also been included.
|
|
33
|
+
* These we inspired from implementations of various regular and binary diffing
|
|
34
|
+
* algorithms such as GNU diff, bsdiff, and Xdelta.
|
|
35
|
+
*
|
|
36
|
+
* Note: after some experimentation, this approach proved to not provide enough
|
|
37
|
+
* utility to justify the additional CPU used in finding matches. The one area
|
|
38
|
+
* where this approach consistently outperforms Zstandard even on level 19 is
|
|
39
|
+
* when compressing small files (<10 KB) using an equally small dictionary that
|
|
40
|
+
* is very similar to the source file. For the use case that this was intended,
|
|
41
|
+
* (large similar files) this approach by itself took 5-10X longer than zstd-19 and
|
|
42
|
+
* generally resulted in 2-3X larger files. The core advantage that zstd-19 has
|
|
43
|
+
* over this approach for match finding is the overlapping matches. This approach
|
|
44
|
+
* cannot find any.
|
|
45
|
+
*
|
|
46
|
+
* I'm leaving this in the contrib section in case this ever becomes interesting
|
|
47
|
+
* to explore again.
|
|
48
|
+
* */
|
|
49
|
+
|
|
50
|
+
#ifndef ZSTD_EDIST_H
|
|
51
|
+
#define ZSTD_EDIST_H
|
|
52
|
+
|
|
53
|
+
/*-*************************************
|
|
54
|
+
* Dependencies
|
|
55
|
+
***************************************/
|
|
56
|
+
|
|
57
|
+
#include <stddef.h>
|
|
58
|
+
#include "zstd_internal.h" /* ZSTD_Sequence */
|
|
59
|
+
|
|
60
|
+
/*! ZSTD_eDist_genSequences() :
|
|
61
|
+
* Will populate the provided ZSTD_Sequence buffer with sequences
|
|
62
|
+
* based on the optimal or near-optimal (depending on 'useHeuristics')
|
|
63
|
+
* edit script between 'dict' and 'src.'
|
|
64
|
+
* @return : the number of sequences found */
|
|
65
|
+
size_t ZSTD_eDist_genSequences(ZSTD_Sequence* sequences,
|
|
66
|
+
const void* dict, size_t dictSize,
|
|
67
|
+
const void* src, size_t srcSize,
|
|
68
|
+
int useHeuristics);
|
|
69
|
+
|
|
70
|
+
#endif
|