zstd-ruby 1.5.6.6 → 1.5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +38 -1
- data/ext/zstdruby/common.h +37 -11
- data/ext/zstdruby/libzstd/common/bits.h +92 -87
- data/ext/zstdruby/libzstd/common/bitstream.h +26 -29
- data/ext/zstdruby/libzstd/common/compiler.h +36 -22
- data/ext/zstdruby/libzstd/common/cpu.h +1 -1
- data/ext/zstdruby/libzstd/common/debug.h +0 -9
- data/ext/zstdruby/libzstd/common/error_private.c +1 -0
- data/ext/zstdruby/libzstd/common/error_private.h +0 -10
- data/ext/zstdruby/libzstd/common/fse.h +2 -17
- data/ext/zstdruby/libzstd/common/fse_decompress.c +2 -0
- data/ext/zstdruby/libzstd/common/huf.h +0 -9
- data/ext/zstdruby/libzstd/common/mem.h +7 -11
- data/ext/zstdruby/libzstd/common/pool.h +0 -9
- data/ext/zstdruby/libzstd/common/portability_macros.h +22 -9
- data/ext/zstdruby/libzstd/common/threading.h +0 -8
- data/ext/zstdruby/libzstd/common/xxhash.h +93 -19
- data/ext/zstdruby/libzstd/common/zstd_deps.h +12 -0
- data/ext/zstdruby/libzstd/common/zstd_internal.h +1 -69
- data/ext/zstdruby/libzstd/common/zstd_trace.h +5 -12
- data/ext/zstdruby/libzstd/compress/hist.c +10 -0
- data/ext/zstdruby/libzstd/compress/hist.h +7 -0
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +1057 -367
- data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +227 -125
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +7 -7
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +7 -6
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +17 -17
- data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +41 -24
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +58 -50
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +4 -12
- data/ext/zstdruby/libzstd/compress/zstd_fast.c +91 -74
- data/ext/zstdruby/libzstd/compress/zstd_fast.h +4 -12
- data/ext/zstdruby/libzstd/compress/zstd_lazy.c +64 -64
- data/ext/zstdruby/libzstd/compress/zstd_lazy.h +30 -39
- data/ext/zstdruby/libzstd/compress/zstd_ldm.c +48 -33
- data/ext/zstdruby/libzstd/compress/zstd_ldm.h +6 -14
- data/ext/zstdruby/libzstd/compress/zstd_opt.c +55 -51
- data/ext/zstdruby/libzstd/compress/zstd_opt.h +8 -16
- data/ext/zstdruby/libzstd/compress/zstd_preSplit.c +238 -0
- data/ext/zstdruby/libzstd/compress/zstd_preSplit.h +33 -0
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +134 -93
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +4 -15
- data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +10 -3
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +14 -11
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +6 -12
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +5 -5
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +60 -19
- data/ext/zstdruby/libzstd/dictBuilder/divsufsort.h +0 -10
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +2 -2
- data/ext/zstdruby/libzstd/zdict.h +15 -8
- data/ext/zstdruby/libzstd/zstd.h +241 -132
- data/ext/zstdruby/libzstd/zstd_errors.h +1 -8
- data/ext/zstdruby/main.c +4 -0
- data/ext/zstdruby/zstdruby.c +92 -0
- data/lib/zstd-ruby/stream_writer.rb +1 -1
- data/lib/zstd-ruby/version.rb +1 -1
- metadata +5 -3
@@ -27,7 +27,7 @@
|
|
27
27
|
# define INLINE_KEYWORD
|
28
28
|
#endif
|
29
29
|
|
30
|
-
#if defined(__GNUC__) || defined(
|
30
|
+
#if defined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__)
|
31
31
|
# define FORCE_INLINE_ATTR __attribute__((always_inline))
|
32
32
|
#elif defined(_MSC_VER)
|
33
33
|
# define FORCE_INLINE_ATTR __forceinline
|
@@ -54,7 +54,7 @@
|
|
54
54
|
#endif
|
55
55
|
|
56
56
|
/* UNUSED_ATTR tells the compiler it is okay if the function is unused. */
|
57
|
-
#if defined(__GNUC__)
|
57
|
+
#if defined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__)
|
58
58
|
# define UNUSED_ATTR __attribute__((unused))
|
59
59
|
#else
|
60
60
|
# define UNUSED_ATTR
|
@@ -95,6 +95,8 @@
|
|
95
95
|
#ifndef MEM_STATIC /* already defined in Linux Kernel mem.h */
|
96
96
|
#if defined(__GNUC__)
|
97
97
|
# define MEM_STATIC static __inline UNUSED_ATTR
|
98
|
+
#elif defined(__IAR_SYSTEMS_ICC__)
|
99
|
+
# define MEM_STATIC static inline UNUSED_ATTR
|
98
100
|
#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
99
101
|
# define MEM_STATIC static inline
|
100
102
|
#elif defined(_MSC_VER)
|
@@ -108,7 +110,7 @@
|
|
108
110
|
#ifdef _MSC_VER
|
109
111
|
# define FORCE_NOINLINE static __declspec(noinline)
|
110
112
|
#else
|
111
|
-
# if defined(__GNUC__) || defined(
|
113
|
+
# if defined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__)
|
112
114
|
# define FORCE_NOINLINE static __attribute__((__noinline__))
|
113
115
|
# else
|
114
116
|
# define FORCE_NOINLINE static
|
@@ -117,7 +119,7 @@
|
|
117
119
|
|
118
120
|
|
119
121
|
/* target attribute */
|
120
|
-
#if defined(__GNUC__) || defined(
|
122
|
+
#if defined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__)
|
121
123
|
# define TARGET_ATTRIBUTE(target) __attribute__((__target__(target)))
|
122
124
|
#else
|
123
125
|
# define TARGET_ATTRIBUTE(target)
|
@@ -205,30 +207,21 @@
|
|
205
207
|
# pragma warning(disable : 4324) /* disable: C4324: padded structure */
|
206
208
|
#endif
|
207
209
|
|
208
|
-
/*Like DYNAMIC_BMI2 but for compile time determination of BMI2 support*/
|
209
|
-
#ifndef STATIC_BMI2
|
210
|
-
# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86))
|
211
|
-
# ifdef __AVX2__ //MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2
|
212
|
-
# define STATIC_BMI2 1
|
213
|
-
# endif
|
214
|
-
# elif defined(__BMI2__) && defined(__x86_64__) && defined(__GNUC__)
|
215
|
-
# define STATIC_BMI2 1
|
216
|
-
# endif
|
217
|
-
#endif
|
218
|
-
|
219
|
-
#ifndef STATIC_BMI2
|
220
|
-
#define STATIC_BMI2 0
|
221
|
-
#endif
|
222
|
-
|
223
210
|
/* compile time determination of SIMD support */
|
224
211
|
#if !defined(ZSTD_NO_INTRINSICS)
|
225
|
-
# if defined(
|
212
|
+
# if defined(__AVX2__)
|
213
|
+
# define ZSTD_ARCH_X86_AVX2
|
214
|
+
# endif
|
215
|
+
# if defined(__SSE2__) || defined(_M_X64) || (defined (_M_IX86) && defined(_M_IX86_FP) && (_M_IX86_FP >= 2))
|
226
216
|
# define ZSTD_ARCH_X86_SSE2
|
227
217
|
# endif
|
228
218
|
# if defined(__ARM_NEON) || defined(_M_ARM64)
|
229
219
|
# define ZSTD_ARCH_ARM_NEON
|
230
220
|
# endif
|
231
221
|
#
|
222
|
+
# if defined(ZSTD_ARCH_X86_AVX2)
|
223
|
+
# include <immintrin.h>
|
224
|
+
# endif
|
232
225
|
# if defined(ZSTD_ARCH_X86_SSE2)
|
233
226
|
# include <emmintrin.h>
|
234
227
|
# elif defined(ZSTD_ARCH_ARM_NEON)
|
@@ -273,9 +266,15 @@
|
|
273
266
|
#endif
|
274
267
|
|
275
268
|
/*-**************************************************************
|
276
|
-
* Alignment
|
269
|
+
* Alignment
|
277
270
|
*****************************************************************/
|
278
271
|
|
272
|
+
/* @return 1 if @u is a 2^n value, 0 otherwise
|
273
|
+
* useful to check a value is valid for alignment restrictions */
|
274
|
+
MEM_STATIC int ZSTD_isPower2(size_t u) {
|
275
|
+
return (u & (u-1)) == 0;
|
276
|
+
}
|
277
|
+
|
279
278
|
/* this test was initially positioned in mem.h,
|
280
279
|
* but this file is removed (or replaced) for linux kernel
|
281
280
|
* so it's now hosted in compiler.h,
|
@@ -301,6 +300,21 @@
|
|
301
300
|
# endif
|
302
301
|
#endif /* ZSTD_ALIGNOF */
|
303
302
|
|
303
|
+
#ifndef ZSTD_ALIGNED
|
304
|
+
/* C90-compatible alignment macro (GCC/Clang). Adjust for other compilers if needed. */
|
305
|
+
# if defined(__GNUC__) || defined(__clang__)
|
306
|
+
# define ZSTD_ALIGNED(a) __attribute__((aligned(a)))
|
307
|
+
# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
|
308
|
+
# define ZSTD_ALIGNED(a) _Alignas(a)
|
309
|
+
#elif defined(_MSC_VER)
|
310
|
+
# define ZSTD_ALIGNED(n) __declspec(align(n))
|
311
|
+
# else
|
312
|
+
/* this compiler will require its own alignment instruction */
|
313
|
+
# define ZSTD_ALIGNED(...)
|
314
|
+
# endif
|
315
|
+
#endif /* ZSTD_ALIGNED */
|
316
|
+
|
317
|
+
|
304
318
|
/*-**************************************************************
|
305
319
|
* Sanitizer
|
306
320
|
*****************************************************************/
|
@@ -324,7 +338,7 @@
|
|
324
338
|
#endif
|
325
339
|
|
326
340
|
/**
|
327
|
-
* Helper function to perform a wrapped pointer difference without
|
341
|
+
* Helper function to perform a wrapped pointer difference without triggering
|
328
342
|
* UBSAN.
|
329
343
|
*
|
330
344
|
* @returns lhs - rhs with wrapping
|
@@ -35,7 +35,7 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
|
|
35
35
|
U32 f7b = 0;
|
36
36
|
U32 f7c = 0;
|
37
37
|
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
|
38
|
-
#if !defined(__clang__)
|
38
|
+
#if !defined(_M_X64) || !defined(__clang__) || __clang_major__ >= 16
|
39
39
|
int reg[4];
|
40
40
|
__cpuid((int*)reg, 0);
|
41
41
|
{
|
@@ -32,10 +32,6 @@
|
|
32
32
|
#ifndef DEBUG_H_12987983217
|
33
33
|
#define DEBUG_H_12987983217
|
34
34
|
|
35
|
-
#if defined (__cplusplus)
|
36
|
-
extern "C" {
|
37
|
-
#endif
|
38
|
-
|
39
35
|
|
40
36
|
/* static assert is triggered at compile time, leaving no runtime artefact.
|
41
37
|
* static assert only works with compile-time constants.
|
@@ -108,9 +104,4 @@ extern int g_debuglevel; /* the variable is only declared,
|
|
108
104
|
# define DEBUGLOG(l, ...) do { } while (0) /* disabled */
|
109
105
|
#endif
|
110
106
|
|
111
|
-
|
112
|
-
#if defined (__cplusplus)
|
113
|
-
}
|
114
|
-
#endif
|
115
|
-
|
116
107
|
#endif /* DEBUG_H_12987983217 */
|
@@ -40,6 +40,7 @@ const char* ERR_getErrorString(ERR_enum code)
|
|
40
40
|
case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported";
|
41
41
|
case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large";
|
42
42
|
case PREFIX(maxSymbolValue_tooSmall): return "Specified maxSymbolValue is too small";
|
43
|
+
case PREFIX(cannotProduce_uncompressedBlock): return "This mode cannot generate an uncompressed block";
|
43
44
|
case PREFIX(stabilityCondition_notRespected): return "pledged buffer stability condition is not respected";
|
44
45
|
case PREFIX(dictionary_corrupted): return "Dictionary is corrupted";
|
45
46
|
case PREFIX(dictionary_wrong): return "Dictionary mismatch";
|
@@ -13,11 +13,6 @@
|
|
13
13
|
#ifndef ERROR_H_MODULE
|
14
14
|
#define ERROR_H_MODULE
|
15
15
|
|
16
|
-
#if defined (__cplusplus)
|
17
|
-
extern "C" {
|
18
|
-
#endif
|
19
|
-
|
20
|
-
|
21
16
|
/* ****************************************
|
22
17
|
* Dependencies
|
23
18
|
******************************************/
|
@@ -26,7 +21,6 @@ extern "C" {
|
|
26
21
|
#include "debug.h"
|
27
22
|
#include "zstd_deps.h" /* size_t */
|
28
23
|
|
29
|
-
|
30
24
|
/* ****************************************
|
31
25
|
* Compiler-specific
|
32
26
|
******************************************/
|
@@ -161,8 +155,4 @@ void _force_has_format_string(const char *format, ...) {
|
|
161
155
|
} \
|
162
156
|
} while(0)
|
163
157
|
|
164
|
-
#if defined (__cplusplus)
|
165
|
-
}
|
166
|
-
#endif
|
167
|
-
|
168
158
|
#endif /* ERROR_H_MODULE */
|
@@ -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 */
|