zstd-ruby 1.4.5.0 → 1.5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +35 -0
- data/README.md +2 -2
- data/ext/zstdruby/extconf.rb +2 -1
- data/ext/zstdruby/libzstd/BUCK +5 -7
- data/ext/zstdruby/libzstd/Makefile +225 -222
- data/ext/zstdruby/libzstd/README.md +43 -5
- data/ext/zstdruby/libzstd/common/bitstream.h +46 -22
- data/ext/zstdruby/libzstd/common/compiler.h +182 -22
- data/ext/zstdruby/libzstd/common/cpu.h +1 -3
- data/ext/zstdruby/libzstd/common/debug.c +1 -1
- data/ext/zstdruby/libzstd/common/debug.h +12 -19
- data/ext/zstdruby/libzstd/common/entropy_common.c +196 -44
- data/ext/zstdruby/libzstd/common/error_private.c +2 -1
- data/ext/zstdruby/libzstd/common/error_private.h +82 -3
- data/ext/zstdruby/libzstd/common/fse.h +41 -12
- data/ext/zstdruby/libzstd/common/fse_decompress.c +139 -22
- data/ext/zstdruby/libzstd/common/huf.h +47 -23
- data/ext/zstdruby/libzstd/common/mem.h +87 -98
- data/ext/zstdruby/libzstd/common/pool.c +23 -17
- data/ext/zstdruby/libzstd/common/pool.h +2 -2
- data/ext/zstdruby/libzstd/common/portability_macros.h +131 -0
- data/ext/zstdruby/libzstd/common/threading.c +6 -5
- data/ext/zstdruby/libzstd/common/xxhash.c +6 -846
- data/ext/zstdruby/libzstd/common/xxhash.h +5568 -167
- data/ext/zstdruby/libzstd/common/zstd_common.c +10 -10
- data/ext/zstdruby/libzstd/common/zstd_deps.h +111 -0
- data/ext/zstdruby/libzstd/common/zstd_internal.h +189 -142
- data/ext/zstdruby/libzstd/common/zstd_trace.h +163 -0
- data/ext/zstdruby/libzstd/compress/clevels.h +134 -0
- data/ext/zstdruby/libzstd/compress/fse_compress.c +89 -46
- data/ext/zstdruby/libzstd/compress/hist.c +27 -29
- data/ext/zstdruby/libzstd/compress/hist.h +2 -2
- data/ext/zstdruby/libzstd/compress/huf_compress.c +770 -198
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +2894 -863
- data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +390 -90
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +12 -11
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +4 -2
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +31 -8
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +25 -297
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +206 -69
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +307 -132
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_fast.c +322 -143
- data/ext/zstdruby/libzstd/compress/zstd_fast.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_lazy.c +1136 -174
- data/ext/zstdruby/libzstd/compress/zstd_lazy.h +59 -1
- data/ext/zstdruby/libzstd/compress/zstd_ldm.c +316 -213
- data/ext/zstdruby/libzstd/compress/zstd_ldm.h +9 -2
- data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +106 -0
- data/ext/zstdruby/libzstd/compress/zstd_opt.c +373 -150
- data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +152 -444
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +31 -113
- data/ext/zstdruby/libzstd/decompress/huf_decompress.c +1044 -403
- data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +571 -0
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +9 -9
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +2 -2
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +450 -105
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +913 -273
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +14 -5
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +59 -12
- data/ext/zstdruby/libzstd/deprecated/zbuff.h +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +24 -4
- data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +55 -38
- data/ext/zstdruby/libzstd/dictBuilder/cover.h +7 -6
- data/ext/zstdruby/libzstd/dictBuilder/divsufsort.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +43 -34
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +128 -58
- data/ext/zstdruby/libzstd/dll/example/Makefile +1 -1
- data/ext/zstdruby/libzstd/dll/example/README.md +16 -22
- data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v01.c +8 -8
- data/ext/zstdruby/libzstd/legacy/zstd_v01.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v02.c +9 -9
- data/ext/zstdruby/libzstd/legacy/zstd_v02.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v03.c +9 -9
- data/ext/zstdruby/libzstd/legacy/zstd_v03.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v04.c +10 -10
- data/ext/zstdruby/libzstd/legacy/zstd_v04.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v05.c +13 -13
- data/ext/zstdruby/libzstd/legacy/zstd_v05.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v06.c +13 -13
- data/ext/zstdruby/libzstd/legacy/zstd_v06.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v07.c +13 -13
- data/ext/zstdruby/libzstd/legacy/zstd_v07.h +1 -1
- data/ext/zstdruby/libzstd/libzstd.mk +185 -0
- data/ext/zstdruby/libzstd/libzstd.pc.in +4 -3
- data/ext/zstdruby/libzstd/modulemap/module.modulemap +4 -0
- data/ext/zstdruby/libzstd/{dictBuilder/zdict.h → zdict.h} +154 -7
- data/ext/zstdruby/libzstd/zstd.h +699 -214
- data/ext/zstdruby/libzstd/{common/zstd_errors.h → zstd_errors.h} +2 -1
- data/ext/zstdruby/zstdruby.c +2 -2
- data/lib/zstd-ruby/version.rb +1 -1
- metadata +15 -6
- data/.travis.yml +0 -14
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -204,10 +204,7 @@ typedef signed long long S64;
|
|
204
204
|
* Prefer these methods in priority order (0 > 1 > 2)
|
205
205
|
*/
|
206
206
|
#ifndef FSE_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
207
|
-
# if defined(
|
208
|
-
# define FSE_FORCE_MEMORY_ACCESS 2
|
209
|
-
# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
|
210
|
-
(defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
|
207
|
+
# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
211
208
|
# define FSE_FORCE_MEMORY_ACCESS 1
|
212
209
|
# endif
|
213
210
|
#endif
|
@@ -343,8 +340,7 @@ FORCE_INLINE unsigned FSE_highbit32 (U32 val)
|
|
343
340
|
{
|
344
341
|
# if defined(_MSC_VER) /* Visual */
|
345
342
|
unsigned long r;
|
346
|
-
_BitScanReverse
|
347
|
-
return (unsigned) r;
|
343
|
+
return _BitScanReverse(&r, val) ? (unsigned)r : 0;
|
348
344
|
# elif defined(__GNUC__) && (GCC_VERSION >= 304) /* GCC Intrinsic */
|
349
345
|
return __builtin_clz (val) ^ 31;
|
350
346
|
# else /* Software version */
|
@@ -1280,7 +1276,11 @@ static size_t HUF_decompress (void* dst, size_t maxDstSize, const void* cSrc, si
|
|
1280
1276
|
* Basic Types
|
1281
1277
|
*********************************************************/
|
1282
1278
|
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
|
1283
|
-
#
|
1279
|
+
# if defined(_AIX)
|
1280
|
+
# include <inttypes.h>
|
1281
|
+
# else
|
1282
|
+
# include <stdint.h> /* intptr_t */
|
1283
|
+
# endif
|
1284
1284
|
typedef uint8_t BYTE;
|
1285
1285
|
typedef uint16_t U16;
|
1286
1286
|
typedef int16_t S16;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -89,7 +89,11 @@ extern "C" {
|
|
89
89
|
* Basic Types
|
90
90
|
*****************************************************************/
|
91
91
|
#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
92
|
-
#
|
92
|
+
# if defined(_AIX)
|
93
|
+
# include <inttypes.h>
|
94
|
+
# else
|
95
|
+
# include <stdint.h> /* intptr_t */
|
96
|
+
# endif
|
93
97
|
typedef uint8_t BYTE;
|
94
98
|
typedef uint16_t U16;
|
95
99
|
typedef int16_t S16;
|
@@ -125,10 +129,7 @@ extern "C" {
|
|
125
129
|
* Prefer these methods in priority order (0 > 1 > 2)
|
126
130
|
*/
|
127
131
|
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
128
|
-
# if defined(
|
129
|
-
# define MEM_FORCE_MEMORY_ACCESS 2
|
130
|
-
# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
|
131
|
-
(defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
|
132
|
+
# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
132
133
|
# define MEM_FORCE_MEMORY_ACCESS 1
|
133
134
|
# endif
|
134
135
|
#endif
|
@@ -349,9 +350,8 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits);
|
|
349
350
|
MEM_STATIC unsigned BIT_highbit32 (U32 val)
|
350
351
|
{
|
351
352
|
# if defined(_MSC_VER) /* Visual */
|
352
|
-
unsigned long r
|
353
|
-
_BitScanReverse
|
354
|
-
return (unsigned) r;
|
353
|
+
unsigned long r;
|
354
|
+
return _BitScanReverse(&r, val) ? (unsigned)r : 0;
|
355
355
|
# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
|
356
356
|
return __builtin_clz (val) ^ 31;
|
357
357
|
# else /* Software version */
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -90,7 +90,11 @@ extern "C" {
|
|
90
90
|
* Basic Types
|
91
91
|
*****************************************************************/
|
92
92
|
#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
93
|
-
#
|
93
|
+
# if defined(_AIX)
|
94
|
+
# include <inttypes.h>
|
95
|
+
# else
|
96
|
+
# include <stdint.h> /* intptr_t */
|
97
|
+
# endif
|
94
98
|
typedef uint8_t BYTE;
|
95
99
|
typedef uint16_t U16;
|
96
100
|
typedef int16_t S16;
|
@@ -126,10 +130,7 @@ extern "C" {
|
|
126
130
|
* Prefer these methods in priority order (0 > 1 > 2)
|
127
131
|
*/
|
128
132
|
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
129
|
-
# if defined(
|
130
|
-
# define MEM_FORCE_MEMORY_ACCESS 2
|
131
|
-
# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
|
132
|
-
(defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
|
133
|
+
# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
133
134
|
# define MEM_FORCE_MEMORY_ACCESS 1
|
134
135
|
# endif
|
135
136
|
#endif
|
@@ -352,9 +353,8 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits);
|
|
352
353
|
MEM_STATIC unsigned BIT_highbit32 (U32 val)
|
353
354
|
{
|
354
355
|
# if defined(_MSC_VER) /* Visual */
|
355
|
-
unsigned long r
|
356
|
-
_BitScanReverse
|
357
|
-
return (unsigned) r;
|
356
|
+
unsigned long r;
|
357
|
+
return _BitScanReverse(&r, val) ? (unsigned)r : 0;
|
358
358
|
# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
|
359
359
|
return __builtin_clz (val) ^ 31;
|
360
360
|
# else /* Software version */
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -52,7 +52,11 @@ extern "C" {
|
|
52
52
|
* Basic Types
|
53
53
|
*****************************************************************/
|
54
54
|
#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
55
|
-
#
|
55
|
+
# if defined(_AIX)
|
56
|
+
# include <inttypes.h>
|
57
|
+
# else
|
58
|
+
# include <stdint.h> /* intptr_t */
|
59
|
+
# endif
|
56
60
|
typedef uint8_t BYTE;
|
57
61
|
typedef uint16_t U16;
|
58
62
|
typedef int16_t S16;
|
@@ -74,7 +78,7 @@ extern "C" {
|
|
74
78
|
/*-*************************************
|
75
79
|
* Debug
|
76
80
|
***************************************/
|
77
|
-
#include "debug.h"
|
81
|
+
#include "../common/debug.h"
|
78
82
|
#ifndef assert
|
79
83
|
# define assert(condition) ((void)0)
|
80
84
|
#endif
|
@@ -97,10 +101,7 @@ extern "C" {
|
|
97
101
|
* Prefer these methods in priority order (0 > 1 > 2)
|
98
102
|
*/
|
99
103
|
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
100
|
-
# if defined(
|
101
|
-
# define MEM_FORCE_MEMORY_ACCESS 2
|
102
|
-
# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
|
103
|
-
(defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
|
104
|
+
# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
104
105
|
# define MEM_FORCE_MEMORY_ACCESS 1
|
105
106
|
# endif
|
106
107
|
#endif
|
@@ -623,9 +624,8 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits);
|
|
623
624
|
MEM_STATIC unsigned BIT_highbit32 (U32 val)
|
624
625
|
{
|
625
626
|
# if defined(_MSC_VER) /* Visual */
|
626
|
-
unsigned long r
|
627
|
-
_BitScanReverse
|
628
|
-
return (unsigned) r;
|
627
|
+
unsigned long r;
|
628
|
+
return _BitScanReverse(&r, val) ? (unsigned)r : 0;
|
629
629
|
# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
|
630
630
|
return __builtin_clz (val) ^ 31;
|
631
631
|
# else /* Software version */
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -80,7 +80,11 @@ extern "C" {
|
|
80
80
|
* Basic Types
|
81
81
|
*****************************************************************/
|
82
82
|
#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
83
|
-
#
|
83
|
+
# if defined(_AIX)
|
84
|
+
# include <inttypes.h>
|
85
|
+
# else
|
86
|
+
# include <stdint.h> /* intptr_t */
|
87
|
+
# endif
|
84
88
|
typedef uint8_t BYTE;
|
85
89
|
typedef uint16_t U16;
|
86
90
|
typedef int16_t S16;
|
@@ -116,10 +120,7 @@ extern "C" {
|
|
116
120
|
* Prefer these methods in priority order (0 > 1 > 2)
|
117
121
|
*/
|
118
122
|
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
119
|
-
# if defined(
|
120
|
-
# define MEM_FORCE_MEMORY_ACCESS 2
|
121
|
-
# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
|
122
|
-
(defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
|
123
|
+
# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
123
124
|
# define MEM_FORCE_MEMORY_ACCESS 1
|
124
125
|
# endif
|
125
126
|
#endif
|
@@ -752,9 +753,8 @@ MEM_STATIC size_t BITv05_readBitsFast(BITv05_DStream_t* bitD, unsigned nbBits);
|
|
752
753
|
MEM_STATIC unsigned BITv05_highbit32 (U32 val)
|
753
754
|
{
|
754
755
|
# if defined(_MSC_VER) /* Visual */
|
755
|
-
unsigned long r
|
756
|
-
_BitScanReverse
|
757
|
-
return (unsigned) r;
|
756
|
+
unsigned long r;
|
757
|
+
return _BitScanReverse(&r, val) ? (unsigned)r : 0;
|
758
758
|
# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
|
759
759
|
return __builtin_clz (val) ^ 31;
|
760
760
|
# else /* Software version */
|
@@ -2829,7 +2829,7 @@ static size_t ZSTDv05_decodeFrameHeader_Part2(ZSTDv05_DCtx* zc, const void* src,
|
|
2829
2829
|
|
2830
2830
|
static size_t ZSTDv05_getcBlockSize(const void* src, size_t srcSize, blockProperties_t* bpPtr)
|
2831
2831
|
{
|
2832
|
-
const BYTE* const in = (const BYTE*
|
2832
|
+
const BYTE* const in = (const BYTE*)src;
|
2833
2833
|
BYTE headerFlags;
|
2834
2834
|
U32 cSize;
|
2835
2835
|
|
@@ -2998,7 +2998,7 @@ static size_t ZSTDv05_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t
|
|
2998
2998
|
FSEv05_DTable* DTableLL, FSEv05_DTable* DTableML, FSEv05_DTable* DTableOffb,
|
2999
2999
|
const void* src, size_t srcSize, U32 flagStaticTable)
|
3000
3000
|
{
|
3001
|
-
const BYTE* const istart = (const BYTE*
|
3001
|
+
const BYTE* const istart = (const BYTE*)src;
|
3002
3002
|
const BYTE* ip = istart;
|
3003
3003
|
const BYTE* const iend = istart + srcSize;
|
3004
3004
|
U32 LLtype, Offtype, MLtype;
|
@@ -3306,7 +3306,7 @@ static size_t ZSTDv05_decompressSequences(
|
|
3306
3306
|
{
|
3307
3307
|
const BYTE* ip = (const BYTE*)seqStart;
|
3308
3308
|
const BYTE* const iend = ip + seqSize;
|
3309
|
-
BYTE* const ostart = (BYTE*
|
3309
|
+
BYTE* const ostart = (BYTE*)dst;
|
3310
3310
|
BYTE* op = ostart;
|
3311
3311
|
BYTE* const oend = ostart + maxDstSize;
|
3312
3312
|
size_t errorCode, dumpsLength=0;
|
@@ -3419,7 +3419,7 @@ static size_t ZSTDv05_decompress_continueDCtx(ZSTDv05_DCtx* dctx,
|
|
3419
3419
|
{
|
3420
3420
|
const BYTE* ip = (const BYTE*)src;
|
3421
3421
|
const BYTE* iend = ip + srcSize;
|
3422
|
-
BYTE* const ostart = (BYTE*
|
3422
|
+
BYTE* const ostart = (BYTE*)dst;
|
3423
3423
|
BYTE* op = ostart;
|
3424
3424
|
BYTE* const oend = ostart + maxDstSize;
|
3425
3425
|
size_t remainingSize = srcSize;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -82,7 +82,11 @@ extern "C" {
|
|
82
82
|
* Basic Types
|
83
83
|
*****************************************************************/
|
84
84
|
#if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) )
|
85
|
-
#
|
85
|
+
# if defined(_AIX)
|
86
|
+
# include <inttypes.h>
|
87
|
+
# else
|
88
|
+
# include <stdint.h> /* intptr_t */
|
89
|
+
# endif
|
86
90
|
typedef uint8_t BYTE;
|
87
91
|
typedef uint16_t U16;
|
88
92
|
typedef int16_t S16;
|
@@ -118,10 +122,7 @@ extern "C" {
|
|
118
122
|
* Prefer these methods in priority order (0 > 1 > 2)
|
119
123
|
*/
|
120
124
|
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
121
|
-
# if defined(
|
122
|
-
# define MEM_FORCE_MEMORY_ACCESS 2
|
123
|
-
# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
|
124
|
-
(defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
|
125
|
+
# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
125
126
|
# define MEM_FORCE_MEMORY_ACCESS 1
|
126
127
|
# endif
|
127
128
|
#endif
|
@@ -856,9 +857,8 @@ MEM_STATIC size_t BITv06_readBitsFast(BITv06_DStream_t* bitD, unsigned nbBits);
|
|
856
857
|
MEM_STATIC unsigned BITv06_highbit32 ( U32 val)
|
857
858
|
{
|
858
859
|
# if defined(_MSC_VER) /* Visual */
|
859
|
-
unsigned long r
|
860
|
-
_BitScanReverse
|
861
|
-
return (unsigned) r;
|
860
|
+
unsigned long r;
|
861
|
+
return _BitScanReverse(&r, val) ? (unsigned)r : 0;
|
862
862
|
# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
|
863
863
|
return __builtin_clz (val) ^ 31;
|
864
864
|
# else /* Software version */
|
@@ -3025,7 +3025,7 @@ typedef struct
|
|
3025
3025
|
* Provides the size of compressed block from block header `src` */
|
3026
3026
|
static size_t ZSTDv06_getcBlockSize(const void* src, size_t srcSize, blockProperties_t* bpPtr)
|
3027
3027
|
{
|
3028
|
-
const BYTE* const in = (const BYTE*
|
3028
|
+
const BYTE* const in = (const BYTE*)src;
|
3029
3029
|
U32 cSize;
|
3030
3030
|
|
3031
3031
|
if (srcSize < ZSTDv06_blockHeaderSize) return ERROR(srcSize_wrong);
|
@@ -3219,7 +3219,7 @@ static size_t ZSTDv06_decodeSeqHeaders(int* nbSeqPtr,
|
|
3219
3219
|
FSEv06_DTable* DTableLL, FSEv06_DTable* DTableML, FSEv06_DTable* DTableOffb, U32 flagRepeatTable,
|
3220
3220
|
const void* src, size_t srcSize)
|
3221
3221
|
{
|
3222
|
-
const BYTE* const istart = (const BYTE*
|
3222
|
+
const BYTE* const istart = (const BYTE*)src;
|
3223
3223
|
const BYTE* const iend = istart + srcSize;
|
3224
3224
|
const BYTE* ip = istart;
|
3225
3225
|
|
@@ -3441,7 +3441,7 @@ static size_t ZSTDv06_decompressSequences(
|
|
3441
3441
|
{
|
3442
3442
|
const BYTE* ip = (const BYTE*)seqStart;
|
3443
3443
|
const BYTE* const iend = ip + seqSize;
|
3444
|
-
BYTE* const ostart = (BYTE*
|
3444
|
+
BYTE* const ostart = (BYTE*)dst;
|
3445
3445
|
BYTE* const oend = ostart + maxDstSize;
|
3446
3446
|
BYTE* op = ostart;
|
3447
3447
|
const BYTE* litPtr = dctx->litPtr;
|
@@ -3557,7 +3557,7 @@ static size_t ZSTDv06_decompressFrame(ZSTDv06_DCtx* dctx,
|
|
3557
3557
|
{
|
3558
3558
|
const BYTE* ip = (const BYTE*)src;
|
3559
3559
|
const BYTE* const iend = ip + srcSize;
|
3560
|
-
BYTE* const ostart = (BYTE*
|
3560
|
+
BYTE* const ostart = (BYTE*)dst;
|
3561
3561
|
BYTE* op = ostart;
|
3562
3562
|
BYTE* const oend = ostart + dstCapacity;
|
3563
3563
|
size_t remainingSize = srcSize;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -242,7 +242,11 @@ extern "C" {
|
|
242
242
|
* Basic Types
|
243
243
|
*****************************************************************/
|
244
244
|
#if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) )
|
245
|
-
#
|
245
|
+
# if defined(_AIX)
|
246
|
+
# include <inttypes.h>
|
247
|
+
# else
|
248
|
+
# include <stdint.h> /* intptr_t */
|
249
|
+
# endif
|
246
250
|
typedef uint8_t BYTE;
|
247
251
|
typedef uint16_t U16;
|
248
252
|
typedef int16_t S16;
|
@@ -278,10 +282,7 @@ extern "C" {
|
|
278
282
|
* Prefer these methods in priority order (0 > 1 > 2)
|
279
283
|
*/
|
280
284
|
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
281
|
-
# if defined(
|
282
|
-
# define MEM_FORCE_MEMORY_ACCESS 2
|
283
|
-
# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
|
284
|
-
(defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
|
285
|
+
# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
285
286
|
# define MEM_FORCE_MEMORY_ACCESS 1
|
286
287
|
# endif
|
287
288
|
#endif
|
@@ -526,9 +527,8 @@ MEM_STATIC size_t BITv07_readBitsFast(BITv07_DStream_t* bitD, unsigned nbBits);
|
|
526
527
|
MEM_STATIC unsigned BITv07_highbit32 (U32 val)
|
527
528
|
{
|
528
529
|
# if defined(_MSC_VER) /* Visual */
|
529
|
-
unsigned long r
|
530
|
-
_BitScanReverse
|
531
|
-
return (unsigned) r;
|
530
|
+
unsigned long r;
|
531
|
+
return _BitScanReverse(&r, val) ? (unsigned)r : 0;
|
532
532
|
# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
|
533
533
|
return __builtin_clz (val) ^ 31;
|
534
534
|
# else /* Software version */
|
@@ -3254,7 +3254,7 @@ typedef struct
|
|
3254
3254
|
* Provides the size of compressed block from block header `src` */
|
3255
3255
|
static size_t ZSTDv07_getcBlockSize(const void* src, size_t srcSize, blockProperties_t* bpPtr)
|
3256
3256
|
{
|
3257
|
-
const BYTE* const in = (const BYTE*
|
3257
|
+
const BYTE* const in = (const BYTE*)src;
|
3258
3258
|
U32 cSize;
|
3259
3259
|
|
3260
3260
|
if (srcSize < ZSTDv07_blockHeaderSize) return ERROR(srcSize_wrong);
|
@@ -3449,7 +3449,7 @@ static size_t ZSTDv07_decodeSeqHeaders(int* nbSeqPtr,
|
|
3449
3449
|
FSEv07_DTable* DTableLL, FSEv07_DTable* DTableML, FSEv07_DTable* DTableOffb, U32 flagRepeatTable,
|
3450
3450
|
const void* src, size_t srcSize)
|
3451
3451
|
{
|
3452
|
-
const BYTE* const istart = (const BYTE*
|
3452
|
+
const BYTE* const istart = (const BYTE*)src;
|
3453
3453
|
const BYTE* const iend = istart + srcSize;
|
3454
3454
|
const BYTE* ip = istart;
|
3455
3455
|
|
@@ -3668,7 +3668,7 @@ static size_t ZSTDv07_decompressSequences(
|
|
3668
3668
|
{
|
3669
3669
|
const BYTE* ip = (const BYTE*)seqStart;
|
3670
3670
|
const BYTE* const iend = ip + seqSize;
|
3671
|
-
BYTE* const ostart = (BYTE*
|
3671
|
+
BYTE* const ostart = (BYTE*)dst;
|
3672
3672
|
BYTE* const oend = ostart + maxDstSize;
|
3673
3673
|
BYTE* op = ostart;
|
3674
3674
|
const BYTE* litPtr = dctx->litPtr;
|
@@ -3795,7 +3795,7 @@ static size_t ZSTDv07_decompressFrame(ZSTDv07_DCtx* dctx,
|
|
3795
3795
|
{
|
3796
3796
|
const BYTE* ip = (const BYTE*)src;
|
3797
3797
|
const BYTE* const iend = ip + srcSize;
|
3798
|
-
BYTE* const ostart = (BYTE*
|
3798
|
+
BYTE* const ostart = (BYTE*)dst;
|
3799
3799
|
BYTE* const oend = ostart + dstCapacity;
|
3800
3800
|
BYTE* op = ostart;
|
3801
3801
|
size_t remainingSize = srcSize;
|
@@ -0,0 +1,185 @@
|
|
1
|
+
# ################################################################
|
2
|
+
# Copyright (c) Yann Collet, Facebook, Inc.
|
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
|
+
# Input Variables
|
13
|
+
##################################################################
|
14
|
+
|
15
|
+
# Zstd lib directory
|
16
|
+
LIBZSTD ?= ./
|
17
|
+
|
18
|
+
# Legacy support
|
19
|
+
ZSTD_LEGACY_SUPPORT ?= 5
|
20
|
+
ZSTD_LEGACY_MULTITHREADED_API ?= 0
|
21
|
+
|
22
|
+
# Build size optimizations
|
23
|
+
HUF_FORCE_DECOMPRESS_X1 ?= 0
|
24
|
+
HUF_FORCE_DECOMPRESS_X2 ?= 0
|
25
|
+
ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 0
|
26
|
+
ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG ?= 0
|
27
|
+
ZSTD_NO_INLINE ?= 0
|
28
|
+
ZSTD_STRIP_ERROR_STRINGS ?= 0
|
29
|
+
|
30
|
+
# Assembly support
|
31
|
+
ZSTD_NO_ASM ?= 0
|
32
|
+
|
33
|
+
##################################################################
|
34
|
+
# libzstd helpers
|
35
|
+
##################################################################
|
36
|
+
|
37
|
+
# Make 4.3 doesn't support '\#' anymore (https://lwn.net/Articles/810071/)
|
38
|
+
NUM_SYMBOL := \#
|
39
|
+
|
40
|
+
# define silent mode as default (verbose mode with V=1 or VERBOSE=1)
|
41
|
+
$(V)$(VERBOSE).SILENT:
|
42
|
+
|
43
|
+
# When cross-compiling from linux to windows,
|
44
|
+
# one might need to specify TARGET_SYSTEM as "Windows."
|
45
|
+
# Building from Fedora fails without it.
|
46
|
+
# (but Ubuntu and Debian don't need to set anything)
|
47
|
+
TARGET_SYSTEM ?= $(OS)
|
48
|
+
|
49
|
+
# Version numbers
|
50
|
+
LIBVER_SRC := $(LIBZSTD)/zstd.h
|
51
|
+
LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
52
|
+
LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
53
|
+
LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
|
54
|
+
LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
|
55
|
+
LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT))
|
56
|
+
LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
|
57
|
+
LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
|
58
|
+
LIBVER := $(shell echo $(LIBVER_SCRIPT))
|
59
|
+
CCVER := $(shell $(CC) --version)
|
60
|
+
ZSTD_VERSION?= $(LIBVER)
|
61
|
+
|
62
|
+
# ZSTD_LIB_MINIFY is a helper variable that
|
63
|
+
# configures a bunch of other variables to space-optimized defaults.
|
64
|
+
ZSTD_LIB_MINIFY ?= 0
|
65
|
+
ifneq ($(ZSTD_LIB_MINIFY), 0)
|
66
|
+
HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0)
|
67
|
+
ZSTD_LEGACY_SUPPORT ?= 0
|
68
|
+
ZSTD_LIB_DEPRECATED ?= 0
|
69
|
+
HUF_FORCE_DECOMPRESS_X1 ?= 1
|
70
|
+
ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 1
|
71
|
+
ZSTD_NO_INLINE ?= 1
|
72
|
+
ZSTD_STRIP_ERROR_STRINGS ?= 1
|
73
|
+
ifneq ($(HAVE_CC_OZ), 0)
|
74
|
+
# Some compilers (clang) support an even more space-optimized setting.
|
75
|
+
CFLAGS += -Oz
|
76
|
+
else
|
77
|
+
CFLAGS += -Os
|
78
|
+
endif
|
79
|
+
CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \
|
80
|
+
-DDYNAMIC_BMI2=0 -DNDEBUG
|
81
|
+
else
|
82
|
+
CFLAGS += -O3
|
83
|
+
endif
|
84
|
+
|
85
|
+
DEBUGLEVEL ?= 0
|
86
|
+
CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL)
|
87
|
+
ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed
|
88
|
+
CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting
|
89
|
+
endif
|
90
|
+
DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
91
|
+
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
92
|
+
-Wstrict-prototypes -Wundef -Wpointer-arith \
|
93
|
+
-Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
|
94
|
+
-Wredundant-decls -Wmissing-prototypes -Wc++-compat
|
95
|
+
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
96
|
+
LDFLAGS += $(MOREFLAGS)
|
97
|
+
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
98
|
+
|
99
|
+
HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
|
100
|
+
GREP_OPTIONS ?=
|
101
|
+
ifeq ($HAVE_COLORNEVER, 1)
|
102
|
+
GREP_OPTIONS += --color=never
|
103
|
+
endif
|
104
|
+
GREP = grep $(GREP_OPTIONS)
|
105
|
+
SED_ERE_OPT ?= -E
|
106
|
+
|
107
|
+
ZSTD_COMMON_FILES := $(sort $(wildcard $(LIBZSTD)/common/*.c))
|
108
|
+
ZSTD_COMPRESS_FILES := $(sort $(wildcard $(LIBZSTD)/compress/*.c))
|
109
|
+
ZSTD_DECOMPRESS_FILES := $(sort $(wildcard $(LIBZSTD)/decompress/*.c))
|
110
|
+
ZSTD_DICTBUILDER_FILES := $(sort $(wildcard $(LIBZSTD)/dictBuilder/*.c))
|
111
|
+
ZSTD_DEPRECATED_FILES := $(sort $(wildcard $(LIBZSTD)/deprecated/*.c))
|
112
|
+
ZSTD_LEGACY_FILES :=
|
113
|
+
|
114
|
+
ZSTD_DECOMPRESS_AMD64_ASM_FILES := $(sort $(wildcard $(LIBZSTD)/decompress/*_amd64.S))
|
115
|
+
|
116
|
+
ifneq ($(ZSTD_NO_ASM), 0)
|
117
|
+
CPPFLAGS += -DZSTD_DISABLE_ASM
|
118
|
+
else
|
119
|
+
# Unconditionally add the ASM files they are disabled by
|
120
|
+
# macros in the .S file.
|
121
|
+
ZSTD_DECOMPRESS_FILES += $(ZSTD_DECOMPRESS_AMD64_ASM_FILES)
|
122
|
+
endif
|
123
|
+
|
124
|
+
ifneq ($(HUF_FORCE_DECOMPRESS_X1), 0)
|
125
|
+
CFLAGS += -DHUF_FORCE_DECOMPRESS_X1
|
126
|
+
endif
|
127
|
+
|
128
|
+
ifneq ($(HUF_FORCE_DECOMPRESS_X2), 0)
|
129
|
+
CFLAGS += -DHUF_FORCE_DECOMPRESS_X2
|
130
|
+
endif
|
131
|
+
|
132
|
+
ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT), 0)
|
133
|
+
CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
|
134
|
+
endif
|
135
|
+
|
136
|
+
ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG), 0)
|
137
|
+
CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
|
138
|
+
endif
|
139
|
+
|
140
|
+
ifneq ($(ZSTD_NO_INLINE), 0)
|
141
|
+
CFLAGS += -DZSTD_NO_INLINE
|
142
|
+
endif
|
143
|
+
|
144
|
+
ifneq ($(ZSTD_STRIP_ERROR_STRINGS), 0)
|
145
|
+
CFLAGS += -DZSTD_STRIP_ERROR_STRINGS
|
146
|
+
endif
|
147
|
+
|
148
|
+
ifneq ($(ZSTD_LEGACY_MULTITHREADED_API), 0)
|
149
|
+
CFLAGS += -DZSTD_LEGACY_MULTITHREADED_API
|
150
|
+
endif
|
151
|
+
|
152
|
+
ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
153
|
+
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
154
|
+
ZSTD_LEGACY_FILES += $(shell ls $(LIBZSTD)/legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
|
155
|
+
endif
|
156
|
+
endif
|
157
|
+
CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT)
|
158
|
+
|
159
|
+
UNAME := $(shell uname)
|
160
|
+
|
161
|
+
ifndef BUILD_DIR
|
162
|
+
ifeq ($(UNAME), Darwin)
|
163
|
+
ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0)
|
164
|
+
HASH ?= md5
|
165
|
+
endif
|
166
|
+
else ifeq ($(UNAME), FreeBSD)
|
167
|
+
HASH ?= gmd5sum
|
168
|
+
else ifeq ($(UNAME), NetBSD)
|
169
|
+
HASH ?= md5 -n
|
170
|
+
else ifeq ($(UNAME), OpenBSD)
|
171
|
+
HASH ?= md5
|
172
|
+
endif
|
173
|
+
HASH ?= md5sum
|
174
|
+
|
175
|
+
HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " " )
|
176
|
+
HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0)
|
177
|
+
ifeq ($(HAVE_HASH),0)
|
178
|
+
$(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags)
|
179
|
+
BUILD_DIR := obj/generic_noconf
|
180
|
+
endif
|
181
|
+
endif # BUILD_DIR
|
182
|
+
|
183
|
+
ZSTD_SUBDIR := $(LIBZSTD)/common $(LIBZSTD)/compress $(LIBZSTD)/decompress $(LIBZSTD)/dictBuilder $(LIBZSTD)/legacy $(LIBZSTD)/deprecated
|
184
|
+
vpath %.c $(ZSTD_SUBDIR)
|
185
|
+
vpath %.S $(ZSTD_SUBDIR)
|