zstdlib 0.14.0-x86-mingw32 → 0.15.0-x86-mingw32
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/CHANGES.md +5 -0
- data/ext/zstdlib_c/extconf.rb +1 -1
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/bits.h +92 -87
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/bitstream.h +26 -29
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/compiler.h +36 -22
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/cpu.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/debug.h +0 -9
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/error_private.c +1 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/error_private.h +0 -10
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/fse.h +2 -17
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/fse_decompress.c +2 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/huf.h +0 -9
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/mem.h +7 -11
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/pool.h +0 -9
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/portability_macros.h +22 -9
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/threading.h +0 -8
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/xxhash.h +93 -19
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_deps.h +12 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_internal.h +1 -69
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_trace.h +5 -12
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/hist.c +10 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/hist.h +7 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress.c +1057 -367
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_internal.h +227 -125
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_literals.c +1 -1
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_sequences.c +7 -7
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_sequences.h +7 -6
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_superblock.c +17 -17
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_cwksp.h +41 -24
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_double_fast.c +58 -50
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_double_fast.h +4 -12
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_fast.c +91 -74
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_fast.h +4 -12
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_lazy.c +64 -64
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_lazy.h +30 -39
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_ldm.c +48 -33
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_ldm.h +6 -14
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_opt.c +55 -51
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_opt.h +8 -16
- data/ext/zstdlib_c/zstd-1.5.7/lib/compress/zstd_preSplit.c +238 -0
- data/ext/zstdlib_c/zstd-1.5.7/lib/compress/zstd_preSplit.h +33 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstdmt_compress.c +134 -93
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstdmt_compress.h +4 -15
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/huf_decompress_amd64.S +10 -3
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress.c +14 -11
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress_block.c +6 -12
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress_internal.h +5 -5
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/zdict.h +15 -8
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/zstd.h +241 -132
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/zstd_errors.h +1 -8
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzwrite.c +2 -1
- data/lib/2.4/zstdlib_c.so +0 -0
- data/lib/2.5/zstdlib_c.so +0 -0
- data/lib/2.6/zstdlib_c.so +0 -0
- data/lib/2.7/zstdlib_c.so +0 -0
- data/lib/3.0/zstdlib_c.so +0 -0
- data/lib/3.1/zstdlib_c.so +0 -0
- data/lib/3.2/zstdlib_c.so +0 -0
- data/lib/3.3/zstdlib_c.so +0 -0
- data/lib/3.4/zstdlib_c.so +0 -0
- metadata +75 -73
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/allocations.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/debug.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/entropy_common.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/pool.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/threading.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/xxhash.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_common.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/clevels.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/fse_compress.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/huf_compress.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_literals.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_superblock.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_ldm_geartab.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/huf_decompress.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_ddict.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_ddict.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress_block.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzclose.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzcompatibility.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzguts.h +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzlib.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzread.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/zstd_zlibwrapper.c +0 -0
- data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/zstd_zlibwrapper.h +5 -5
@@ -11,11 +11,6 @@
|
|
11
11
|
* in the COPYING file in the root directory of this source tree).
|
12
12
|
* You may select, at your option, one of the above-listed licenses.
|
13
13
|
****************************************************************** */
|
14
|
-
|
15
|
-
#if defined (__cplusplus)
|
16
|
-
extern "C" {
|
17
|
-
#endif
|
18
|
-
|
19
14
|
#ifndef FSE_H
|
20
15
|
#define FSE_H
|
21
16
|
|
@@ -25,7 +20,6 @@ extern "C" {
|
|
25
20
|
******************************************/
|
26
21
|
#include "zstd_deps.h" /* size_t, ptrdiff_t */
|
27
22
|
|
28
|
-
|
29
23
|
/*-*****************************************
|
30
24
|
* FSE_PUBLIC_API : control library symbols visibility
|
31
25
|
******************************************/
|
@@ -232,11 +226,8 @@ If there is an error, the function will return an error code, which can be teste
|
|
232
226
|
|
233
227
|
#if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY)
|
234
228
|
#define FSE_H_FSE_STATIC_LINKING_ONLY
|
235
|
-
|
236
|
-
/* *** Dependency *** */
|
237
229
|
#include "bitstream.h"
|
238
230
|
|
239
|
-
|
240
231
|
/* *****************************************
|
241
232
|
* Static allocation
|
242
233
|
*******************************************/
|
@@ -465,13 +456,13 @@ MEM_STATIC void FSE_encodeSymbol(BIT_CStream_t* bitC, FSE_CState_t* statePtr, un
|
|
465
456
|
FSE_symbolCompressionTransform const symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol];
|
466
457
|
const U16* const stateTable = (const U16*)(statePtr->stateTable);
|
467
458
|
U32 const nbBitsOut = (U32)((statePtr->value + symbolTT.deltaNbBits) >> 16);
|
468
|
-
BIT_addBits(bitC,
|
459
|
+
BIT_addBits(bitC, (BitContainerType)statePtr->value, nbBitsOut);
|
469
460
|
statePtr->value = stateTable[ (statePtr->value >> nbBitsOut) + symbolTT.deltaFindState];
|
470
461
|
}
|
471
462
|
|
472
463
|
MEM_STATIC void FSE_flushCState(BIT_CStream_t* bitC, const FSE_CState_t* statePtr)
|
473
464
|
{
|
474
|
-
BIT_addBits(bitC, (
|
465
|
+
BIT_addBits(bitC, (BitContainerType)statePtr->value, statePtr->stateLog);
|
475
466
|
BIT_flushBits(bitC);
|
476
467
|
}
|
477
468
|
|
@@ -631,10 +622,4 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr)
|
|
631
622
|
|
632
623
|
#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
|
633
624
|
|
634
|
-
|
635
625
|
#endif /* FSE_STATIC_LINKING_ONLY */
|
636
|
-
|
637
|
-
|
638
|
-
#if defined (__cplusplus)
|
639
|
-
}
|
640
|
-
#endif
|
@@ -190,6 +190,8 @@ FORCE_INLINE_TEMPLATE size_t FSE_decompress_usingDTable_generic(
|
|
190
190
|
FSE_initDState(&state1, &bitD, dt);
|
191
191
|
FSE_initDState(&state2, &bitD, dt);
|
192
192
|
|
193
|
+
RETURN_ERROR_IF(BIT_reloadDStream(&bitD)==BIT_DStream_overflow, corruption_detected, "");
|
194
|
+
|
193
195
|
#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
|
194
196
|
|
195
197
|
/* 4 symbols per loop */
|
@@ -12,10 +12,6 @@
|
|
12
12
|
* You may select, at your option, one of the above-listed licenses.
|
13
13
|
****************************************************************** */
|
14
14
|
|
15
|
-
#if defined (__cplusplus)
|
16
|
-
extern "C" {
|
17
|
-
#endif
|
18
|
-
|
19
15
|
#ifndef HUF_H_298734234
|
20
16
|
#define HUF_H_298734234
|
21
17
|
|
@@ -25,7 +21,6 @@ extern "C" {
|
|
25
21
|
#define FSE_STATIC_LINKING_ONLY
|
26
22
|
#include "fse.h"
|
27
23
|
|
28
|
-
|
29
24
|
/* *** Tool functions *** */
|
30
25
|
#define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */
|
31
26
|
size_t HUF_compressBound(size_t size); /**< maximum compressed size (worst case) */
|
@@ -280,7 +275,3 @@ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, const void* src, size_t srcSize
|
|
280
275
|
#endif
|
281
276
|
|
282
277
|
#endif /* HUF_H_298734234 */
|
283
|
-
|
284
|
-
#if defined (__cplusplus)
|
285
|
-
}
|
286
|
-
#endif
|
@@ -11,10 +11,6 @@
|
|
11
11
|
#ifndef MEM_H_MODULE
|
12
12
|
#define MEM_H_MODULE
|
13
13
|
|
14
|
-
#if defined (__cplusplus)
|
15
|
-
extern "C" {
|
16
|
-
#endif
|
17
|
-
|
18
14
|
/*-****************************************
|
19
15
|
* Dependencies
|
20
16
|
******************************************/
|
@@ -30,6 +26,8 @@ extern "C" {
|
|
30
26
|
#if defined(_MSC_VER) /* Visual Studio */
|
31
27
|
# include <stdlib.h> /* _byteswap_ulong */
|
32
28
|
# include <intrin.h> /* _byteswap_* */
|
29
|
+
#elif defined(__ICCARM__)
|
30
|
+
# include <intrinsics.h>
|
33
31
|
#endif
|
34
32
|
|
35
33
|
/*-**************************************************************
|
@@ -74,7 +72,6 @@ extern "C" {
|
|
74
72
|
typedef signed long long S64;
|
75
73
|
#endif
|
76
74
|
|
77
|
-
|
78
75
|
/*-**************************************************************
|
79
76
|
* Memory I/O API
|
80
77
|
*****************************************************************/
|
@@ -150,10 +147,12 @@ MEM_STATIC unsigned MEM_isLittleEndian(void)
|
|
150
147
|
return 1;
|
151
148
|
#elif defined(__clang__) && __BIG_ENDIAN__
|
152
149
|
return 0;
|
153
|
-
#elif defined(_MSC_VER) && (
|
150
|
+
#elif defined(_MSC_VER) && (_M_X64 || _M_IX86)
|
154
151
|
return 1;
|
155
152
|
#elif defined(__DMC__) && defined(_M_IX86)
|
156
153
|
return 1;
|
154
|
+
#elif defined(__IAR_SYSTEMS_ICC__) && __LITTLE_ENDIAN__
|
155
|
+
return 1;
|
157
156
|
#else
|
158
157
|
const union { U32 u; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */
|
159
158
|
return one.c[0];
|
@@ -246,6 +245,8 @@ MEM_STATIC U32 MEM_swap32(U32 in)
|
|
246
245
|
#elif (defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403)) \
|
247
246
|
|| (defined(__clang__) && __has_builtin(__builtin_bswap32))
|
248
247
|
return __builtin_bswap32(in);
|
248
|
+
#elif defined(__ICCARM__)
|
249
|
+
return __REV(in);
|
249
250
|
#else
|
250
251
|
return MEM_swap32_fallback(in);
|
251
252
|
#endif
|
@@ -418,9 +419,4 @@ MEM_STATIC void MEM_writeBEST(void* memPtr, size_t val)
|
|
418
419
|
/* code only tested on 32 and 64 bits systems */
|
419
420
|
MEM_STATIC void MEM_check(void) { DEBUG_STATIC_ASSERT((sizeof(size_t)==4) || (sizeof(size_t)==8)); }
|
420
421
|
|
421
|
-
|
422
|
-
#if defined (__cplusplus)
|
423
|
-
}
|
424
|
-
#endif
|
425
|
-
|
426
422
|
#endif /* MEM_H_MODULE */
|
@@ -11,10 +11,6 @@
|
|
11
11
|
#ifndef POOL_H
|
12
12
|
#define POOL_H
|
13
13
|
|
14
|
-
#if defined (__cplusplus)
|
15
|
-
extern "C" {
|
16
|
-
#endif
|
17
|
-
|
18
14
|
|
19
15
|
#include "zstd_deps.h"
|
20
16
|
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_customMem */
|
@@ -82,9 +78,4 @@ void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque);
|
|
82
78
|
*/
|
83
79
|
int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque);
|
84
80
|
|
85
|
-
|
86
|
-
#if defined (__cplusplus)
|
87
|
-
}
|
88
|
-
#endif
|
89
|
-
|
90
81
|
#endif
|
@@ -74,26 +74,39 @@
|
|
74
74
|
# define ZSTD_HIDE_ASM_FUNCTION(func)
|
75
75
|
#endif
|
76
76
|
|
77
|
+
/* Compile time determination of BMI2 support */
|
78
|
+
#ifndef STATIC_BMI2
|
79
|
+
# if defined(__BMI2__)
|
80
|
+
# define STATIC_BMI2 1
|
81
|
+
# elif defined(_MSC_VER) && defined(__AVX2__)
|
82
|
+
# define STATIC_BMI2 1 /* MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2 */
|
83
|
+
# endif
|
84
|
+
#endif
|
85
|
+
|
86
|
+
#ifndef STATIC_BMI2
|
87
|
+
# define STATIC_BMI2 0
|
88
|
+
#endif
|
89
|
+
|
77
90
|
/* Enable runtime BMI2 dispatch based on the CPU.
|
78
91
|
* Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default.
|
79
92
|
*/
|
80
93
|
#ifndef DYNAMIC_BMI2
|
81
|
-
|
94
|
+
# if ((defined(__clang__) && __has_attribute(__target__)) \
|
82
95
|
|| (defined(__GNUC__) \
|
83
96
|
&& (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \
|
84
|
-
&& (defined(__x86_64__) || defined(_M_X64)) \
|
97
|
+
&& (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)) \
|
85
98
|
&& !defined(__BMI2__)
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
99
|
+
# define DYNAMIC_BMI2 1
|
100
|
+
# else
|
101
|
+
# define DYNAMIC_BMI2 0
|
102
|
+
# endif
|
90
103
|
#endif
|
91
104
|
|
92
105
|
/**
|
93
|
-
* Only enable assembly for
|
106
|
+
* Only enable assembly for GNU C compatible compilers,
|
94
107
|
* because other platforms may not support GAS assembly syntax.
|
95
108
|
*
|
96
|
-
* Only enable assembly for Linux / MacOS, other platforms may
|
109
|
+
* Only enable assembly for Linux / MacOS / Win32, other platforms may
|
97
110
|
* work, but they haven't been tested. This could likely be
|
98
111
|
* extended to BSD systems.
|
99
112
|
*
|
@@ -101,7 +114,7 @@
|
|
101
114
|
* 100% of code to be instrumented to work.
|
102
115
|
*/
|
103
116
|
#if defined(__GNUC__)
|
104
|
-
# if defined(__linux__) || defined(__linux) || defined(__APPLE__)
|
117
|
+
# if defined(__linux__) || defined(__linux) || defined(__APPLE__) || defined(_WIN32)
|
105
118
|
# if ZSTD_MEMORY_SANITIZER
|
106
119
|
# define ZSTD_ASM_SUPPORTED 0
|
107
120
|
# elif ZSTD_DATAFLOW_SANITIZER
|
@@ -16,10 +16,6 @@
|
|
16
16
|
|
17
17
|
#include "debug.h"
|
18
18
|
|
19
|
-
#if defined (__cplusplus)
|
20
|
-
extern "C" {
|
21
|
-
#endif
|
22
|
-
|
23
19
|
#if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
|
24
20
|
|
25
21
|
/**
|
@@ -72,7 +68,6 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread);
|
|
72
68
|
* add here more wrappers as required
|
73
69
|
*/
|
74
70
|
|
75
|
-
|
76
71
|
#elif defined(ZSTD_MULTITHREAD) /* posix assumed ; need a better detection method */
|
77
72
|
/* === POSIX Systems === */
|
78
73
|
# include <pthread.h>
|
@@ -143,8 +138,5 @@ typedef int ZSTD_pthread_cond_t;
|
|
143
138
|
|
144
139
|
#endif /* ZSTD_MULTITHREAD */
|
145
140
|
|
146
|
-
#if defined (__cplusplus)
|
147
|
-
}
|
148
|
-
#endif
|
149
141
|
|
150
142
|
#endif /* THREADING_H_938743 */
|
@@ -227,10 +227,6 @@
|
|
227
227
|
* xxHash prototypes and implementation
|
228
228
|
*/
|
229
229
|
|
230
|
-
#if defined (__cplusplus)
|
231
|
-
extern "C" {
|
232
|
-
#endif
|
233
|
-
|
234
230
|
/* ****************************
|
235
231
|
* INLINE mode
|
236
232
|
******************************/
|
@@ -537,6 +533,9 @@ extern "C" {
|
|
537
533
|
/*! @brief Version number, encoded as two digits each */
|
538
534
|
#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE)
|
539
535
|
|
536
|
+
#if defined (__cplusplus)
|
537
|
+
extern "C" {
|
538
|
+
#endif
|
540
539
|
/*!
|
541
540
|
* @brief Obtains the xxHash version.
|
542
541
|
*
|
@@ -547,6 +546,9 @@ extern "C" {
|
|
547
546
|
*/
|
548
547
|
XXH_PUBLIC_API XXH_CONSTF unsigned XXH_versionNumber (void);
|
549
548
|
|
549
|
+
#if defined (__cplusplus)
|
550
|
+
}
|
551
|
+
#endif
|
550
552
|
|
551
553
|
/* ****************************
|
552
554
|
* Common basic types
|
@@ -593,6 +595,10 @@ typedef uint32_t XXH32_hash_t;
|
|
593
595
|
# endif
|
594
596
|
#endif
|
595
597
|
|
598
|
+
#if defined (__cplusplus)
|
599
|
+
extern "C" {
|
600
|
+
#endif
|
601
|
+
|
596
602
|
/*!
|
597
603
|
* @}
|
598
604
|
*
|
@@ -821,6 +827,9 @@ XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canoni
|
|
821
827
|
#endif
|
822
828
|
/*! @endcond */
|
823
829
|
|
830
|
+
#if defined (__cplusplus)
|
831
|
+
} /* end of extern "C" */
|
832
|
+
#endif
|
824
833
|
|
825
834
|
/*!
|
826
835
|
* @}
|
@@ -859,6 +868,9 @@ typedef uint64_t XXH64_hash_t;
|
|
859
868
|
# endif
|
860
869
|
#endif
|
861
870
|
|
871
|
+
#if defined (__cplusplus)
|
872
|
+
extern "C" {
|
873
|
+
#endif
|
862
874
|
/*!
|
863
875
|
* @}
|
864
876
|
*
|
@@ -1562,6 +1574,11 @@ XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH128_hashFromCanonical(XXH_NOESCAPE con
|
|
1562
1574
|
|
1563
1575
|
|
1564
1576
|
#endif /* !XXH_NO_XXH3 */
|
1577
|
+
|
1578
|
+
#if defined (__cplusplus)
|
1579
|
+
} /* extern "C" */
|
1580
|
+
#endif
|
1581
|
+
|
1565
1582
|
#endif /* XXH_NO_LONG_LONG */
|
1566
1583
|
|
1567
1584
|
/*!
|
@@ -1748,6 +1765,10 @@ struct XXH3_state_s {
|
|
1748
1765
|
} while(0)
|
1749
1766
|
|
1750
1767
|
|
1768
|
+
#if defined (__cplusplus)
|
1769
|
+
extern "C" {
|
1770
|
+
#endif
|
1771
|
+
|
1751
1772
|
/*!
|
1752
1773
|
* @brief Calculates the 128-bit hash of @p data using XXH3.
|
1753
1774
|
*
|
@@ -1963,8 +1984,13 @@ XXH3_128bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr,
|
|
1963
1984
|
XXH64_hash_t seed64);
|
1964
1985
|
#endif /* !XXH_NO_STREAM */
|
1965
1986
|
|
1987
|
+
#if defined (__cplusplus)
|
1988
|
+
} /* extern "C" */
|
1989
|
+
#endif
|
1990
|
+
|
1966
1991
|
#endif /* !XXH_NO_XXH3 */
|
1967
1992
|
#endif /* XXH_NO_LONG_LONG */
|
1993
|
+
|
1968
1994
|
#if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)
|
1969
1995
|
# define XXH_IMPLEMENTATION
|
1970
1996
|
#endif
|
@@ -2263,10 +2289,12 @@ XXH3_128bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr,
|
|
2263
2289
|
* @{
|
2264
2290
|
*/
|
2265
2291
|
|
2266
|
-
|
2267
2292
|
/* *************************************
|
2268
2293
|
* Includes & Memory related functions
|
2269
2294
|
***************************************/
|
2295
|
+
#include <string.h> /* memcmp, memcpy */
|
2296
|
+
#include <limits.h> /* ULLONG_MAX */
|
2297
|
+
|
2270
2298
|
#if defined(XXH_NO_STREAM)
|
2271
2299
|
/* nothing */
|
2272
2300
|
#elif defined(XXH_NO_STDLIB)
|
@@ -2280,9 +2308,17 @@ XXH3_128bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr,
|
|
2280
2308
|
* without access to dynamic allocation.
|
2281
2309
|
*/
|
2282
2310
|
|
2311
|
+
#if defined (__cplusplus)
|
2312
|
+
extern "C" {
|
2313
|
+
#endif
|
2314
|
+
|
2283
2315
|
static XXH_CONSTF void* XXH_malloc(size_t s) { (void)s; return NULL; }
|
2284
2316
|
static void XXH_free(void* p) { (void)p; }
|
2285
2317
|
|
2318
|
+
#if defined (__cplusplus)
|
2319
|
+
} /* extern "C" */
|
2320
|
+
#endif
|
2321
|
+
|
2286
2322
|
#else
|
2287
2323
|
|
2288
2324
|
/*
|
@@ -2291,6 +2327,9 @@ static void XXH_free(void* p) { (void)p; }
|
|
2291
2327
|
*/
|
2292
2328
|
#include <stdlib.h>
|
2293
2329
|
|
2330
|
+
#if defined (__cplusplus)
|
2331
|
+
extern "C" {
|
2332
|
+
#endif
|
2294
2333
|
/*!
|
2295
2334
|
* @internal
|
2296
2335
|
* @brief Modify this function to use a different routine than malloc().
|
@@ -2303,10 +2342,15 @@ static XXH_MALLOCF void* XXH_malloc(size_t s) { return malloc(s); }
|
|
2303
2342
|
*/
|
2304
2343
|
static void XXH_free(void* p) { free(p); }
|
2305
2344
|
|
2306
|
-
#
|
2345
|
+
#if defined (__cplusplus)
|
2346
|
+
} /* extern "C" */
|
2347
|
+
#endif
|
2307
2348
|
|
2308
|
-
#
|
2349
|
+
#endif /* XXH_NO_STDLIB */
|
2309
2350
|
|
2351
|
+
#if defined (__cplusplus)
|
2352
|
+
extern "C" {
|
2353
|
+
#endif
|
2310
2354
|
/*!
|
2311
2355
|
* @internal
|
2312
2356
|
* @brief Modify this function to use a different routine than memcpy().
|
@@ -2316,8 +2360,9 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size)
|
|
2316
2360
|
return memcpy(dest,src,size);
|
2317
2361
|
}
|
2318
2362
|
|
2319
|
-
#
|
2320
|
-
|
2363
|
+
#if defined (__cplusplus)
|
2364
|
+
} /* extern "C" */
|
2365
|
+
#endif
|
2321
2366
|
|
2322
2367
|
/* *************************************
|
2323
2368
|
* Compiler Specific Options
|
@@ -2452,6 +2497,10 @@ typedef XXH32_hash_t xxh_u32;
|
|
2452
2497
|
# define U32 xxh_u32
|
2453
2498
|
#endif
|
2454
2499
|
|
2500
|
+
#if defined (__cplusplus)
|
2501
|
+
extern "C" {
|
2502
|
+
#endif
|
2503
|
+
|
2455
2504
|
/* *** Memory access *** */
|
2456
2505
|
|
2457
2506
|
/*!
|
@@ -3608,6 +3657,10 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(XXH_NOESCAPE const XXH64_can
|
|
3608
3657
|
return XXH_readBE64(src);
|
3609
3658
|
}
|
3610
3659
|
|
3660
|
+
#if defined (__cplusplus)
|
3661
|
+
}
|
3662
|
+
#endif
|
3663
|
+
|
3611
3664
|
#ifndef XXH_NO_XXH3
|
3612
3665
|
|
3613
3666
|
/* *********************************************************************
|
@@ -3839,7 +3892,7 @@ enum XXH_VECTOR_TYPE /* fake enum */ {
|
|
3839
3892
|
# define XXH_VECTOR XXH_AVX512
|
3840
3893
|
# elif defined(__AVX2__)
|
3841
3894
|
# define XXH_VECTOR XXH_AVX2
|
3842
|
-
# elif defined(__SSE2__) || defined(
|
3895
|
+
# elif defined(__SSE2__) || defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP == 2))
|
3843
3896
|
# define XXH_VECTOR XXH_SSE2
|
3844
3897
|
# elif (defined(__PPC64__) && defined(__POWER8_VECTOR__)) \
|
3845
3898
|
|| (defined(__s390x__) && defined(__VEC__)) \
|
@@ -3928,6 +3981,10 @@ enum XXH_VECTOR_TYPE /* fake enum */ {
|
|
3928
3981
|
# pragma GCC optimize("-O2")
|
3929
3982
|
#endif
|
3930
3983
|
|
3984
|
+
#if defined (__cplusplus)
|
3985
|
+
extern "C" {
|
3986
|
+
#endif
|
3987
|
+
|
3931
3988
|
#if XXH_VECTOR == XXH_NEON
|
3932
3989
|
|
3933
3990
|
/*
|
@@ -4050,6 +4107,10 @@ XXH_vmlal_high_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs)
|
|
4050
4107
|
# endif
|
4051
4108
|
#endif /* XXH_VECTOR == XXH_NEON */
|
4052
4109
|
|
4110
|
+
#if defined (__cplusplus)
|
4111
|
+
} /* extern "C" */
|
4112
|
+
#endif
|
4113
|
+
|
4053
4114
|
/*
|
4054
4115
|
* VSX and Z Vector helpers.
|
4055
4116
|
*
|
@@ -4111,6 +4172,9 @@ typedef xxh_u64x2 xxh_aliasing_u64x2 XXH_ALIASING;
|
|
4111
4172
|
# if defined(__POWER9_VECTOR__) || (defined(__clang__) && defined(__s390x__))
|
4112
4173
|
# define XXH_vec_revb vec_revb
|
4113
4174
|
# else
|
4175
|
+
#if defined (__cplusplus)
|
4176
|
+
extern "C" {
|
4177
|
+
#endif
|
4114
4178
|
/*!
|
4115
4179
|
* A polyfill for POWER9's vec_revb().
|
4116
4180
|
*/
|
@@ -4120,9 +4184,15 @@ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_revb(xxh_u64x2 val)
|
|
4120
4184
|
0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 };
|
4121
4185
|
return vec_perm(val, val, vByteSwap);
|
4122
4186
|
}
|
4187
|
+
#if defined (__cplusplus)
|
4188
|
+
} /* extern "C" */
|
4189
|
+
#endif
|
4123
4190
|
# endif
|
4124
4191
|
# endif /* XXH_VSX_BE */
|
4125
4192
|
|
4193
|
+
#if defined (__cplusplus)
|
4194
|
+
extern "C" {
|
4195
|
+
#endif
|
4126
4196
|
/*!
|
4127
4197
|
* Performs an unaligned vector load and byte swaps it on big endian.
|
4128
4198
|
*/
|
@@ -4167,6 +4237,11 @@ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mule(xxh_u32x4 a, xxh_u32x4 b)
|
|
4167
4237
|
return result;
|
4168
4238
|
}
|
4169
4239
|
# endif /* XXH_vec_mulo, XXH_vec_mule */
|
4240
|
+
|
4241
|
+
#if defined (__cplusplus)
|
4242
|
+
} /* extern "C" */
|
4243
|
+
#endif
|
4244
|
+
|
4170
4245
|
#endif /* XXH_VECTOR == XXH_VSX */
|
4171
4246
|
|
4172
4247
|
#if XXH_VECTOR == XXH_SVE
|
@@ -4200,7 +4275,9 @@ do { \
|
|
4200
4275
|
# endif
|
4201
4276
|
#endif /* XXH_NO_PREFETCH */
|
4202
4277
|
|
4203
|
-
|
4278
|
+
#if defined (__cplusplus)
|
4279
|
+
extern "C" {
|
4280
|
+
#endif
|
4204
4281
|
/* ==========================================
|
4205
4282
|
* XXH3 default settings
|
4206
4283
|
* ========================================== */
|
@@ -6877,8 +6954,6 @@ XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (XXH_NOESCAPE const XXH3_state_
|
|
6877
6954
|
#endif /* !XXH_NO_STREAM */
|
6878
6955
|
/* 128-bit utility functions */
|
6879
6956
|
|
6880
|
-
#include <string.h> /* memcmp, memcpy */
|
6881
|
-
|
6882
6957
|
/* return : 1 is equal, 0 if different */
|
6883
6958
|
/*! @ingroup XXH3_family */
|
6884
6959
|
XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2)
|
@@ -7005,16 +7080,15 @@ XXH3_generateSecret_fromSeed(XXH_NOESCAPE void* secretBuffer, XXH64_hash_t seed)
|
|
7005
7080
|
# pragma GCC pop_options
|
7006
7081
|
#endif
|
7007
7082
|
|
7008
|
-
#endif /* XXH_NO_LONG_LONG */
|
7009
7083
|
|
7084
|
+
#if defined (__cplusplus)
|
7085
|
+
} /* extern "C" */
|
7086
|
+
#endif
|
7087
|
+
|
7088
|
+
#endif /* XXH_NO_LONG_LONG */
|
7010
7089
|
#endif /* XXH_NO_XXH3 */
|
7011
7090
|
|
7012
7091
|
/*!
|
7013
7092
|
* @}
|
7014
7093
|
*/
|
7015
7094
|
#endif /* XXH_IMPLEMENTATION */
|
7016
|
-
|
7017
|
-
|
7018
|
-
#if defined (__cplusplus)
|
7019
|
-
} /* extern "C" */
|
7020
|
-
#endif
|
@@ -24,6 +24,18 @@
|
|
24
24
|
#ifndef ZSTD_DEPS_COMMON
|
25
25
|
#define ZSTD_DEPS_COMMON
|
26
26
|
|
27
|
+
/* Even though we use qsort_r only for the dictionary builder, the macro
|
28
|
+
* _GNU_SOURCE has to be declared *before* the inclusion of any standard
|
29
|
+
* header and the script 'combine.sh' combines the whole zstd source code
|
30
|
+
* in a single file.
|
31
|
+
*/
|
32
|
+
#if defined(__linux) || defined(__linux__) || defined(linux) || defined(__gnu_linux__) || \
|
33
|
+
defined(__CYGWIN__) || defined(__MSYS__)
|
34
|
+
#if !defined(_GNU_SOURCE) && !defined(__ANDROID__) /* NDK doesn't ship qsort_r(). */
|
35
|
+
#define _GNU_SOURCE
|
36
|
+
#endif
|
37
|
+
#endif
|
38
|
+
|
27
39
|
#include <limits.h>
|
28
40
|
#include <stddef.h>
|
29
41
|
#include <string.h>
|
@@ -39,10 +39,6 @@
|
|
39
39
|
# define ZSTD_TRACE 0
|
40
40
|
#endif
|
41
41
|
|
42
|
-
#if defined (__cplusplus)
|
43
|
-
extern "C" {
|
44
|
-
#endif
|
45
|
-
|
46
42
|
/* ---- static assert (debug) --- */
|
47
43
|
#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
|
48
44
|
#define ZSTD_isError ERR_isError /* for inlining */
|
@@ -95,7 +91,7 @@ typedef enum { bt_raw, bt_rle, bt_compressed, bt_reserved } blockType_e;
|
|
95
91
|
#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */) /* for a non-null block */
|
96
92
|
#define MIN_LITERALS_FOR_4_STREAMS 6
|
97
93
|
|
98
|
-
typedef enum { set_basic, set_rle, set_compressed, set_repeat }
|
94
|
+
typedef enum { set_basic, set_rle, set_compressed, set_repeat } SymbolEncodingType_e;
|
99
95
|
|
100
96
|
#define LONGNBSEQ 0x7F00
|
101
97
|
|
@@ -278,62 +274,6 @@ typedef enum {
|
|
278
274
|
/*-*******************************************
|
279
275
|
* Private declarations
|
280
276
|
*********************************************/
|
281
|
-
typedef struct seqDef_s {
|
282
|
-
U32 offBase; /* offBase == Offset + ZSTD_REP_NUM, or repcode 1,2,3 */
|
283
|
-
U16 litLength;
|
284
|
-
U16 mlBase; /* mlBase == matchLength - MINMATCH */
|
285
|
-
} seqDef;
|
286
|
-
|
287
|
-
/* Controls whether seqStore has a single "long" litLength or matchLength. See seqStore_t. */
|
288
|
-
typedef enum {
|
289
|
-
ZSTD_llt_none = 0, /* no longLengthType */
|
290
|
-
ZSTD_llt_literalLength = 1, /* represents a long literal */
|
291
|
-
ZSTD_llt_matchLength = 2 /* represents a long match */
|
292
|
-
} ZSTD_longLengthType_e;
|
293
|
-
|
294
|
-
typedef struct {
|
295
|
-
seqDef* sequencesStart;
|
296
|
-
seqDef* sequences; /* ptr to end of sequences */
|
297
|
-
BYTE* litStart;
|
298
|
-
BYTE* lit; /* ptr to end of literals */
|
299
|
-
BYTE* llCode;
|
300
|
-
BYTE* mlCode;
|
301
|
-
BYTE* ofCode;
|
302
|
-
size_t maxNbSeq;
|
303
|
-
size_t maxNbLit;
|
304
|
-
|
305
|
-
/* longLengthPos and longLengthType to allow us to represent either a single litLength or matchLength
|
306
|
-
* in the seqStore that has a value larger than U16 (if it exists). To do so, we increment
|
307
|
-
* the existing value of the litLength or matchLength by 0x10000.
|
308
|
-
*/
|
309
|
-
ZSTD_longLengthType_e longLengthType;
|
310
|
-
U32 longLengthPos; /* Index of the sequence to apply long length modification to */
|
311
|
-
} seqStore_t;
|
312
|
-
|
313
|
-
typedef struct {
|
314
|
-
U32 litLength;
|
315
|
-
U32 matchLength;
|
316
|
-
} ZSTD_sequenceLength;
|
317
|
-
|
318
|
-
/**
|
319
|
-
* Returns the ZSTD_sequenceLength for the given sequences. It handles the decoding of long sequences
|
320
|
-
* indicated by longLengthPos and longLengthType, and adds MINMATCH back to matchLength.
|
321
|
-
*/
|
322
|
-
MEM_STATIC ZSTD_sequenceLength ZSTD_getSequenceLength(seqStore_t const* seqStore, seqDef const* seq)
|
323
|
-
{
|
324
|
-
ZSTD_sequenceLength seqLen;
|
325
|
-
seqLen.litLength = seq->litLength;
|
326
|
-
seqLen.matchLength = seq->mlBase + MINMATCH;
|
327
|
-
if (seqStore->longLengthPos == (U32)(seq - seqStore->sequencesStart)) {
|
328
|
-
if (seqStore->longLengthType == ZSTD_llt_literalLength) {
|
329
|
-
seqLen.litLength += 0x10000;
|
330
|
-
}
|
331
|
-
if (seqStore->longLengthType == ZSTD_llt_matchLength) {
|
332
|
-
seqLen.matchLength += 0x10000;
|
333
|
-
}
|
334
|
-
}
|
335
|
-
return seqLen;
|
336
|
-
}
|
337
277
|
|
338
278
|
/**
|
339
279
|
* Contains the compressed frame size and an upper-bound for the decompressed frame size.
|
@@ -347,10 +287,6 @@ typedef struct {
|
|
347
287
|
unsigned long long decompressedBound;
|
348
288
|
} ZSTD_frameSizeInfo; /* decompress & legacy */
|
349
289
|
|
350
|
-
const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx); /* compress & dictBuilder */
|
351
|
-
int ZSTD_seqToCodes(const seqStore_t* seqStorePtr); /* compress, dictBuilder, decodeCorpus (shouldn't get its definition from here) */
|
352
|
-
|
353
|
-
|
354
290
|
/* ZSTD_invalidateRepCodes() :
|
355
291
|
* ensures next compression will not use repcodes from previous block.
|
356
292
|
* Note : only works with regular variant;
|
@@ -385,8 +321,4 @@ MEM_STATIC int ZSTD_cpuSupportsBmi2(void)
|
|
385
321
|
return ZSTD_cpuid_bmi1(cpuid) && ZSTD_cpuid_bmi2(cpuid);
|
386
322
|
}
|
387
323
|
|
388
|
-
#if defined (__cplusplus)
|
389
|
-
}
|
390
|
-
#endif
|
391
|
-
|
392
324
|
#endif /* ZSTD_CCOMMON_H_MODULE */
|