multi_compress 0.3.2 → 0.3.4
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 +4 -4
- data/CHANGELOG.md +17 -3
- data/GET_STARTED.md +3 -3
- data/README.md +75 -66
- data/THIRD_PARTY_NOTICES.md +24 -0
- data/ext/multi_compress/brotli_dec_static_init.c +3 -0
- data/ext/multi_compress/brotli_enc_static_init.c +3 -0
- data/ext/multi_compress/extconf.rb +79 -3
- data/ext/multi_compress/multi_compress.c +199 -120
- data/ext/multi_compress/vendor/.vendored +2 -2
- data/ext/multi_compress/vendor/brotli/LICENSE +19 -0
- data/ext/multi_compress/vendor/brotli/c/common/constants.c +7 -7
- data/ext/multi_compress/vendor/brotli/c/common/constants.h +2 -5
- data/ext/multi_compress/vendor/brotli/c/common/context.c +2 -2
- data/ext/multi_compress/vendor/brotli/c/common/context.h +1 -2
- data/ext/multi_compress/vendor/brotli/c/common/dictionary.c +4 -5856
- data/ext/multi_compress/vendor/brotli/c/common/dictionary.h +1 -2
- data/ext/multi_compress/vendor/brotli/c/common/dictionary_inc.h +5847 -0
- data/ext/multi_compress/vendor/brotli/c/common/platform.c +0 -4
- data/ext/multi_compress/vendor/brotli/c/common/platform.h +182 -43
- data/ext/multi_compress/vendor/brotli/c/common/shared_dictionary.c +3 -7
- data/ext/multi_compress/vendor/brotli/c/common/shared_dictionary_internal.h +1 -1
- data/ext/multi_compress/vendor/brotli/c/common/static_init.h +56 -0
- data/ext/multi_compress/vendor/brotli/c/common/transform.c +6 -4
- data/ext/multi_compress/vendor/brotli/c/common/transform.h +1 -2
- data/ext/multi_compress/vendor/brotli/c/common/version.h +3 -3
- data/ext/multi_compress/vendor/brotli/c/dec/bit_reader.c +2 -3
- data/ext/multi_compress/vendor/brotli/c/dec/bit_reader.h +0 -4
- data/ext/multi_compress/vendor/brotli/c/dec/decode.c +128 -39
- data/ext/multi_compress/vendor/brotli/c/dec/huffman.c +2 -5
- data/ext/multi_compress/vendor/brotli/c/dec/huffman.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/dec/prefix.c +67 -0
- data/ext/multi_compress/vendor/brotli/c/dec/prefix.h +18 -708
- data/ext/multi_compress/vendor/brotli/c/dec/prefix_inc.h +707 -0
- data/ext/multi_compress/vendor/brotli/c/dec/state.c +18 -15
- data/ext/multi_compress/vendor/brotli/c/dec/state.h +2 -6
- data/ext/multi_compress/vendor/brotli/c/dec/static_init.c +53 -0
- data/ext/multi_compress/vendor/brotli/c/dec/static_init.h +30 -0
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references.c +32 -8
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references.h +1 -5
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references_hq.c +15 -15
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references_hq.h +1 -5
- data/ext/multi_compress/vendor/brotli/c/enc/bit_cost.c +28 -4
- data/ext/multi_compress/vendor/brotli/c/enc/bit_cost.h +8 -40
- data/ext/multi_compress/vendor/brotli/c/enc/bit_cost_inc.h +1 -1
- data/ext/multi_compress/vendor/brotli/c/enc/block_splitter.c +9 -12
- data/ext/multi_compress/vendor/brotli/c/enc/block_splitter.h +0 -3
- data/ext/multi_compress/vendor/brotli/c/enc/block_splitter_inc.h +14 -8
- data/ext/multi_compress/vendor/brotli/c/enc/brotli_bit_stream.c +10 -9
- data/ext/multi_compress/vendor/brotli/c/enc/brotli_bit_stream.h +0 -6
- data/ext/multi_compress/vendor/brotli/c/enc/cluster.c +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/cluster.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/command.c +1 -1
- data/ext/multi_compress/vendor/brotli/c/enc/command.h +8 -10
- data/ext/multi_compress/vendor/brotli/c/enc/compound_dictionary.c +3 -5
- data/ext/multi_compress/vendor/brotli/c/enc/compound_dictionary.h +1 -4
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment.c +3 -13
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment_two_pass.c +5 -15
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment_two_pass.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/dictionary_hash.c +127 -1830
- data/ext/multi_compress/vendor/brotli/c/enc/dictionary_hash.h +23 -3
- data/ext/multi_compress/vendor/brotli/c/enc/dictionary_hash_inc.h +1829 -0
- data/ext/multi_compress/vendor/brotli/c/enc/encode.c +77 -52
- data/ext/multi_compress/vendor/brotli/c/enc/encoder_dict.c +9 -7
- data/ext/multi_compress/vendor/brotli/c/enc/encoder_dict.h +2 -4
- data/ext/multi_compress/vendor/brotli/c/enc/entropy_encode.c +3 -6
- data/ext/multi_compress/vendor/brotli/c/enc/entropy_encode.h +2 -4
- data/ext/multi_compress/vendor/brotli/c/enc/entropy_encode_static.h +18 -12
- data/ext/multi_compress/vendor/brotli/c/enc/fast_log.c +1 -1
- data/ext/multi_compress/vendor/brotli/c/enc/fast_log.h +2 -3
- data/ext/multi_compress/vendor/brotli/c/enc/find_match_length.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/hash.h +38 -31
- data/ext/multi_compress/vendor/brotli/c/enc/hash_base.h +38 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_forgetful_chain_inc.h +11 -1
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match64_inc.h +24 -7
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match64_simd_inc.h +304 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match_inc.h +30 -11
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match_quickly_inc.h +4 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match_simd_inc.h +278 -0
- data/ext/multi_compress/vendor/brotli/c/enc/histogram.c +1 -0
- data/ext/multi_compress/vendor/brotli/c/enc/histogram.h +0 -4
- data/ext/multi_compress/vendor/brotli/c/enc/literal_cost.c +4 -6
- data/ext/multi_compress/vendor/brotli/c/enc/literal_cost.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/matching_tag_mask.h +69 -0
- data/ext/multi_compress/vendor/brotli/c/enc/memory.c +0 -5
- data/ext/multi_compress/vendor/brotli/c/enc/memory.h +0 -4
- data/ext/multi_compress/vendor/brotli/c/enc/metablock.c +7 -9
- data/ext/multi_compress/vendor/brotli/c/enc/metablock.h +3 -3
- data/ext/multi_compress/vendor/brotli/c/enc/metablock_inc.h +4 -4
- data/ext/multi_compress/vendor/brotli/c/enc/params.h +0 -1
- data/ext/multi_compress/vendor/brotli/c/enc/prefix.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/quality.h +17 -10
- data/ext/multi_compress/vendor/brotli/c/enc/ringbuffer.h +1 -4
- data/ext/multi_compress/vendor/brotli/c/enc/state.h +2 -2
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict.c +5 -11
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict.h +1 -3
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict_lut.c +224 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict_lut.h +20 -5837
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict_lut_inc.h +5830 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_init.c +59 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_init.h +30 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_init_lazy.cc +26 -0
- data/ext/multi_compress/vendor/brotli/c/enc/utf8_util.c +1 -1
- data/ext/multi_compress/vendor/brotli/c/enc/utf8_util.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/write_bits.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/include/brotli/decode.h +1 -1
- data/ext/multi_compress/vendor/brotli/c/include/brotli/encode.h +5 -1
- data/ext/multi_compress/vendor/brotli/c/include/brotli/port.h +4 -7
- data/ext/multi_compress/vendor/brotli/c/include/brotli/types.h +2 -2
- data/ext/multi_compress/vendor/lz4/LICENSE +12 -0
- data/ext/multi_compress/vendor/zstd/COPYING +339 -0
- data/ext/multi_compress/vendor/zstd/LICENSE +30 -0
- data/ext/multi_compress/vendor/zstd/lib/Makefile +67 -35
- data/ext/multi_compress/vendor/zstd/lib/README.md +33 -2
- data/ext/multi_compress/vendor/zstd/lib/common/allocations.h +55 -0
- data/ext/multi_compress/vendor/zstd/lib/common/bits.h +205 -0
- data/ext/multi_compress/vendor/zstd/lib/common/bitstream.h +84 -108
- data/ext/multi_compress/vendor/zstd/lib/common/compiler.h +170 -41
- data/ext/multi_compress/vendor/zstd/lib/common/cpu.h +37 -1
- data/ext/multi_compress/vendor/zstd/lib/common/debug.c +7 -1
- data/ext/multi_compress/vendor/zstd/lib/common/debug.h +21 -21
- data/ext/multi_compress/vendor/zstd/lib/common/entropy_common.c +12 -40
- data/ext/multi_compress/vendor/zstd/lib/common/error_private.c +10 -2
- data/ext/multi_compress/vendor/zstd/lib/common/error_private.h +46 -47
- data/ext/multi_compress/vendor/zstd/lib/common/fse.h +8 -100
- data/ext/multi_compress/vendor/zstd/lib/common/fse_decompress.c +28 -116
- data/ext/multi_compress/vendor/zstd/lib/common/huf.h +79 -166
- data/ext/multi_compress/vendor/zstd/lib/common/mem.h +46 -66
- data/ext/multi_compress/vendor/zstd/lib/common/pool.c +27 -11
- data/ext/multi_compress/vendor/zstd/lib/common/pool.h +8 -11
- data/ext/multi_compress/vendor/zstd/lib/common/portability_macros.h +45 -11
- data/ext/multi_compress/vendor/zstd/lib/common/threading.c +74 -14
- data/ext/multi_compress/vendor/zstd/lib/common/threading.h +5 -18
- data/ext/multi_compress/vendor/zstd/lib/common/xxhash.c +5 -11
- data/ext/multi_compress/vendor/zstd/lib/common/xxhash.h +2411 -1003
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_common.c +1 -36
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_deps.h +13 -1
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_internal.h +13 -182
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_trace.h +6 -13
- data/ext/multi_compress/vendor/zstd/lib/compress/clevels.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/fse_compress.c +15 -131
- data/ext/multi_compress/vendor/zstd/lib/compress/hist.c +11 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/hist.h +8 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/huf_compress.c +283 -189
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress.c +2419 -903
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_internal.h +423 -245
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_literals.c +116 -40
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_literals.h +16 -8
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_sequences.c +10 -10
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_sequences.h +8 -7
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_superblock.c +254 -139
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_superblock.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_cwksp.h +184 -95
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_double_fast.c +163 -81
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_double_fast.h +18 -14
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_fast.c +507 -197
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_fast.h +7 -14
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_lazy.c +579 -484
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_lazy.h +133 -65
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm.c +61 -40
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm.h +7 -15
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm_geartab.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_opt.c +352 -218
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_opt.h +37 -21
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_preSplit.c +238 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_preSplit.h +33 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstdmt_compress.c +239 -175
- data/ext/multi_compress/vendor/zstd/lib/compress/zstdmt_compress.h +5 -16
- data/ext/multi_compress/vendor/zstd/lib/decompress/huf_decompress.c +543 -488
- data/ext/multi_compress/vendor/zstd/lib/decompress/huf_decompress_amd64.S +78 -61
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_ddict.c +4 -4
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_ddict.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress.c +295 -115
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_block.c +430 -293
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_block.h +7 -2
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_internal.h +11 -7
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff_common.c +1 -1
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff_compress.c +1 -1
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff_decompress.c +3 -1
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/cover.c +95 -46
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/cover.h +3 -9
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/divsufsort.h +0 -10
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/fastcover.c +4 -4
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/zdict.c +25 -97
- data/ext/multi_compress/vendor/zstd/lib/dll/example/Makefile +1 -1
- data/ext/multi_compress/vendor/zstd/lib/dll/example/README.md +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_legacy.h +38 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v01.c +19 -50
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v01.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v02.c +27 -80
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v02.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v03.c +28 -83
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v03.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v04.c +25 -74
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v04.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v05.c +31 -76
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v05.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v06.c +44 -88
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v06.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v07.c +33 -84
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v07.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/libzstd.mk +65 -33
- data/ext/multi_compress/vendor/zstd/lib/libzstd.pc.in +5 -5
- data/ext/multi_compress/vendor/zstd/lib/module.modulemap +13 -3
- data/ext/multi_compress/vendor/zstd/lib/zdict.h +65 -36
- data/ext/multi_compress/vendor/zstd/lib/zstd.h +890 -267
- data/ext/multi_compress/vendor/zstd/lib/zstd_errors.h +28 -16
- data/lib/multi_compress/version.rb +1 -1
- data/lib/multi_compress.rb +80 -41
- metadata +29 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) Yann Collet,
|
|
2
|
+
* Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
#define HUFv07_STATIC_LINKING_ONLY /* HUFv07_TABLELOG_ABSOLUTEMAX */
|
|
25
25
|
#define ZSTDv07_STATIC_LINKING_ONLY
|
|
26
26
|
|
|
27
|
+
#include "../common/compiler.h"
|
|
27
28
|
#include "../common/error_private.h"
|
|
28
29
|
|
|
29
30
|
|
|
@@ -184,7 +185,7 @@ ZSTDLIBv07_API size_t ZSTDv07_insertBlock(ZSTDv07_DCtx* dctx, const void* blockS
|
|
|
184
185
|
low-level memory access routines
|
|
185
186
|
Copyright (C) 2013-2015, Yann Collet.
|
|
186
187
|
|
|
187
|
-
BSD 2-Clause License (
|
|
188
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
188
189
|
|
|
189
190
|
Redistribution and use in source and binary forms, with or without
|
|
190
191
|
modification, are permitted provided that the following conditions are
|
|
@@ -227,15 +228,6 @@ extern "C" {
|
|
|
227
228
|
# include <stdlib.h> /* _byteswap_ulong */
|
|
228
229
|
# include <intrin.h> /* _byteswap_* */
|
|
229
230
|
#endif
|
|
230
|
-
#if defined(__GNUC__)
|
|
231
|
-
# define MEM_STATIC static __attribute__((unused))
|
|
232
|
-
#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
|
233
|
-
# define MEM_STATIC static inline
|
|
234
|
-
#elif defined(_MSC_VER)
|
|
235
|
-
# define MEM_STATIC static __inline
|
|
236
|
-
#else
|
|
237
|
-
# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */
|
|
238
|
-
#endif
|
|
239
231
|
|
|
240
232
|
|
|
241
233
|
/*-**************************************************************
|
|
@@ -268,24 +260,6 @@ extern "C" {
|
|
|
268
260
|
/*-**************************************************************
|
|
269
261
|
* Memory I/O
|
|
270
262
|
*****************************************************************/
|
|
271
|
-
/* MEM_FORCE_MEMORY_ACCESS :
|
|
272
|
-
* By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable.
|
|
273
|
-
* Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal.
|
|
274
|
-
* The below switch allow to select different access method for improved performance.
|
|
275
|
-
* Method 0 (default) : use `memcpy()`. Safe and portable.
|
|
276
|
-
* Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable).
|
|
277
|
-
* This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`.
|
|
278
|
-
* Method 2 : direct access. This method is portable but violate C standard.
|
|
279
|
-
* It can generate buggy code on targets depending on alignment.
|
|
280
|
-
* In some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6)
|
|
281
|
-
* See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details.
|
|
282
|
-
* Prefer these methods in priority order (0 > 1 > 2)
|
|
283
|
-
*/
|
|
284
|
-
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
|
285
|
-
# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
|
286
|
-
# define MEM_FORCE_MEMORY_ACCESS 1
|
|
287
|
-
# endif
|
|
288
|
-
#endif
|
|
289
263
|
|
|
290
264
|
MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
|
|
291
265
|
MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
|
|
@@ -296,33 +270,6 @@ MEM_STATIC unsigned MEM_isLittleEndian(void)
|
|
|
296
270
|
return one.c[0];
|
|
297
271
|
}
|
|
298
272
|
|
|
299
|
-
#if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2)
|
|
300
|
-
|
|
301
|
-
/* violates C standard, by lying on structure alignment.
|
|
302
|
-
Only use if no other choice to achieve best performance on target platform */
|
|
303
|
-
MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) memPtr; }
|
|
304
|
-
MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; }
|
|
305
|
-
MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; }
|
|
306
|
-
|
|
307
|
-
MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; }
|
|
308
|
-
|
|
309
|
-
#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1)
|
|
310
|
-
|
|
311
|
-
/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */
|
|
312
|
-
/* currently only defined for gcc and icc */
|
|
313
|
-
typedef union { U16 u16; U32 u32; U64 u64; size_t st; } __attribute__((packed)) unalign;
|
|
314
|
-
|
|
315
|
-
MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign*)ptr)->u16; }
|
|
316
|
-
MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32; }
|
|
317
|
-
MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; }
|
|
318
|
-
|
|
319
|
-
MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; }
|
|
320
|
-
|
|
321
|
-
#else
|
|
322
|
-
|
|
323
|
-
/* default method, safe and standard.
|
|
324
|
-
can sometimes prove slower */
|
|
325
|
-
|
|
326
273
|
MEM_STATIC U16 MEM_read16(const void* memPtr)
|
|
327
274
|
{
|
|
328
275
|
U16 val; memcpy(&val, memPtr, sizeof(val)); return val;
|
|
@@ -343,8 +290,6 @@ MEM_STATIC void MEM_write16(void* memPtr, U16 value)
|
|
|
343
290
|
memcpy(memPtr, &value, sizeof(value));
|
|
344
291
|
}
|
|
345
292
|
|
|
346
|
-
#endif /* MEM_FORCE_MEMORY_ACCESS */
|
|
347
|
-
|
|
348
293
|
MEM_STATIC U32 MEM_swap32(U32 in)
|
|
349
294
|
{
|
|
350
295
|
#if defined(_MSC_VER) /* Visual Studio */
|
|
@@ -439,7 +384,7 @@ MEM_STATIC size_t MEM_readLEST(const void* memPtr)
|
|
|
439
384
|
header file (to include)
|
|
440
385
|
Copyright (C) 2013-2016, Yann Collet.
|
|
441
386
|
|
|
442
|
-
BSD 2-Clause License (
|
|
387
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
443
388
|
|
|
444
389
|
Redistribution and use in source and binary forms, with or without
|
|
445
390
|
modification, are permitted provided that the following conditions are
|
|
@@ -596,7 +541,7 @@ MEM_STATIC size_t BITv07_initDStream(BITv07_DStream_t* bitD, const void* srcBuff
|
|
|
596
541
|
}
|
|
597
542
|
|
|
598
543
|
/*! BITv07_lookBitsFast() :
|
|
599
|
-
* unsafe version; only works
|
|
544
|
+
* unsafe version; only works if nbBits >= 1 */
|
|
600
545
|
MEM_STATIC size_t BITv07_lookBitsFast(const BITv07_DStream_t* bitD, U32 nbBits)
|
|
601
546
|
{
|
|
602
547
|
U32 const bitMask = sizeof(bitD->bitContainer)*8 - 1;
|
|
@@ -616,7 +561,7 @@ MEM_STATIC size_t BITv07_readBits(BITv07_DStream_t* bitD, U32 nbBits)
|
|
|
616
561
|
}
|
|
617
562
|
|
|
618
563
|
/*! BITv07_readBitsFast() :
|
|
619
|
-
* unsafe version; only works
|
|
564
|
+
* unsafe version; only works if nbBits >= 1 */
|
|
620
565
|
MEM_STATIC size_t BITv07_readBitsFast(BITv07_DStream_t* bitD, U32 nbBits)
|
|
621
566
|
{
|
|
622
567
|
size_t const value = BITv07_lookBitsFast(bitD, nbBits);
|
|
@@ -670,7 +615,7 @@ MEM_STATIC unsigned BITv07_endOfDStream(const BITv07_DStream_t* DStream)
|
|
|
670
615
|
Public Prototypes declaration
|
|
671
616
|
Copyright (C) 2013-2016, Yann Collet.
|
|
672
617
|
|
|
673
|
-
BSD 2-Clause License (
|
|
618
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
674
619
|
|
|
675
620
|
Redistribution and use in source and binary forms, with or without
|
|
676
621
|
modification, are permitted provided that the following conditions are
|
|
@@ -978,7 +923,7 @@ MEM_STATIC BYTE FSEv07_decodeSymbolFast(FSEv07_DState_t* DStatePtr, BITv07_DStre
|
|
|
978
923
|
header file
|
|
979
924
|
Copyright (C) 2013-2016, Yann Collet.
|
|
980
925
|
|
|
981
|
-
BSD 2-Clause License (
|
|
926
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
982
927
|
|
|
983
928
|
Redistribution and use in source and binary forms, with or without
|
|
984
929
|
modification, are permitted provided that the following conditions are
|
|
@@ -1151,7 +1096,7 @@ size_t HUFv07_decompress1X4_usingDTable(void* dst, size_t maxDstSize, const void
|
|
|
1151
1096
|
Common functions of New Generation Entropy library
|
|
1152
1097
|
Copyright (C) 2016, Yann Collet.
|
|
1153
1098
|
|
|
1154
|
-
BSD 2-Clause License (
|
|
1099
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
1155
1100
|
|
|
1156
1101
|
Redistribution and use in source and binary forms, with or without
|
|
1157
1102
|
modification, are permitted provided that the following conditions are
|
|
@@ -1375,7 +1320,7 @@ size_t HUFv07_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats,
|
|
|
1375
1320
|
FSE : Finite State Entropy decoder
|
|
1376
1321
|
Copyright (C) 2013-2015, Yann Collet.
|
|
1377
1322
|
|
|
1378
|
-
BSD 2-Clause License (
|
|
1323
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
1379
1324
|
|
|
1380
1325
|
Redistribution and use in source and binary forms, with or without
|
|
1381
1326
|
modification, are permitted provided that the following conditions are
|
|
@@ -1699,7 +1644,7 @@ size_t FSEv07_decompress(void* dst, size_t maxDstSize, const void* cSrc, size_t
|
|
|
1699
1644
|
Huffman decoder, part of New Generation Entropy library
|
|
1700
1645
|
Copyright (C) 2013-2016, Yann Collet.
|
|
1701
1646
|
|
|
1702
|
-
BSD 2-Clause License (
|
|
1647
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
1703
1648
|
|
|
1704
1649
|
Redistribution and use in source and binary forms, with or without
|
|
1705
1650
|
modification, are permitted provided that the following conditions are
|
|
@@ -2577,7 +2522,7 @@ size_t HUFv07_decompress1X_DCtx (HUFv07_DTable* dctx, void* dst, size_t dstSize,
|
|
|
2577
2522
|
Common functions of Zstd compression library
|
|
2578
2523
|
Copyright (C) 2015-2016, Yann Collet.
|
|
2579
2524
|
|
|
2580
|
-
BSD 2-Clause License (
|
|
2525
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
2581
2526
|
|
|
2582
2527
|
Redistribution and use in source and binary forms, with or without
|
|
2583
2528
|
modification, are permitted provided that the following conditions are
|
|
@@ -2601,7 +2546,7 @@ size_t HUFv07_decompress1X_DCtx (HUFv07_DTable* dctx, void* dst, size_t dstSize,
|
|
|
2601
2546
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
2602
2547
|
|
|
2603
2548
|
You can contact the author at :
|
|
2604
|
-
- zstd homepage :
|
|
2549
|
+
- zstd homepage : https://facebook.github.io/zstd/
|
|
2605
2550
|
*/
|
|
2606
2551
|
|
|
2607
2552
|
|
|
@@ -2647,7 +2592,7 @@ static void ZSTDv07_defaultFreeFunction(void* opaque, void* address)
|
|
|
2647
2592
|
Header File for include
|
|
2648
2593
|
Copyright (C) 2014-2016, Yann Collet.
|
|
2649
2594
|
|
|
2650
|
-
BSD 2-Clause License (
|
|
2595
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
2651
2596
|
|
|
2652
2597
|
Redistribution and use in source and binary forms, with or without
|
|
2653
2598
|
modification, are permitted provided that the following conditions are
|
|
@@ -2717,7 +2662,7 @@ typedef enum { bt_compressed, bt_raw, bt_rle, bt_end } blockType_t;
|
|
|
2717
2662
|
#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
|
|
2718
2663
|
#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */) /* for a non-null block */
|
|
2719
2664
|
|
|
2720
|
-
#define
|
|
2665
|
+
#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
|
|
2721
2666
|
typedef enum { lbt_huffman, lbt_repeat, lbt_raw, lbt_rle } litBlockType_t;
|
|
2722
2667
|
|
|
2723
2668
|
#define LONGNBSEQ 0x7F00
|
|
@@ -2842,9 +2787,9 @@ typedef struct {
|
|
|
2842
2787
|
U32 cachedLitLength;
|
|
2843
2788
|
const BYTE* cachedLiterals;
|
|
2844
2789
|
ZSTDv07_stats_t stats;
|
|
2845
|
-
}
|
|
2790
|
+
} SeqStore_t;
|
|
2846
2791
|
|
|
2847
|
-
void ZSTDv07_seqToCodes(const
|
|
2792
|
+
void ZSTDv07_seqToCodes(const SeqStore_t* seqStorePtr, size_t const nbSeq);
|
|
2848
2793
|
|
|
2849
2794
|
/* custom memory allocation functions */
|
|
2850
2795
|
static const ZSTDv07_customMem defaultCustomMem = { ZSTDv07_defaultAllocFunction, ZSTDv07_defaultFreeFunction, NULL };
|
|
@@ -2854,7 +2799,7 @@ static const ZSTDv07_customMem defaultCustomMem = { ZSTDv07_defaultAllocFunction
|
|
|
2854
2799
|
zstd - standard compression library
|
|
2855
2800
|
Copyright (C) 2014-2016, Yann Collet.
|
|
2856
2801
|
|
|
2857
|
-
BSD 2-Clause License (
|
|
2802
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
2858
2803
|
|
|
2859
2804
|
Redistribution and use in source and binary forms, with or without
|
|
2860
2805
|
modification, are permitted provided that the following conditions are
|
|
@@ -2878,7 +2823,7 @@ static const ZSTDv07_customMem defaultCustomMem = { ZSTDv07_defaultAllocFunction
|
|
|
2878
2823
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
2879
2824
|
|
|
2880
2825
|
You can contact the author at :
|
|
2881
|
-
- zstd homepage :
|
|
2826
|
+
- zstd homepage : https://facebook.github.io/zstd
|
|
2882
2827
|
*/
|
|
2883
2828
|
|
|
2884
2829
|
/* ***************************************************************
|
|
@@ -2931,7 +2876,7 @@ struct ZSTDv07_DCtx_s
|
|
|
2931
2876
|
FSEv07_DTable LLTable[FSEv07_DTABLE_SIZE_U32(LLFSELog)];
|
|
2932
2877
|
FSEv07_DTable OffTable[FSEv07_DTABLE_SIZE_U32(OffFSELog)];
|
|
2933
2878
|
FSEv07_DTable MLTable[FSEv07_DTABLE_SIZE_U32(MLFSELog)];
|
|
2934
|
-
HUFv07_DTable hufTable[HUFv07_DTABLE_SIZE(
|
|
2879
|
+
HUFv07_DTable hufTable[HUFv07_DTABLE_SIZE(ZSTD_HUFFDTABLE_CAPACITY_LOG)]; /* can accommodate HUFv07_decompress4X */
|
|
2935
2880
|
const void* previousDstEnd;
|
|
2936
2881
|
const void* base;
|
|
2937
2882
|
const void* vBase;
|
|
@@ -2967,7 +2912,7 @@ size_t ZSTDv07_decompressBegin(ZSTDv07_DCtx* dctx)
|
|
|
2967
2912
|
dctx->base = NULL;
|
|
2968
2913
|
dctx->vBase = NULL;
|
|
2969
2914
|
dctx->dictEnd = NULL;
|
|
2970
|
-
dctx->hufTable[0] = (HUFv07_DTable)((
|
|
2915
|
+
dctx->hufTable[0] = (HUFv07_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);
|
|
2971
2916
|
dctx->litEntropy = dctx->fseEntropy = 0;
|
|
2972
2917
|
dctx->dictID = 0;
|
|
2973
2918
|
{ int i; for (i=0; i<ZSTDv07_REP_NUM; i++) dctx->rep[i] = repStartValue[i]; }
|
|
@@ -3599,11 +3544,14 @@ size_t ZSTDv07_execSequence(BYTE* op,
|
|
|
3599
3544
|
const BYTE* match = oLitEnd - sequence.offset;
|
|
3600
3545
|
|
|
3601
3546
|
/* check */
|
|
3602
|
-
|
|
3603
|
-
if (
|
|
3547
|
+
assert(oend >= op);
|
|
3548
|
+
if (sequence.litLength + WILDCOPY_OVERLENGTH > (size_t)(oend - op)) return ERROR(dstSize_tooSmall);
|
|
3549
|
+
if (sequenceLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall);
|
|
3550
|
+
assert(litLimit >= *litPtr);
|
|
3551
|
+
if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected);;
|
|
3604
3552
|
|
|
3605
3553
|
/* copy Literals */
|
|
3606
|
-
ZSTDv07_wildcopy(op, *litPtr, sequence.litLength); /* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */
|
|
3554
|
+
ZSTDv07_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength); /* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */
|
|
3607
3555
|
op = oLitEnd;
|
|
3608
3556
|
*litPtr = iLitEnd; /* update for next sequence */
|
|
3609
3557
|
|
|
@@ -3617,7 +3565,7 @@ size_t ZSTDv07_execSequence(BYTE* op,
|
|
|
3617
3565
|
return sequenceLength;
|
|
3618
3566
|
}
|
|
3619
3567
|
/* span extDict & currentPrefixSegment */
|
|
3620
|
-
{ size_t const length1 = dictEnd - match;
|
|
3568
|
+
{ size_t const length1 = (size_t)(dictEnd - match);
|
|
3621
3569
|
memmove(oLitEnd, match, length1);
|
|
3622
3570
|
op = oLitEnd + length1;
|
|
3623
3571
|
sequence.matchLength -= length1;
|
|
@@ -4059,8 +4007,8 @@ size_t ZSTDv07_decompressContinue(ZSTDv07_DCtx* dctx, void* dst, size_t dstCapac
|
|
|
4059
4007
|
}
|
|
4060
4008
|
dctx->stage = ZSTDds_decodeBlockHeader;
|
|
4061
4009
|
dctx->expected = ZSTDv07_blockHeaderSize;
|
|
4062
|
-
dctx->previousDstEnd = (char*)dst + rSize;
|
|
4063
4010
|
if (ZSTDv07_isError(rSize)) return rSize;
|
|
4011
|
+
dctx->previousDstEnd = (char*)dst + rSize;
|
|
4064
4012
|
if (dctx->fParams.checksumFlag) XXH64_update(&dctx->xxhState, dst, rSize);
|
|
4065
4013
|
return rSize;
|
|
4066
4014
|
}
|
|
@@ -4253,7 +4201,7 @@ ZSTDLIBv07_API size_t ZSTDv07_decompress_usingDDict(ZSTDv07_DCtx* dctx,
|
|
|
4253
4201
|
Buffered version of Zstd compression library
|
|
4254
4202
|
Copyright (C) 2015-2016, Yann Collet.
|
|
4255
4203
|
|
|
4256
|
-
BSD 2-Clause License (
|
|
4204
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
4257
4205
|
|
|
4258
4206
|
Redistribution and use in source and binary forms, with or without
|
|
4259
4207
|
modification, are permitted provided that the following conditions are
|
|
@@ -4277,7 +4225,7 @@ ZSTDLIBv07_API size_t ZSTDv07_decompress_usingDDict(ZSTDv07_DCtx* dctx,
|
|
|
4277
4225
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4278
4226
|
|
|
4279
4227
|
You can contact the author at :
|
|
4280
|
-
- zstd homepage :
|
|
4228
|
+
- zstd homepage : https://facebook.github.io/zstd/
|
|
4281
4229
|
*/
|
|
4282
4230
|
|
|
4283
4231
|
|
|
@@ -4417,7 +4365,8 @@ size_t ZBUFFv07_decompressContinue(ZBUFFv07_DCtx* zbd,
|
|
|
4417
4365
|
if (hSize != 0) {
|
|
4418
4366
|
size_t const toLoad = hSize - zbd->lhSize; /* if hSize!=0, hSize > zbd->lhSize */
|
|
4419
4367
|
if (toLoad > (size_t)(iend-ip)) { /* not enough input to load full header */
|
|
4420
|
-
|
|
4368
|
+
if (ip != NULL)
|
|
4369
|
+
memcpy(zbd->headerBuffer + zbd->lhSize, ip, iend-ip);
|
|
4421
4370
|
zbd->lhSize += iend-ip;
|
|
4422
4371
|
*dstCapacityPtr = 0;
|
|
4423
4372
|
return (hSize - zbd->lhSize) + ZSTDv07_blockHeaderSize; /* remaining header bytes + next block header */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# ################################################################
|
|
2
|
-
# Copyright (c)
|
|
2
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
#
|
|
5
5
|
# This source code is licensed under both the BSD-style license (found in the
|
|
@@ -8,28 +8,57 @@
|
|
|
8
8
|
# You may select, at your option, one of the above-listed licenses.
|
|
9
9
|
# ################################################################
|
|
10
10
|
|
|
11
|
+
# This included Makefile provides the following variables :
|
|
12
|
+
# LIB_SRCDIR, LIB_BINDIR
|
|
13
|
+
|
|
14
|
+
# Ensure the file is not included twice
|
|
15
|
+
# Note : must be included after setting the default target
|
|
16
|
+
ifndef LIBZSTD_MK_INCLUDED
|
|
17
|
+
LIBZSTD_MK_INCLUDED := 1
|
|
18
|
+
|
|
11
19
|
##################################################################
|
|
12
20
|
# Input Variables
|
|
13
21
|
##################################################################
|
|
14
22
|
|
|
15
|
-
#
|
|
16
|
-
|
|
23
|
+
# By default, library's directory is same as this included makefile
|
|
24
|
+
LIB_SRCDIR ?= $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
25
|
+
LIB_BINDIR ?= $(LIB_SRCDIR)
|
|
26
|
+
|
|
27
|
+
# ZSTD_LIB_MINIFY is a helper variable that
|
|
28
|
+
# configures a bunch of other variables to space-optimized defaults.
|
|
29
|
+
ZSTD_LIB_MINIFY ?= 0
|
|
17
30
|
|
|
18
31
|
# Legacy support
|
|
19
|
-
|
|
32
|
+
ifneq ($(ZSTD_LIB_MINIFY), 0)
|
|
33
|
+
ZSTD_LEGACY_SUPPORT ?= 0
|
|
34
|
+
else
|
|
35
|
+
ZSTD_LEGACY_SUPPORT ?= 5
|
|
36
|
+
endif
|
|
20
37
|
ZSTD_LEGACY_MULTITHREADED_API ?= 0
|
|
21
38
|
|
|
22
39
|
# Build size optimizations
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
ifneq ($(ZSTD_LIB_MINIFY), 0)
|
|
41
|
+
HUF_FORCE_DECOMPRESS_X1 ?= 1
|
|
42
|
+
HUF_FORCE_DECOMPRESS_X2 ?= 0
|
|
43
|
+
ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 1
|
|
44
|
+
ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG ?= 0
|
|
45
|
+
ZSTD_NO_INLINE ?= 1
|
|
46
|
+
ZSTD_STRIP_ERROR_STRINGS ?= 1
|
|
47
|
+
else
|
|
48
|
+
HUF_FORCE_DECOMPRESS_X1 ?= 0
|
|
49
|
+
HUF_FORCE_DECOMPRESS_X2 ?= 0
|
|
50
|
+
ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 0
|
|
51
|
+
ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG ?= 0
|
|
52
|
+
ZSTD_NO_INLINE ?= 0
|
|
53
|
+
ZSTD_STRIP_ERROR_STRINGS ?= 0
|
|
54
|
+
endif
|
|
29
55
|
|
|
30
56
|
# Assembly support
|
|
31
57
|
ZSTD_NO_ASM ?= 0
|
|
32
58
|
|
|
59
|
+
ZSTD_LIB_EXCLUDE_COMPRESSORS_DFAST_AND_UP ?= 0
|
|
60
|
+
ZSTD_LIB_EXCLUDE_COMPRESSORS_GREEDY_AND_UP ?= 0
|
|
61
|
+
|
|
33
62
|
##################################################################
|
|
34
63
|
# libzstd helpers
|
|
35
64
|
##################################################################
|
|
@@ -40,6 +69,7 @@ VOID ?= /dev/null
|
|
|
40
69
|
NUM_SYMBOL := \#
|
|
41
70
|
|
|
42
71
|
# define silent mode as default (verbose mode with V=1 or VERBOSE=1)
|
|
72
|
+
# Note : must be defined _after_ the default target
|
|
43
73
|
$(V)$(VERBOSE).SILENT:
|
|
44
74
|
|
|
45
75
|
# When cross-compiling from linux to windows,
|
|
@@ -49,7 +79,7 @@ $(V)$(VERBOSE).SILENT:
|
|
|
49
79
|
TARGET_SYSTEM ?= $(OS)
|
|
50
80
|
|
|
51
81
|
# Version numbers
|
|
52
|
-
LIBVER_SRC := $(
|
|
82
|
+
LIBVER_SRC := $(LIB_SRCDIR)/zstd.h
|
|
53
83
|
LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
|
54
84
|
LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
|
55
85
|
LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
|
@@ -61,17 +91,8 @@ LIBVER := $(shell echo $(LIBVER_SCRIPT))
|
|
|
61
91
|
CCVER := $(shell $(CC) --version)
|
|
62
92
|
ZSTD_VERSION?= $(LIBVER)
|
|
63
93
|
|
|
64
|
-
# ZSTD_LIB_MINIFY is a helper variable that
|
|
65
|
-
# configures a bunch of other variables to space-optimized defaults.
|
|
66
|
-
ZSTD_LIB_MINIFY ?= 0
|
|
67
94
|
ifneq ($(ZSTD_LIB_MINIFY), 0)
|
|
68
95
|
HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0)
|
|
69
|
-
ZSTD_LEGACY_SUPPORT ?= 0
|
|
70
|
-
ZSTD_LIB_DEPRECATED ?= 0
|
|
71
|
-
HUF_FORCE_DECOMPRESS_X1 ?= 1
|
|
72
|
-
ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 1
|
|
73
|
-
ZSTD_NO_INLINE ?= 1
|
|
74
|
-
ZSTD_STRIP_ERROR_STRINGS ?= 1
|
|
75
96
|
ifneq ($(HAVE_CC_OZ), 0)
|
|
76
97
|
# Some compilers (clang) support an even more space-optimized setting.
|
|
77
98
|
CFLAGS += -Oz
|
|
@@ -114,22 +135,25 @@ CFLAGS += -Qunused-arguments -Wa,--noexecstack
|
|
|
114
135
|
endif
|
|
115
136
|
endif
|
|
116
137
|
|
|
138
|
+
ifeq ($(shell echo "int main(int argc, char* argv[]) { (void)argc; (void)argv; return 0; }" | $(CC) $(FLAGS) -z cet-report=error -x c -Werror - -o $(VOID) 2>$(VOID) && echo 1 || echo 0),1)
|
|
139
|
+
LDFLAGS += -z cet-report=error
|
|
140
|
+
endif
|
|
141
|
+
|
|
117
142
|
HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
|
|
118
143
|
GREP_OPTIONS ?=
|
|
119
|
-
ifeq ($HAVE_COLORNEVER, 1)
|
|
144
|
+
ifeq ($(HAVE_COLORNEVER), 1)
|
|
120
145
|
GREP_OPTIONS += --color=never
|
|
121
146
|
endif
|
|
122
147
|
GREP = grep $(GREP_OPTIONS)
|
|
123
|
-
SED_ERE_OPT ?= -E
|
|
124
148
|
|
|
125
|
-
ZSTD_COMMON_FILES := $(sort $(wildcard $(
|
|
126
|
-
ZSTD_COMPRESS_FILES := $(sort $(wildcard $(
|
|
127
|
-
ZSTD_DECOMPRESS_FILES := $(sort $(wildcard $(
|
|
128
|
-
ZSTD_DICTBUILDER_FILES := $(sort $(wildcard $(
|
|
129
|
-
ZSTD_DEPRECATED_FILES := $(sort $(wildcard $(
|
|
149
|
+
ZSTD_COMMON_FILES := $(sort $(wildcard $(LIB_SRCDIR)/common/*.c))
|
|
150
|
+
ZSTD_COMPRESS_FILES := $(sort $(wildcard $(LIB_SRCDIR)/compress/*.c))
|
|
151
|
+
ZSTD_DECOMPRESS_FILES := $(sort $(wildcard $(LIB_SRCDIR)/decompress/*.c))
|
|
152
|
+
ZSTD_DICTBUILDER_FILES := $(sort $(wildcard $(LIB_SRCDIR)/dictBuilder/*.c))
|
|
153
|
+
ZSTD_DEPRECATED_FILES := $(sort $(wildcard $(LIB_SRCDIR)/deprecated/*.c))
|
|
130
154
|
ZSTD_LEGACY_FILES :=
|
|
131
155
|
|
|
132
|
-
ZSTD_DECOMPRESS_AMD64_ASM_FILES := $(sort $(wildcard $(
|
|
156
|
+
ZSTD_DECOMPRESS_AMD64_ASM_FILES := $(sort $(wildcard $(LIB_SRCDIR)/decompress/*_amd64.S))
|
|
133
157
|
|
|
134
158
|
ifneq ($(ZSTD_NO_ASM), 0)
|
|
135
159
|
CPPFLAGS += -DZSTD_DISABLE_ASM
|
|
@@ -167,22 +191,28 @@ ifneq ($(ZSTD_LEGACY_MULTITHREADED_API), 0)
|
|
|
167
191
|
CFLAGS += -DZSTD_LEGACY_MULTITHREADED_API
|
|
168
192
|
endif
|
|
169
193
|
|
|
194
|
+
ifneq ($(ZSTD_LIB_EXCLUDE_COMPRESSORS_DFAST_AND_UP), 0)
|
|
195
|
+
CFLAGS += -DZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR -DZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR -DZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR -DZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR -DZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR -DZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
|
|
196
|
+
else
|
|
197
|
+
ifneq ($(ZSTD_LIB_EXCLUDE_COMPRESSORS_GREEDY_AND_UP), 0)
|
|
198
|
+
CFLAGS += -DZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR -DZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR -DZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR -DZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR -DZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
|
|
199
|
+
endif
|
|
200
|
+
endif
|
|
201
|
+
|
|
170
202
|
ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
|
171
203
|
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
|
172
|
-
ZSTD_LEGACY_FILES += $(shell ls $(
|
|
204
|
+
ZSTD_LEGACY_FILES += $(shell ls $(LIB_SRCDIR)/legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
|
|
173
205
|
endif
|
|
174
206
|
endif
|
|
175
207
|
CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT)
|
|
176
208
|
|
|
177
|
-
UNAME := $(shell uname)
|
|
209
|
+
UNAME := $(shell sh -c 'MSYSTEM="MSYS" uname')
|
|
178
210
|
|
|
179
211
|
ifndef BUILD_DIR
|
|
180
212
|
ifeq ($(UNAME), Darwin)
|
|
181
213
|
ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0)
|
|
182
214
|
HASH ?= md5
|
|
183
215
|
endif
|
|
184
|
-
else ifeq ($(UNAME), FreeBSD)
|
|
185
|
-
HASH ?= gmd5sum
|
|
186
216
|
else ifeq ($(UNAME), NetBSD)
|
|
187
217
|
HASH ?= md5 -n
|
|
188
218
|
else ifeq ($(UNAME), OpenBSD)
|
|
@@ -198,6 +228,8 @@ ifeq ($(HAVE_HASH),0)
|
|
|
198
228
|
endif
|
|
199
229
|
endif # BUILD_DIR
|
|
200
230
|
|
|
201
|
-
ZSTD_SUBDIR := $(
|
|
231
|
+
ZSTD_SUBDIR := $(LIB_SRCDIR)/common $(LIB_SRCDIR)/compress $(LIB_SRCDIR)/decompress $(LIB_SRCDIR)/dictBuilder $(LIB_SRCDIR)/legacy $(LIB_SRCDIR)/deprecated
|
|
202
232
|
vpath %.c $(ZSTD_SUBDIR)
|
|
203
233
|
vpath %.S $(ZSTD_SUBDIR)
|
|
234
|
+
|
|
235
|
+
endif # LIBZSTD_MK_INCLUDED
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ZSTD - standard compression algorithm
|
|
2
|
-
# Copyright (
|
|
3
|
-
# BSD 2-Clause License (
|
|
2
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
# BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
|
4
4
|
|
|
5
5
|
prefix=@PREFIX@
|
|
6
6
|
exec_prefix=@EXEC_PREFIX@
|
|
@@ -9,8 +9,8 @@ libdir=@LIBDIR@
|
|
|
9
9
|
|
|
10
10
|
Name: zstd
|
|
11
11
|
Description: fast lossless compression algorithm library
|
|
12
|
-
URL:
|
|
12
|
+
URL: https://facebook.github.io/zstd/
|
|
13
13
|
Version: @VERSION@
|
|
14
|
-
Libs: -L${libdir} -lzstd
|
|
14
|
+
Libs: -L${libdir} -lzstd @LIBS_MT@
|
|
15
15
|
Libs.private: @LIBS_PRIVATE@
|
|
16
|
-
Cflags: -I${includedir}
|
|
16
|
+
Cflags: -I${includedir} @LIBS_MT@
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
module libzstd [extern_c] {
|
|
2
2
|
header "zstd.h"
|
|
3
3
|
export *
|
|
4
|
-
config_macros [exhaustive]
|
|
4
|
+
config_macros [exhaustive] \
|
|
5
|
+
/* zstd.h */ \
|
|
5
6
|
ZSTD_STATIC_LINKING_ONLY, \
|
|
7
|
+
ZSTDLIB_VISIBILITY, \
|
|
6
8
|
ZSTDLIB_VISIBLE, \
|
|
9
|
+
ZSTDLIB_HIDDEN, \
|
|
7
10
|
ZSTD_DLL_EXPORT, \
|
|
8
11
|
ZSTDLIB_STATIC_API, \
|
|
9
12
|
ZSTD_DISABLE_DEPRECATE_WARNINGS, \
|
|
10
13
|
ZSTD_CLEVEL_DEFAULT, \
|
|
11
|
-
/* zdict.h */
|
|
14
|
+
/* zdict.h */ \
|
|
15
|
+
ZDICT_STATIC_LINKING_ONLY, \
|
|
16
|
+
ZDICTLIB_VISIBLE, \
|
|
17
|
+
ZDICTLIB_HIDDEN, \
|
|
12
18
|
ZDICTLIB_VISIBILITY, \
|
|
19
|
+
ZDICTLIB_STATIC_API, \
|
|
13
20
|
ZDICT_DISABLE_DEPRECATE_WARNINGS, \
|
|
14
|
-
/* zstd_errors.h */
|
|
21
|
+
/* zstd_errors.h */ \
|
|
22
|
+
ZSTDERRORLIB_VISIBLE, \
|
|
23
|
+
ZSTDERRORLIB_HIDDEN, \
|
|
24
|
+
ZSTDERRORLIB_VISIBILITY
|
|
15
25
|
|
|
16
26
|
module dictbuilder [extern_c] {
|
|
17
27
|
header "zdict.h"
|