extzstd 0.3.2 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/contrib/zstd/CHANGELOG +225 -1
- data/contrib/zstd/CONTRIBUTING.md +158 -75
- data/contrib/zstd/LICENSE +4 -4
- data/contrib/zstd/Makefile +106 -69
- data/contrib/zstd/Package.swift +36 -0
- data/contrib/zstd/README.md +64 -36
- data/contrib/zstd/SECURITY.md +15 -0
- data/contrib/zstd/TESTING.md +2 -3
- data/contrib/zstd/lib/BUCK +5 -7
- data/contrib/zstd/lib/Makefile +117 -199
- data/contrib/zstd/lib/README.md +37 -7
- data/contrib/zstd/lib/common/allocations.h +55 -0
- data/contrib/zstd/lib/common/bits.h +200 -0
- data/contrib/zstd/lib/common/bitstream.h +80 -86
- data/contrib/zstd/lib/common/compiler.h +225 -63
- data/contrib/zstd/lib/common/cpu.h +37 -1
- data/contrib/zstd/lib/common/debug.c +7 -1
- data/contrib/zstd/lib/common/debug.h +21 -12
- data/contrib/zstd/lib/common/entropy_common.c +15 -37
- data/contrib/zstd/lib/common/error_private.c +9 -2
- data/contrib/zstd/lib/common/error_private.h +93 -5
- data/contrib/zstd/lib/common/fse.h +12 -87
- data/contrib/zstd/lib/common/fse_decompress.c +37 -117
- data/contrib/zstd/lib/common/huf.h +97 -172
- data/contrib/zstd/lib/common/mem.h +58 -58
- data/contrib/zstd/lib/common/pool.c +38 -17
- data/contrib/zstd/lib/common/pool.h +10 -4
- data/contrib/zstd/lib/common/portability_macros.h +158 -0
- data/contrib/zstd/lib/common/threading.c +74 -14
- data/contrib/zstd/lib/common/threading.h +5 -10
- data/contrib/zstd/lib/common/xxhash.c +6 -814
- data/contrib/zstd/lib/common/xxhash.h +6930 -195
- data/contrib/zstd/lib/common/zstd_common.c +1 -36
- data/contrib/zstd/lib/common/zstd_deps.h +1 -1
- data/contrib/zstd/lib/common/zstd_internal.h +68 -154
- data/contrib/zstd/lib/common/zstd_trace.h +163 -0
- data/contrib/zstd/lib/compress/clevels.h +134 -0
- data/contrib/zstd/lib/compress/fse_compress.c +75 -155
- data/contrib/zstd/lib/compress/hist.c +1 -1
- data/contrib/zstd/lib/compress/hist.h +1 -1
- data/contrib/zstd/lib/compress/huf_compress.c +810 -259
- data/contrib/zstd/lib/compress/zstd_compress.c +2864 -919
- data/contrib/zstd/lib/compress/zstd_compress_internal.h +523 -192
- data/contrib/zstd/lib/compress/zstd_compress_literals.c +117 -40
- data/contrib/zstd/lib/compress/zstd_compress_literals.h +16 -6
- data/contrib/zstd/lib/compress/zstd_compress_sequences.c +28 -19
- data/contrib/zstd/lib/compress/zstd_compress_sequences.h +1 -1
- data/contrib/zstd/lib/compress/zstd_compress_superblock.c +251 -412
- data/contrib/zstd/lib/compress/zstd_compress_superblock.h +1 -1
- data/contrib/zstd/lib/compress/zstd_cwksp.h +284 -97
- data/contrib/zstd/lib/compress/zstd_double_fast.c +382 -133
- data/contrib/zstd/lib/compress/zstd_double_fast.h +14 -2
- data/contrib/zstd/lib/compress/zstd_fast.c +732 -260
- data/contrib/zstd/lib/compress/zstd_fast.h +3 -2
- data/contrib/zstd/lib/compress/zstd_lazy.c +1177 -390
- data/contrib/zstd/lib/compress/zstd_lazy.h +129 -14
- data/contrib/zstd/lib/compress/zstd_ldm.c +280 -210
- data/contrib/zstd/lib/compress/zstd_ldm.h +3 -2
- data/contrib/zstd/lib/compress/zstd_ldm_geartab.h +106 -0
- data/contrib/zstd/lib/compress/zstd_opt.c +516 -285
- data/contrib/zstd/lib/compress/zstd_opt.h +32 -8
- data/contrib/zstd/lib/compress/zstdmt_compress.c +202 -131
- data/contrib/zstd/lib/compress/zstdmt_compress.h +9 -6
- data/contrib/zstd/lib/decompress/huf_decompress.c +1149 -555
- data/contrib/zstd/lib/decompress/huf_decompress_amd64.S +595 -0
- data/contrib/zstd/lib/decompress/zstd_ddict.c +4 -4
- data/contrib/zstd/lib/decompress/zstd_ddict.h +1 -1
- data/contrib/zstd/lib/decompress/zstd_decompress.c +583 -106
- data/contrib/zstd/lib/decompress/zstd_decompress_block.c +1054 -379
- data/contrib/zstd/lib/decompress/zstd_decompress_block.h +14 -3
- data/contrib/zstd/lib/decompress/zstd_decompress_internal.h +56 -6
- data/contrib/zstd/lib/deprecated/zbuff.h +1 -1
- data/contrib/zstd/lib/deprecated/zbuff_common.c +1 -1
- data/contrib/zstd/lib/deprecated/zbuff_compress.c +24 -4
- data/contrib/zstd/lib/deprecated/zbuff_decompress.c +3 -1
- data/contrib/zstd/lib/dictBuilder/cover.c +60 -44
- data/contrib/zstd/lib/dictBuilder/cover.h +6 -11
- data/contrib/zstd/lib/dictBuilder/divsufsort.c +1 -1
- data/contrib/zstd/lib/dictBuilder/fastcover.c +26 -18
- data/contrib/zstd/lib/dictBuilder/zdict.c +100 -101
- data/contrib/zstd/lib/legacy/zstd_legacy.h +38 -1
- data/contrib/zstd/lib/legacy/zstd_v01.c +18 -53
- data/contrib/zstd/lib/legacy/zstd_v01.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v02.c +28 -85
- data/contrib/zstd/lib/legacy/zstd_v02.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v03.c +29 -88
- data/contrib/zstd/lib/legacy/zstd_v03.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v04.c +27 -80
- data/contrib/zstd/lib/legacy/zstd_v04.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v05.c +36 -85
- data/contrib/zstd/lib/legacy/zstd_v05.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v06.c +44 -96
- data/contrib/zstd/lib/legacy/zstd_v06.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v07.c +37 -92
- data/contrib/zstd/lib/legacy/zstd_v07.h +1 -1
- data/contrib/zstd/lib/libzstd.mk +237 -0
- data/contrib/zstd/lib/libzstd.pc.in +4 -3
- data/contrib/zstd/lib/module.modulemap +35 -0
- data/contrib/zstd/lib/{dictBuilder/zdict.h → zdict.h} +202 -33
- data/contrib/zstd/lib/zstd.h +1030 -332
- data/contrib/zstd/lib/{common/zstd_errors.h → zstd_errors.h} +27 -8
- data/ext/extconf.rb +26 -7
- data/ext/extzstd.c +51 -24
- data/ext/extzstd.h +33 -6
- data/ext/extzstd_stream.c +74 -31
- data/ext/libzstd_conf.h +0 -1
- data/ext/zstd_decompress_asm.S +1 -0
- metadata +17 -7
- data/contrib/zstd/appveyor.yml +0 -292
- data/ext/depend +0 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
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,27 +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(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) )
|
286
|
-
# define MEM_FORCE_MEMORY_ACCESS 2
|
287
|
-
# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
|
288
|
-
(defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
|
289
|
-
# define MEM_FORCE_MEMORY_ACCESS 1
|
290
|
-
# endif
|
291
|
-
#endif
|
292
263
|
|
293
264
|
MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
|
294
265
|
MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
|
@@ -299,33 +270,6 @@ MEM_STATIC unsigned MEM_isLittleEndian(void)
|
|
299
270
|
return one.c[0];
|
300
271
|
}
|
301
272
|
|
302
|
-
#if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2)
|
303
|
-
|
304
|
-
/* violates C standard, by lying on structure alignment.
|
305
|
-
Only use if no other choice to achieve best performance on target platform */
|
306
|
-
MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) memPtr; }
|
307
|
-
MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; }
|
308
|
-
MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; }
|
309
|
-
|
310
|
-
MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; }
|
311
|
-
|
312
|
-
#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1)
|
313
|
-
|
314
|
-
/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */
|
315
|
-
/* currently only defined for gcc and icc */
|
316
|
-
typedef union { U16 u16; U32 u32; U64 u64; size_t st; } __attribute__((packed)) unalign;
|
317
|
-
|
318
|
-
MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign*)ptr)->u16; }
|
319
|
-
MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32; }
|
320
|
-
MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; }
|
321
|
-
|
322
|
-
MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; }
|
323
|
-
|
324
|
-
#else
|
325
|
-
|
326
|
-
/* default method, safe and standard.
|
327
|
-
can sometimes prove slower */
|
328
|
-
|
329
273
|
MEM_STATIC U16 MEM_read16(const void* memPtr)
|
330
274
|
{
|
331
275
|
U16 val; memcpy(&val, memPtr, sizeof(val)); return val;
|
@@ -346,8 +290,6 @@ MEM_STATIC void MEM_write16(void* memPtr, U16 value)
|
|
346
290
|
memcpy(memPtr, &value, sizeof(value));
|
347
291
|
}
|
348
292
|
|
349
|
-
#endif /* MEM_FORCE_MEMORY_ACCESS */
|
350
|
-
|
351
293
|
MEM_STATIC U32 MEM_swap32(U32 in)
|
352
294
|
{
|
353
295
|
#if defined(_MSC_VER) /* Visual Studio */
|
@@ -442,7 +384,7 @@ MEM_STATIC size_t MEM_readLEST(const void* memPtr)
|
|
442
384
|
header file (to include)
|
443
385
|
Copyright (C) 2013-2016, Yann Collet.
|
444
386
|
|
445
|
-
BSD 2-Clause License (
|
387
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
446
388
|
|
447
389
|
Redistribution and use in source and binary forms, with or without
|
448
390
|
modification, are permitted provided that the following conditions are
|
@@ -530,9 +472,8 @@ MEM_STATIC size_t BITv07_readBitsFast(BITv07_DStream_t* bitD, unsigned nbBits);
|
|
530
472
|
MEM_STATIC unsigned BITv07_highbit32 (U32 val)
|
531
473
|
{
|
532
474
|
# if defined(_MSC_VER) /* Visual */
|
533
|
-
unsigned long r
|
534
|
-
_BitScanReverse
|
535
|
-
return (unsigned) r;
|
475
|
+
unsigned long r;
|
476
|
+
return _BitScanReverse(&r, val) ? (unsigned)r : 0;
|
536
477
|
# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
|
537
478
|
return __builtin_clz (val) ^ 31;
|
538
479
|
# else /* Software version */
|
@@ -600,7 +541,7 @@ MEM_STATIC size_t BITv07_initDStream(BITv07_DStream_t* bitD, const void* srcBuff
|
|
600
541
|
}
|
601
542
|
|
602
543
|
/*! BITv07_lookBitsFast() :
|
603
|
-
* unsafe version; only works
|
544
|
+
* unsafe version; only works if nbBits >= 1 */
|
604
545
|
MEM_STATIC size_t BITv07_lookBitsFast(const BITv07_DStream_t* bitD, U32 nbBits)
|
605
546
|
{
|
606
547
|
U32 const bitMask = sizeof(bitD->bitContainer)*8 - 1;
|
@@ -620,7 +561,7 @@ MEM_STATIC size_t BITv07_readBits(BITv07_DStream_t* bitD, U32 nbBits)
|
|
620
561
|
}
|
621
562
|
|
622
563
|
/*! BITv07_readBitsFast() :
|
623
|
-
* unsafe version; only works
|
564
|
+
* unsafe version; only works if nbBits >= 1 */
|
624
565
|
MEM_STATIC size_t BITv07_readBitsFast(BITv07_DStream_t* bitD, U32 nbBits)
|
625
566
|
{
|
626
567
|
size_t const value = BITv07_lookBitsFast(bitD, nbBits);
|
@@ -674,7 +615,7 @@ MEM_STATIC unsigned BITv07_endOfDStream(const BITv07_DStream_t* DStream)
|
|
674
615
|
Public Prototypes declaration
|
675
616
|
Copyright (C) 2013-2016, Yann Collet.
|
676
617
|
|
677
|
-
BSD 2-Clause License (
|
618
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
678
619
|
|
679
620
|
Redistribution and use in source and binary forms, with or without
|
680
621
|
modification, are permitted provided that the following conditions are
|
@@ -982,7 +923,7 @@ MEM_STATIC BYTE FSEv07_decodeSymbolFast(FSEv07_DState_t* DStatePtr, BITv07_DStre
|
|
982
923
|
header file
|
983
924
|
Copyright (C) 2013-2016, Yann Collet.
|
984
925
|
|
985
|
-
BSD 2-Clause License (
|
926
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
986
927
|
|
987
928
|
Redistribution and use in source and binary forms, with or without
|
988
929
|
modification, are permitted provided that the following conditions are
|
@@ -1155,7 +1096,7 @@ size_t HUFv07_decompress1X4_usingDTable(void* dst, size_t maxDstSize, const void
|
|
1155
1096
|
Common functions of New Generation Entropy library
|
1156
1097
|
Copyright (C) 2016, Yann Collet.
|
1157
1098
|
|
1158
|
-
BSD 2-Clause License (
|
1099
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
1159
1100
|
|
1160
1101
|
Redistribution and use in source and binary forms, with or without
|
1161
1102
|
modification, are permitted provided that the following conditions are
|
@@ -1379,7 +1320,7 @@ size_t HUFv07_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats,
|
|
1379
1320
|
FSE : Finite State Entropy decoder
|
1380
1321
|
Copyright (C) 2013-2015, Yann Collet.
|
1381
1322
|
|
1382
|
-
BSD 2-Clause License (
|
1323
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
1383
1324
|
|
1384
1325
|
Redistribution and use in source and binary forms, with or without
|
1385
1326
|
modification, are permitted provided that the following conditions are
|
@@ -1703,7 +1644,7 @@ size_t FSEv07_decompress(void* dst, size_t maxDstSize, const void* cSrc, size_t
|
|
1703
1644
|
Huffman decoder, part of New Generation Entropy library
|
1704
1645
|
Copyright (C) 2013-2016, Yann Collet.
|
1705
1646
|
|
1706
|
-
BSD 2-Clause License (
|
1647
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
1707
1648
|
|
1708
1649
|
Redistribution and use in source and binary forms, with or without
|
1709
1650
|
modification, are permitted provided that the following conditions are
|
@@ -2581,7 +2522,7 @@ size_t HUFv07_decompress1X_DCtx (HUFv07_DTable* dctx, void* dst, size_t dstSize,
|
|
2581
2522
|
Common functions of Zstd compression library
|
2582
2523
|
Copyright (C) 2015-2016, Yann Collet.
|
2583
2524
|
|
2584
|
-
BSD 2-Clause License (
|
2525
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
2585
2526
|
|
2586
2527
|
Redistribution and use in source and binary forms, with or without
|
2587
2528
|
modification, are permitted provided that the following conditions are
|
@@ -2605,7 +2546,7 @@ size_t HUFv07_decompress1X_DCtx (HUFv07_DTable* dctx, void* dst, size_t dstSize,
|
|
2605
2546
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2606
2547
|
|
2607
2548
|
You can contact the author at :
|
2608
|
-
- zstd homepage :
|
2549
|
+
- zstd homepage : https://facebook.github.io/zstd/
|
2609
2550
|
*/
|
2610
2551
|
|
2611
2552
|
|
@@ -2651,7 +2592,7 @@ static void ZSTDv07_defaultFreeFunction(void* opaque, void* address)
|
|
2651
2592
|
Header File for include
|
2652
2593
|
Copyright (C) 2014-2016, Yann Collet.
|
2653
2594
|
|
2654
|
-
BSD 2-Clause License (
|
2595
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
2655
2596
|
|
2656
2597
|
Redistribution and use in source and binary forms, with or without
|
2657
2598
|
modification, are permitted provided that the following conditions are
|
@@ -2721,7 +2662,7 @@ typedef enum { bt_compressed, bt_raw, bt_rle, bt_end } blockType_t;
|
|
2721
2662
|
#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
|
2722
2663
|
#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */) /* for a non-null block */
|
2723
2664
|
|
2724
|
-
#define
|
2665
|
+
#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
|
2725
2666
|
typedef enum { lbt_huffman, lbt_repeat, lbt_raw, lbt_rle } litBlockType_t;
|
2726
2667
|
|
2727
2668
|
#define LONGNBSEQ 0x7F00
|
@@ -2858,7 +2799,7 @@ static const ZSTDv07_customMem defaultCustomMem = { ZSTDv07_defaultAllocFunction
|
|
2858
2799
|
zstd - standard compression library
|
2859
2800
|
Copyright (C) 2014-2016, Yann Collet.
|
2860
2801
|
|
2861
|
-
BSD 2-Clause License (
|
2802
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
2862
2803
|
|
2863
2804
|
Redistribution and use in source and binary forms, with or without
|
2864
2805
|
modification, are permitted provided that the following conditions are
|
@@ -2882,7 +2823,7 @@ static const ZSTDv07_customMem defaultCustomMem = { ZSTDv07_defaultAllocFunction
|
|
2882
2823
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2883
2824
|
|
2884
2825
|
You can contact the author at :
|
2885
|
-
- zstd homepage :
|
2826
|
+
- zstd homepage : https://facebook.github.io/zstd
|
2886
2827
|
*/
|
2887
2828
|
|
2888
2829
|
/* ***************************************************************
|
@@ -2935,7 +2876,7 @@ struct ZSTDv07_DCtx_s
|
|
2935
2876
|
FSEv07_DTable LLTable[FSEv07_DTABLE_SIZE_U32(LLFSELog)];
|
2936
2877
|
FSEv07_DTable OffTable[FSEv07_DTABLE_SIZE_U32(OffFSELog)];
|
2937
2878
|
FSEv07_DTable MLTable[FSEv07_DTABLE_SIZE_U32(MLFSELog)];
|
2938
|
-
HUFv07_DTable hufTable[HUFv07_DTABLE_SIZE(
|
2879
|
+
HUFv07_DTable hufTable[HUFv07_DTABLE_SIZE(ZSTD_HUFFDTABLE_CAPACITY_LOG)]; /* can accommodate HUFv07_decompress4X */
|
2939
2880
|
const void* previousDstEnd;
|
2940
2881
|
const void* base;
|
2941
2882
|
const void* vBase;
|
@@ -2971,7 +2912,7 @@ size_t ZSTDv07_decompressBegin(ZSTDv07_DCtx* dctx)
|
|
2971
2912
|
dctx->base = NULL;
|
2972
2913
|
dctx->vBase = NULL;
|
2973
2914
|
dctx->dictEnd = NULL;
|
2974
|
-
dctx->hufTable[0] = (HUFv07_DTable)((
|
2915
|
+
dctx->hufTable[0] = (HUFv07_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);
|
2975
2916
|
dctx->litEntropy = dctx->fseEntropy = 0;
|
2976
2917
|
dctx->dictID = 0;
|
2977
2918
|
{ int i; for (i=0; i<ZSTDv07_REP_NUM; i++) dctx->rep[i] = repStartValue[i]; }
|
@@ -3258,7 +3199,7 @@ typedef struct
|
|
3258
3199
|
* Provides the size of compressed block from block header `src` */
|
3259
3200
|
static size_t ZSTDv07_getcBlockSize(const void* src, size_t srcSize, blockProperties_t* bpPtr)
|
3260
3201
|
{
|
3261
|
-
const BYTE* const in = (const BYTE*
|
3202
|
+
const BYTE* const in = (const BYTE*)src;
|
3262
3203
|
U32 cSize;
|
3263
3204
|
|
3264
3205
|
if (srcSize < ZSTDv07_blockHeaderSize) return ERROR(srcSize_wrong);
|
@@ -3453,7 +3394,7 @@ static size_t ZSTDv07_decodeSeqHeaders(int* nbSeqPtr,
|
|
3453
3394
|
FSEv07_DTable* DTableLL, FSEv07_DTable* DTableML, FSEv07_DTable* DTableOffb, U32 flagRepeatTable,
|
3454
3395
|
const void* src, size_t srcSize)
|
3455
3396
|
{
|
3456
|
-
const BYTE* const istart = (const BYTE*
|
3397
|
+
const BYTE* const istart = (const BYTE*)src;
|
3457
3398
|
const BYTE* const iend = istart + srcSize;
|
3458
3399
|
const BYTE* ip = istart;
|
3459
3400
|
|
@@ -3603,11 +3544,14 @@ size_t ZSTDv07_execSequence(BYTE* op,
|
|
3603
3544
|
const BYTE* match = oLitEnd - sequence.offset;
|
3604
3545
|
|
3605
3546
|
/* check */
|
3606
|
-
|
3607
|
-
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);;
|
3608
3552
|
|
3609
3553
|
/* copy Literals */
|
3610
|
-
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 */
|
3611
3555
|
op = oLitEnd;
|
3612
3556
|
*litPtr = iLitEnd; /* update for next sequence */
|
3613
3557
|
|
@@ -3621,7 +3565,7 @@ size_t ZSTDv07_execSequence(BYTE* op,
|
|
3621
3565
|
return sequenceLength;
|
3622
3566
|
}
|
3623
3567
|
/* span extDict & currentPrefixSegment */
|
3624
|
-
{ size_t const length1 = dictEnd - match;
|
3568
|
+
{ size_t const length1 = (size_t)(dictEnd - match);
|
3625
3569
|
memmove(oLitEnd, match, length1);
|
3626
3570
|
op = oLitEnd + length1;
|
3627
3571
|
sequence.matchLength -= length1;
|
@@ -3672,7 +3616,7 @@ static size_t ZSTDv07_decompressSequences(
|
|
3672
3616
|
{
|
3673
3617
|
const BYTE* ip = (const BYTE*)seqStart;
|
3674
3618
|
const BYTE* const iend = ip + seqSize;
|
3675
|
-
BYTE* const ostart = (BYTE*
|
3619
|
+
BYTE* const ostart = (BYTE*)dst;
|
3676
3620
|
BYTE* const oend = ostart + maxDstSize;
|
3677
3621
|
BYTE* op = ostart;
|
3678
3622
|
const BYTE* litPtr = dctx->litPtr;
|
@@ -3799,7 +3743,7 @@ static size_t ZSTDv07_decompressFrame(ZSTDv07_DCtx* dctx,
|
|
3799
3743
|
{
|
3800
3744
|
const BYTE* ip = (const BYTE*)src;
|
3801
3745
|
const BYTE* const iend = ip + srcSize;
|
3802
|
-
BYTE* const ostart = (BYTE*
|
3746
|
+
BYTE* const ostart = (BYTE*)dst;
|
3803
3747
|
BYTE* const oend = ostart + dstCapacity;
|
3804
3748
|
BYTE* op = ostart;
|
3805
3749
|
size_t remainingSize = srcSize;
|
@@ -4063,8 +4007,8 @@ size_t ZSTDv07_decompressContinue(ZSTDv07_DCtx* dctx, void* dst, size_t dstCapac
|
|
4063
4007
|
}
|
4064
4008
|
dctx->stage = ZSTDds_decodeBlockHeader;
|
4065
4009
|
dctx->expected = ZSTDv07_blockHeaderSize;
|
4066
|
-
dctx->previousDstEnd = (char*)dst + rSize;
|
4067
4010
|
if (ZSTDv07_isError(rSize)) return rSize;
|
4011
|
+
dctx->previousDstEnd = (char*)dst + rSize;
|
4068
4012
|
if (dctx->fParams.checksumFlag) XXH64_update(&dctx->xxhState, dst, rSize);
|
4069
4013
|
return rSize;
|
4070
4014
|
}
|
@@ -4257,7 +4201,7 @@ ZSTDLIBv07_API size_t ZSTDv07_decompress_usingDDict(ZSTDv07_DCtx* dctx,
|
|
4257
4201
|
Buffered version of Zstd compression library
|
4258
4202
|
Copyright (C) 2015-2016, Yann Collet.
|
4259
4203
|
|
4260
|
-
BSD 2-Clause License (
|
4204
|
+
BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php)
|
4261
4205
|
|
4262
4206
|
Redistribution and use in source and binary forms, with or without
|
4263
4207
|
modification, are permitted provided that the following conditions are
|
@@ -4281,7 +4225,7 @@ ZSTDLIBv07_API size_t ZSTDv07_decompress_usingDDict(ZSTDv07_DCtx* dctx,
|
|
4281
4225
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
4282
4226
|
|
4283
4227
|
You can contact the author at :
|
4284
|
-
- zstd homepage :
|
4228
|
+
- zstd homepage : https://facebook.github.io/zstd/
|
4285
4229
|
*/
|
4286
4230
|
|
4287
4231
|
|
@@ -4421,7 +4365,8 @@ size_t ZBUFFv07_decompressContinue(ZBUFFv07_DCtx* zbd,
|
|
4421
4365
|
if (hSize != 0) {
|
4422
4366
|
size_t const toLoad = hSize - zbd->lhSize; /* if hSize!=0, hSize > zbd->lhSize */
|
4423
4367
|
if (toLoad > (size_t)(iend-ip)) { /* not enough input to load full header */
|
4424
|
-
|
4368
|
+
if (ip != NULL)
|
4369
|
+
memcpy(zbd->headerBuffer + zbd->lhSize, ip, iend-ip);
|
4425
4370
|
zbd->lhSize += iend-ip;
|
4426
4371
|
*dstCapacityPtr = 0;
|
4427
4372
|
return (hSize - zbd->lhSize) + ZSTDv07_blockHeaderSize; /* remaining header bytes + next block header */
|
@@ -0,0 +1,237 @@
|
|
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 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
|
+
|
19
|
+
##################################################################
|
20
|
+
# Input Variables
|
21
|
+
##################################################################
|
22
|
+
|
23
|
+
# By default, library's directory is same as this included makefile
|
24
|
+
LIB_SRCDIR ?= $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
25
|
+
LIB_BINDIR ?= $(LIBSRC_DIR)
|
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
|
30
|
+
|
31
|
+
# Legacy support
|
32
|
+
ifneq ($(ZSTD_LIB_MINIFY), 0)
|
33
|
+
ZSTD_LEGACY_SUPPORT ?= 0
|
34
|
+
else
|
35
|
+
ZSTD_LEGACY_SUPPORT ?= 5
|
36
|
+
endif
|
37
|
+
ZSTD_LEGACY_MULTITHREADED_API ?= 0
|
38
|
+
|
39
|
+
# Build size optimizations
|
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
|
55
|
+
|
56
|
+
# Assembly support
|
57
|
+
ZSTD_NO_ASM ?= 0
|
58
|
+
|
59
|
+
ZSTD_LIB_EXCLUDE_COMPRESSORS_DFAST_AND_UP ?= 0
|
60
|
+
ZSTD_LIB_EXCLUDE_COMPRESSORS_GREEDY_AND_UP ?= 0
|
61
|
+
|
62
|
+
##################################################################
|
63
|
+
# libzstd helpers
|
64
|
+
##################################################################
|
65
|
+
|
66
|
+
VOID ?= /dev/null
|
67
|
+
|
68
|
+
# Make 4.3 doesn't support '\#' anymore (https://lwn.net/Articles/810071/)
|
69
|
+
NUM_SYMBOL := \#
|
70
|
+
|
71
|
+
# define silent mode as default (verbose mode with V=1 or VERBOSE=1)
|
72
|
+
# Note : must be defined _after_ the default target
|
73
|
+
$(V)$(VERBOSE).SILENT:
|
74
|
+
|
75
|
+
# When cross-compiling from linux to windows,
|
76
|
+
# one might need to specify TARGET_SYSTEM as "Windows."
|
77
|
+
# Building from Fedora fails without it.
|
78
|
+
# (but Ubuntu and Debian don't need to set anything)
|
79
|
+
TARGET_SYSTEM ?= $(OS)
|
80
|
+
|
81
|
+
# Version numbers
|
82
|
+
LIBVER_SRC := $(LIB_SRCDIR)/zstd.h
|
83
|
+
LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
84
|
+
LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
85
|
+
LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
86
|
+
LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
|
87
|
+
LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT))
|
88
|
+
LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
|
89
|
+
LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
|
90
|
+
LIBVER := $(shell echo $(LIBVER_SCRIPT))
|
91
|
+
CCVER := $(shell $(CC) --version)
|
92
|
+
ZSTD_VERSION?= $(LIBVER)
|
93
|
+
|
94
|
+
ifneq ($(ZSTD_LIB_MINIFY), 0)
|
95
|
+
HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0)
|
96
|
+
ifneq ($(HAVE_CC_OZ), 0)
|
97
|
+
# Some compilers (clang) support an even more space-optimized setting.
|
98
|
+
CFLAGS += -Oz
|
99
|
+
else
|
100
|
+
CFLAGS += -Os
|
101
|
+
endif
|
102
|
+
CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \
|
103
|
+
-DDYNAMIC_BMI2=0 -DNDEBUG
|
104
|
+
else
|
105
|
+
CFLAGS ?= -O3
|
106
|
+
endif
|
107
|
+
|
108
|
+
DEBUGLEVEL ?= 0
|
109
|
+
CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL)
|
110
|
+
ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed
|
111
|
+
CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting
|
112
|
+
endif
|
113
|
+
DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
114
|
+
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
115
|
+
-Wstrict-prototypes -Wundef -Wpointer-arith \
|
116
|
+
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
|
117
|
+
-Wredundant-decls -Wmissing-prototypes -Wc++-compat
|
118
|
+
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
119
|
+
ASFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) $(CFLAGS)
|
120
|
+
LDFLAGS += $(MOREFLAGS)
|
121
|
+
FLAGS = $(CPPFLAGS) $(CFLAGS) $(ASFLAGS) $(LDFLAGS)
|
122
|
+
|
123
|
+
ifndef ALREADY_APPENDED_NOEXECSTACK
|
124
|
+
export ALREADY_APPENDED_NOEXECSTACK := 1
|
125
|
+
ifeq ($(shell echo "int main(int argc, char* argv[]) { (void)argc; (void)argv; return 0; }" | $(CC) $(FLAGS) -z noexecstack -x c -Werror - -o $(VOID) 2>$(VOID) && echo 1 || echo 0),1)
|
126
|
+
LDFLAGS += -z noexecstack
|
127
|
+
endif
|
128
|
+
ifeq ($(shell echo | $(CC) $(FLAGS) -Wa,--noexecstack -x assembler -Werror -c - -o $(VOID) 2>$(VOID) && echo 1 || echo 0),1)
|
129
|
+
CFLAGS += -Wa,--noexecstack
|
130
|
+
# CFLAGS are also added to ASFLAGS
|
131
|
+
else ifeq ($(shell echo | $(CC) $(FLAGS) -Qunused-arguments -Wa,--noexecstack -x assembler -Werror -c - -o $(VOID) 2>$(VOID) && echo 1 || echo 0),1)
|
132
|
+
# See e.g.: https://github.com/android/ndk/issues/171
|
133
|
+
CFLAGS += -Qunused-arguments -Wa,--noexecstack
|
134
|
+
# CFLAGS are also added to ASFLAGS
|
135
|
+
endif
|
136
|
+
endif
|
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
|
+
|
142
|
+
HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
|
143
|
+
GREP_OPTIONS ?=
|
144
|
+
ifeq ($(HAVE_COLORNEVER), 1)
|
145
|
+
GREP_OPTIONS += --color=never
|
146
|
+
endif
|
147
|
+
GREP = grep $(GREP_OPTIONS)
|
148
|
+
|
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))
|
154
|
+
ZSTD_LEGACY_FILES :=
|
155
|
+
|
156
|
+
ZSTD_DECOMPRESS_AMD64_ASM_FILES := $(sort $(wildcard $(LIB_SRCDIR)/decompress/*_amd64.S))
|
157
|
+
|
158
|
+
ifneq ($(ZSTD_NO_ASM), 0)
|
159
|
+
CPPFLAGS += -DZSTD_DISABLE_ASM
|
160
|
+
else
|
161
|
+
# Unconditionally add the ASM files they are disabled by
|
162
|
+
# macros in the .S file.
|
163
|
+
ZSTD_DECOMPRESS_FILES += $(ZSTD_DECOMPRESS_AMD64_ASM_FILES)
|
164
|
+
endif
|
165
|
+
|
166
|
+
ifneq ($(HUF_FORCE_DECOMPRESS_X1), 0)
|
167
|
+
CFLAGS += -DHUF_FORCE_DECOMPRESS_X1
|
168
|
+
endif
|
169
|
+
|
170
|
+
ifneq ($(HUF_FORCE_DECOMPRESS_X2), 0)
|
171
|
+
CFLAGS += -DHUF_FORCE_DECOMPRESS_X2
|
172
|
+
endif
|
173
|
+
|
174
|
+
ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT), 0)
|
175
|
+
CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
|
176
|
+
endif
|
177
|
+
|
178
|
+
ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG), 0)
|
179
|
+
CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
|
180
|
+
endif
|
181
|
+
|
182
|
+
ifneq ($(ZSTD_NO_INLINE), 0)
|
183
|
+
CFLAGS += -DZSTD_NO_INLINE
|
184
|
+
endif
|
185
|
+
|
186
|
+
ifneq ($(ZSTD_STRIP_ERROR_STRINGS), 0)
|
187
|
+
CFLAGS += -DZSTD_STRIP_ERROR_STRINGS
|
188
|
+
endif
|
189
|
+
|
190
|
+
ifneq ($(ZSTD_LEGACY_MULTITHREADED_API), 0)
|
191
|
+
CFLAGS += -DZSTD_LEGACY_MULTITHREADED_API
|
192
|
+
endif
|
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
|
+
|
202
|
+
ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
203
|
+
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
204
|
+
ZSTD_LEGACY_FILES += $(shell ls $(LIB_SRCDIR)/legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
|
205
|
+
endif
|
206
|
+
endif
|
207
|
+
CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT)
|
208
|
+
|
209
|
+
UNAME := $(shell uname)
|
210
|
+
|
211
|
+
ifndef BUILD_DIR
|
212
|
+
ifeq ($(UNAME), Darwin)
|
213
|
+
ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0)
|
214
|
+
HASH ?= md5
|
215
|
+
endif
|
216
|
+
else ifeq ($(UNAME), FreeBSD)
|
217
|
+
HASH ?= gmd5sum
|
218
|
+
else ifeq ($(UNAME), NetBSD)
|
219
|
+
HASH ?= md5 -n
|
220
|
+
else ifeq ($(UNAME), OpenBSD)
|
221
|
+
HASH ?= md5
|
222
|
+
endif
|
223
|
+
HASH ?= md5sum
|
224
|
+
|
225
|
+
HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " " )
|
226
|
+
HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0)
|
227
|
+
ifeq ($(HAVE_HASH),0)
|
228
|
+
$(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags)
|
229
|
+
BUILD_DIR := obj/generic_noconf
|
230
|
+
endif
|
231
|
+
endif # BUILD_DIR
|
232
|
+
|
233
|
+
ZSTD_SUBDIR := $(LIB_SRCDIR)/common $(LIB_SRCDIR)/compress $(LIB_SRCDIR)/decompress $(LIB_SRCDIR)/dictBuilder $(LIB_SRCDIR)/legacy $(LIB_SRCDIR)/deprecated
|
234
|
+
vpath %.c $(ZSTD_SUBDIR)
|
235
|
+
vpath %.S $(ZSTD_SUBDIR)
|
236
|
+
|
237
|
+
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,7 +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
14
|
Libs: -L${libdir} -lzstd
|
15
|
+
Libs.private: @LIBS_PRIVATE@
|
15
16
|
Cflags: -I${includedir}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module libzstd [extern_c] {
|
2
|
+
header "zstd.h"
|
3
|
+
export *
|
4
|
+
config_macros [exhaustive] \
|
5
|
+
/* zstd.h */ \
|
6
|
+
ZSTD_STATIC_LINKING_ONLY, \
|
7
|
+
ZSTDLIB_VISIBILITY, \
|
8
|
+
ZSTDLIB_VISIBLE, \
|
9
|
+
ZSTDLIB_HIDDEN, \
|
10
|
+
ZSTD_DLL_EXPORT, \
|
11
|
+
ZSTDLIB_STATIC_API, \
|
12
|
+
ZSTD_DISABLE_DEPRECATE_WARNINGS, \
|
13
|
+
ZSTD_CLEVEL_DEFAULT, \
|
14
|
+
/* zdict.h */ \
|
15
|
+
ZDICT_STATIC_LINKING_ONLY, \
|
16
|
+
ZDICTLIB_VISIBLE, \
|
17
|
+
ZDICTLIB_HIDDEN, \
|
18
|
+
ZDICTLIB_VISIBILITY, \
|
19
|
+
ZDICTLIB_STATIC_API, \
|
20
|
+
ZDICT_DISABLE_DEPRECATE_WARNINGS, \
|
21
|
+
/* zstd_errors.h */ \
|
22
|
+
ZSTDERRORLIB_VISIBLE, \
|
23
|
+
ZSTDERRORLIB_HIDDEN, \
|
24
|
+
ZSTDERRORLIB_VISIBILITY
|
25
|
+
|
26
|
+
module dictbuilder [extern_c] {
|
27
|
+
header "zdict.h"
|
28
|
+
export *
|
29
|
+
}
|
30
|
+
|
31
|
+
module errors [extern_c] {
|
32
|
+
header "zstd_errors.h"
|
33
|
+
export *
|
34
|
+
}
|
35
|
+
}
|