multi_compress 0.6.1 → 0.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/CHANGELOG.md +41 -0
- data/GET_STARTED.md +4 -2
- data/README.md +1 -1
- data/THIRD_PARTY_NOTICES.md +2 -2
- data/ext/multi_compress/exports.darwin +1 -0
- data/ext/multi_compress/exports.map +4 -0
- data/ext/multi_compress/extconf.rb +20 -0
- data/ext/multi_compress/multi_compress.c +123 -73
- data/ext/multi_compress/vendor/.vendored +1 -1
- data/ext/multi_compress/vendor/zstd/lib/BUCK +10 -5
- data/ext/multi_compress/vendor/zstd/lib/README.md +25 -5
- data/ext/multi_compress/vendor/zstd/lib/common/allocations.h +6 -2
- data/ext/multi_compress/vendor/zstd/lib/common/bits.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/common/bitstream.h +3 -3
- data/ext/multi_compress/vendor/zstd/lib/common/bmi2.h +40 -0
- data/ext/multi_compress/vendor/zstd/lib/common/compiler.h +37 -11
- data/ext/multi_compress/vendor/zstd/lib/common/entropy_common.c +7 -6
- data/ext/multi_compress/vendor/zstd/lib/common/fse_decompress.c +4 -3
- data/ext/multi_compress/vendor/zstd/lib/common/pool.c +16 -19
- data/ext/multi_compress/vendor/zstd/lib/common/portability_macros.h +31 -0
- data/ext/multi_compress/vendor/zstd/lib/common/threading.c +16 -2
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_common.c +9 -0
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_internal.h +4 -2
- data/ext/multi_compress/vendor/zstd/lib/compress/hist.c +300 -3
- data/ext/multi_compress/vendor/zstd/lib/compress/hist.h +4 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/huf_compress.c +4 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress.c +775 -214
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_internal.h +35 -6
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_sequences.c +9 -5
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_superblock.c +14 -5
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_double_fast.c +2 -2
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_fast.c +2 -2
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_lazy.c +49 -5
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm.c +11 -11
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm.h +11 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_opt.c +16 -18
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_preSplit.c +3 -3
- data/ext/multi_compress/vendor/zstd/lib/compress/zstdmt_compress.c +64 -39
- data/ext/multi_compress/vendor/zstd/lib/compress/zstdmt_compress.h +30 -2
- data/ext/multi_compress/vendor/zstd/lib/decompress/huf_decompress.c +78 -64
- data/ext/multi_compress/vendor/zstd/lib/decompress/huf_decompress_amd64.S +182 -18
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_ddict.c +59 -27
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_ddict.h +11 -0
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress.c +194 -93
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_block.c +225 -85
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_internal.h +19 -2
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/cover.c +136 -91
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/divsufsort.c +77 -77
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/fastcover.c +48 -42
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/zdict.c +18 -14
- data/ext/multi_compress/vendor/zstd/lib/dll/example/build_package.bat +66 -20
- data/ext/multi_compress/vendor/zstd/lib/dll/example/fullbench-dll.vcxproj +10 -6
- data/ext/multi_compress/vendor/zstd/lib/install_oses.mk +17 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v01.c +10 -8
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v02.c +5 -364
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v03.c +4 -5
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v04.c +7 -3
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v05.c +8 -5
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v06.c +3 -3
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v07.c +1 -0
- data/ext/multi_compress/vendor/zstd/lib/libzstd.mk +8 -7
- data/ext/multi_compress/vendor/zstd/lib/libzstd.pc.in +1 -0
- data/ext/multi_compress/vendor/zstd/lib/module.modulemap +0 -21
- data/ext/multi_compress/vendor/zstd/lib/zstd.h +209 -112
- data/lib/multi_compress/reader/read_operations.rb +2 -0
- data/lib/multi_compress/version.rb +1 -1
- data/multi_compress.gemspec +2 -0
- data/mysql_udf/Makefile +12 -5
- data/mysql_udf/multi_compress_mysql.exports +6 -0
- data/postgres_extension/Makefile +2 -1
- data/postgres_extension/test/run_e2e.sh +28 -10
- metadata +6 -5
- data/ext/multi_compress/vendor/lz4/lib/Makefile +0 -244
- data/ext/multi_compress/vendor/lz4/lib/dll/example/Makefile +0 -63
- data/ext/multi_compress/vendor/zstd/lib/Makefile +0 -389
- data/ext/multi_compress/vendor/zstd/lib/dll/example/Makefile +0 -48
|
@@ -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__) || defined(__IAR_SYSTEMS_ICC__)
|
|
57
|
+
#if defined(__GNUC__) || defined(__clang__) || defined(__IAR_SYSTEMS_ICC__) /* clang-cl defines __clang__ but not __GNUC__ */
|
|
58
58
|
# define UNUSED_ATTR __attribute__((unused))
|
|
59
59
|
#else
|
|
60
60
|
# define UNUSED_ATTR
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
#elif defined(__IAR_SYSTEMS_ICC__)
|
|
99
99
|
# define MEM_STATIC static inline UNUSED_ATTR
|
|
100
100
|
#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
|
101
|
-
# define MEM_STATIC static inline
|
|
101
|
+
# define MEM_STATIC static inline UNUSED_ATTR
|
|
102
102
|
#elif defined(_MSC_VER)
|
|
103
|
-
# define MEM_STATIC static __inline
|
|
103
|
+
# define MEM_STATIC static __inline UNUSED_ATTR
|
|
104
104
|
#else
|
|
105
105
|
# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */
|
|
106
106
|
#endif
|
|
@@ -132,6 +132,10 @@
|
|
|
132
132
|
#define BMI2_TARGET_ATTRIBUTE TARGET_ATTRIBUTE("lzcnt,bmi,bmi2")
|
|
133
133
|
|
|
134
134
|
/* prefetch
|
|
135
|
+
* PREFETCH_L1(ptr) / PREFETCH_L2(ptr) take a `const void*`.
|
|
136
|
+
* `ptr` is only used as an address hint: it may point anywhere,
|
|
137
|
+
* including invalid or out-of-bounds memory, and is never accessed.
|
|
138
|
+
* Each variant below must therefore accept a `const void*` argument.
|
|
135
139
|
* can be disabled, by declaring NO_PREFETCH build macro */
|
|
136
140
|
#if defined(NO_PREFETCH)
|
|
137
141
|
# define PREFETCH_L1(ptr) do { (void)(ptr); } while (0) /* disabled */
|
|
@@ -145,8 +149,12 @@
|
|
|
145
149
|
# define PREFETCH_L1(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
|
|
146
150
|
# define PREFETCH_L2(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
|
|
147
151
|
# elif defined(__aarch64__)
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
/* The "Q" operand needs an lvalue, so cast to `const char*` before
|
|
153
|
+
* dereferencing: dereferencing a `const void*` is ill-formed in C
|
|
154
|
+
* (-Wvoid-ptr-dereference). The `prfm` instruction is only a hint and
|
|
155
|
+
* never faults, whatever the address. */
|
|
156
|
+
# define PREFETCH_L1(ptr) do { __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(const char*)(ptr))); } while (0)
|
|
157
|
+
# define PREFETCH_L2(ptr) do { __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(const char*)(ptr))); } while (0)
|
|
150
158
|
# else
|
|
151
159
|
# define PREFETCH_L1(ptr) do { (void)(ptr); } while (0) /* disabled */
|
|
152
160
|
# define PREFETCH_L2(ptr) do { (void)(ptr); } while (0) /* disabled */
|
|
@@ -218,6 +226,18 @@
|
|
|
218
226
|
# if defined(__ARM_NEON) || defined(_M_ARM64)
|
|
219
227
|
# define ZSTD_ARCH_ARM_NEON
|
|
220
228
|
# endif
|
|
229
|
+
# if defined(__ARM_FEATURE_SVE)
|
|
230
|
+
# define ZSTD_ARCH_ARM_SVE
|
|
231
|
+
# endif
|
|
232
|
+
# if defined(__ARM_FEATURE_SVE2)
|
|
233
|
+
# define ZSTD_ARCH_ARM_SVE2
|
|
234
|
+
# endif
|
|
235
|
+
# if defined(__riscv) && defined(__riscv_vector)
|
|
236
|
+
# if ((defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 14) || \
|
|
237
|
+
(defined(__clang__) && __clang_major__ >= 19))
|
|
238
|
+
#define ZSTD_ARCH_RISCV_RVV
|
|
239
|
+
# endif
|
|
240
|
+
#endif
|
|
221
241
|
#
|
|
222
242
|
# if defined(ZSTD_ARCH_X86_AVX2)
|
|
223
243
|
# include <immintrin.h>
|
|
@@ -227,6 +247,12 @@
|
|
|
227
247
|
# elif defined(ZSTD_ARCH_ARM_NEON)
|
|
228
248
|
# include <arm_neon.h>
|
|
229
249
|
# endif
|
|
250
|
+
# if defined(ZSTD_ARCH_ARM_SVE) || defined(ZSTD_ARCH_ARM_SVE2)
|
|
251
|
+
# include <arm_sve.h>
|
|
252
|
+
# endif
|
|
253
|
+
# if defined(ZSTD_ARCH_RISCV_RVV)
|
|
254
|
+
# include <riscv_vector.h>
|
|
255
|
+
# endif
|
|
230
256
|
#endif
|
|
231
257
|
|
|
232
258
|
/* C-language Attributes are added in C23. */
|
|
@@ -357,9 +383,9 @@ ptrdiff_t ZSTD_wrappedPtrDiff(unsigned char const* lhs, unsigned char const* rhs
|
|
|
357
383
|
*/
|
|
358
384
|
MEM_STATIC
|
|
359
385
|
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
|
|
360
|
-
|
|
386
|
+
const void* ZSTD_wrappedPtrAdd(const void* ptr, ptrdiff_t add)
|
|
361
387
|
{
|
|
362
|
-
return ptr + add;
|
|
388
|
+
return (const char*)ptr + add;
|
|
363
389
|
}
|
|
364
390
|
|
|
365
391
|
/**
|
|
@@ -370,9 +396,9 @@ unsigned char const* ZSTD_wrappedPtrAdd(unsigned char const* ptr, ptrdiff_t add)
|
|
|
370
396
|
*/
|
|
371
397
|
MEM_STATIC
|
|
372
398
|
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
|
|
373
|
-
|
|
399
|
+
const void* ZSTD_wrappedPtrSub(const void* ptr, ptrdiff_t sub)
|
|
374
400
|
{
|
|
375
|
-
return ptr - sub;
|
|
401
|
+
return (const char*)ptr - sub;
|
|
376
402
|
}
|
|
377
403
|
|
|
378
404
|
/**
|
|
@@ -382,9 +408,9 @@ unsigned char const* ZSTD_wrappedPtrSub(unsigned char const* ptr, ptrdiff_t sub)
|
|
|
382
408
|
* @returns `ptr + add` except it defines `NULL + 0 == NULL`.
|
|
383
409
|
*/
|
|
384
410
|
MEM_STATIC
|
|
385
|
-
|
|
411
|
+
void* ZSTD_maybeNullPtrAdd(void* ptr, ptrdiff_t add)
|
|
386
412
|
{
|
|
387
|
-
return add > 0 ? ptr + add : ptr;
|
|
413
|
+
return add > 0 ? (char*)ptr + add : ptr;
|
|
388
414
|
}
|
|
389
415
|
|
|
390
416
|
/* Issue #3240 reports an ASAN failure on an llvm-mingw build. Out of an
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
/* *************************************
|
|
16
16
|
* Dependencies
|
|
17
17
|
***************************************/
|
|
18
|
+
#include "bmi2.h"
|
|
18
19
|
#include "mem.h"
|
|
19
20
|
#include "error_private.h" /* ERR_*, ERROR */
|
|
20
21
|
#define FSE_STATIC_LINKING_ONLY /* FSE_MIN_TABLELOG */
|
|
@@ -201,17 +202,17 @@ BMI2_TARGET_ATTRIBUTE static size_t FSE_readNCount_body_bmi2(
|
|
|
201
202
|
{
|
|
202
203
|
return FSE_readNCount_body(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
|
|
203
204
|
}
|
|
205
|
+
#else
|
|
206
|
+
#define FSE_readNCount_body_bmi2 FSE_readNCount_body_default
|
|
204
207
|
#endif
|
|
205
208
|
|
|
206
209
|
size_t FSE_readNCount_bmi2(
|
|
207
210
|
short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
|
|
208
211
|
const void* headerBuffer, size_t hbSize, int bmi2)
|
|
209
212
|
{
|
|
210
|
-
|
|
211
|
-
if (bmi2) {
|
|
213
|
+
if (ZSTD_USE_BMI2(bmi2)) {
|
|
212
214
|
return FSE_readNCount_body_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
|
|
213
215
|
}
|
|
214
|
-
#endif
|
|
215
216
|
(void)bmi2;
|
|
216
217
|
return FSE_readNCount_body_default(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
|
|
217
218
|
}
|
|
@@ -322,6 +323,8 @@ static BMI2_TARGET_ATTRIBUTE size_t HUF_readStats_body_bmi2(BYTE* huffWeight, si
|
|
|
322
323
|
{
|
|
323
324
|
return HUF_readStats_body(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize, 1);
|
|
324
325
|
}
|
|
326
|
+
#else
|
|
327
|
+
#define HUF_readStats_body_bmi2 HUF_readStats_body_default
|
|
325
328
|
#endif
|
|
326
329
|
|
|
327
330
|
size_t HUF_readStats_wksp(BYTE* huffWeight, size_t hwSize, U32* rankStats,
|
|
@@ -330,11 +333,9 @@ size_t HUF_readStats_wksp(BYTE* huffWeight, size_t hwSize, U32* rankStats,
|
|
|
330
333
|
void* workSpace, size_t wkspSize,
|
|
331
334
|
int flags)
|
|
332
335
|
{
|
|
333
|
-
|
|
334
|
-
if (flags & HUF_flags_bmi2) {
|
|
336
|
+
if (ZSTD_USE_BMI2(flags & HUF_flags_bmi2)) {
|
|
335
337
|
return HUF_readStats_body_bmi2(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
|
|
336
338
|
}
|
|
337
|
-
#endif
|
|
338
339
|
(void)flags;
|
|
339
340
|
return HUF_readStats_body_default(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
|
|
340
341
|
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
****************************************************************/
|
|
19
19
|
#include "debug.h" /* assert */
|
|
20
20
|
#include "bitstream.h"
|
|
21
|
+
#include "bmi2.h"
|
|
21
22
|
#include "compiler.h"
|
|
22
23
|
#define FSE_STATIC_LINKING_ONLY
|
|
23
24
|
#include "fse.h"
|
|
@@ -299,15 +300,15 @@ BMI2_TARGET_ATTRIBUTE static size_t FSE_decompress_wksp_body_bmi2(void* dst, siz
|
|
|
299
300
|
{
|
|
300
301
|
return FSE_decompress_wksp_body(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, 1);
|
|
301
302
|
}
|
|
303
|
+
#else
|
|
304
|
+
#define FSE_decompress_wksp_body_bmi2 FSE_decompress_wksp_body_default
|
|
302
305
|
#endif
|
|
303
306
|
|
|
304
307
|
size_t FSE_decompress_wksp_bmi2(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize, int bmi2)
|
|
305
308
|
{
|
|
306
|
-
|
|
307
|
-
if (bmi2) {
|
|
309
|
+
if (ZSTD_USE_BMI2(bmi2)) {
|
|
308
310
|
return FSE_decompress_wksp_body_bmi2(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize);
|
|
309
311
|
}
|
|
310
|
-
#endif
|
|
311
312
|
(void)bmi2;
|
|
312
313
|
return FSE_decompress_wksp_body_default(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize);
|
|
313
314
|
}
|
|
@@ -142,19 +142,17 @@ POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize,
|
|
|
142
142
|
/* Allocate space for the thread handles */
|
|
143
143
|
ctx->threads = (ZSTD_pthread_t*)ZSTD_customCalloc(numThreads * sizeof(ZSTD_pthread_t), customMem);
|
|
144
144
|
ctx->threadCapacity = 0;
|
|
145
|
+
ctx->threadLimit = numThreads;
|
|
145
146
|
ctx->customMem = customMem;
|
|
146
147
|
/* Check for errors */
|
|
147
148
|
if (!ctx->threads || !ctx->queue) { POOL_free(ctx); return NULL; }
|
|
148
149
|
/* Initialize the threads */
|
|
149
|
-
{
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
} }
|
|
156
|
-
ctx->threadCapacity = numThreads;
|
|
157
|
-
ctx->threadLimit = numThreads;
|
|
150
|
+
while (ctx->threadCapacity < numThreads) {
|
|
151
|
+
if (ZSTD_pthread_create(&ctx->threads[ctx->threadCapacity++], NULL, &POOL_thread, ctx)) {
|
|
152
|
+
--ctx->threadCapacity;
|
|
153
|
+
POOL_free(ctx);
|
|
154
|
+
return NULL;
|
|
155
|
+
}
|
|
158
156
|
}
|
|
159
157
|
return ctx;
|
|
160
158
|
}
|
|
@@ -220,23 +218,22 @@ static int POOL_resize_internal(POOL_ctx* ctx, size_t numThreads)
|
|
|
220
218
|
return 0;
|
|
221
219
|
}
|
|
222
220
|
/* numThreads > threadCapacity */
|
|
221
|
+
ctx->threadLimit = numThreads;
|
|
223
222
|
{ ZSTD_pthread_t* const threadPool = (ZSTD_pthread_t*)ZSTD_customCalloc(numThreads * sizeof(ZSTD_pthread_t), ctx->customMem);
|
|
224
223
|
if (!threadPool) return 1;
|
|
225
|
-
/*
|
|
224
|
+
/* extend existing thread pool */
|
|
226
225
|
ZSTD_memcpy(threadPool, ctx->threads, ctx->threadCapacity * sizeof(ZSTD_pthread_t));
|
|
227
226
|
ZSTD_customFree(ctx->threads, ctx->customMem);
|
|
228
227
|
ctx->threads = threadPool;
|
|
229
228
|
/* Initialize additional threads */
|
|
230
|
-
{
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
229
|
+
while (ctx->threadCapacity < numThreads) {
|
|
230
|
+
if (ZSTD_pthread_create(&threadPool[ctx->threadCapacity++], NULL, &POOL_thread, ctx)) {
|
|
231
|
+
--ctx->threadCapacity;
|
|
232
|
+
return 1;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
237
236
|
/* successfully expanded */
|
|
238
|
-
ctx->threadCapacity = numThreads;
|
|
239
|
-
ctx->threadLimit = numThreads;
|
|
240
237
|
return 0;
|
|
241
238
|
}
|
|
242
239
|
|
|
@@ -102,6 +102,18 @@
|
|
|
102
102
|
# endif
|
|
103
103
|
#endif
|
|
104
104
|
|
|
105
|
+
/*
|
|
106
|
+
* The Linux kernel importer consumes the outer guard while preserving the
|
|
107
|
+
* distinction below. Normal x86 kernel objects can use the kernel CPU-feature
|
|
108
|
+
* policy, while preboot objects cannot use that infrastructure.
|
|
109
|
+
*/
|
|
110
|
+
#if defined(ZSTD_LINUX_KERNEL)
|
|
111
|
+
# if defined(__KERNEL__) && defined(CONFIG_X86) && \
|
|
112
|
+
!defined(__DISABLE_EXPORTS)
|
|
113
|
+
# define ZSTD_USE_KERNEL_CPU_FEATURES
|
|
114
|
+
# endif
|
|
115
|
+
#endif
|
|
116
|
+
|
|
105
117
|
/**
|
|
106
118
|
* Only enable assembly for GNU C compatible compilers,
|
|
107
119
|
* because other platforms may not support GAS assembly syntax.
|
|
@@ -168,4 +180,23 @@
|
|
|
168
180
|
# define ZSTD_CET_ENDBRANCH
|
|
169
181
|
#endif
|
|
170
182
|
|
|
183
|
+
/**
|
|
184
|
+
* ZSTD_IS_DETERMINISTIC_BUILD must be set to 0 if any compilation macro is
|
|
185
|
+
* active that impacts the compressed output.
|
|
186
|
+
*
|
|
187
|
+
* NOTE: ZSTD_MULTITHREAD is allowed to be set or unset.
|
|
188
|
+
*/
|
|
189
|
+
#if defined(ZSTD_CLEVEL_DEFAULT) \
|
|
190
|
+
|| defined(ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR) \
|
|
191
|
+
|| defined(ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR) \
|
|
192
|
+
|| defined(ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR) \
|
|
193
|
+
|| defined(ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR) \
|
|
194
|
+
|| defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \
|
|
195
|
+
|| defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \
|
|
196
|
+
|| defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR)
|
|
197
|
+
# define ZSTD_IS_DETERMINISTIC_BUILD 0
|
|
198
|
+
#else
|
|
199
|
+
# define ZSTD_IS_DETERMINISTIC_BUILD 1
|
|
200
|
+
#endif
|
|
201
|
+
|
|
171
202
|
#endif /* ZSTD_PORTABILITY_MACROS_H */
|
|
@@ -143,7 +143,14 @@ int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t con
|
|
|
143
143
|
*mutex = (pthread_mutex_t*)ZSTD_malloc(sizeof(pthread_mutex_t));
|
|
144
144
|
if (!*mutex)
|
|
145
145
|
return 1;
|
|
146
|
-
|
|
146
|
+
{
|
|
147
|
+
int const ret = pthread_mutex_init(*mutex, attr);
|
|
148
|
+
if (ret != 0) {
|
|
149
|
+
ZSTD_free(*mutex);
|
|
150
|
+
*mutex = NULL;
|
|
151
|
+
}
|
|
152
|
+
return ret;
|
|
153
|
+
}
|
|
147
154
|
}
|
|
148
155
|
|
|
149
156
|
int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex)
|
|
@@ -164,7 +171,14 @@ int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const*
|
|
|
164
171
|
*cond = (pthread_cond_t*)ZSTD_malloc(sizeof(pthread_cond_t));
|
|
165
172
|
if (!*cond)
|
|
166
173
|
return 1;
|
|
167
|
-
|
|
174
|
+
{
|
|
175
|
+
int const ret = pthread_cond_init(*cond, attr);
|
|
176
|
+
if (ret != 0) {
|
|
177
|
+
ZSTD_free(*cond);
|
|
178
|
+
*cond = NULL;
|
|
179
|
+
}
|
|
180
|
+
return ret;
|
|
181
|
+
}
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond)
|
|
@@ -46,3 +46,12 @@ ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); }
|
|
|
46
46
|
/*! ZSTD_getErrorString() :
|
|
47
47
|
* provides error code string from enum */
|
|
48
48
|
const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); }
|
|
49
|
+
|
|
50
|
+
int ZSTD_isDeterministicBuild(void)
|
|
51
|
+
{
|
|
52
|
+
#if ZSTD_IS_DETERMINISTIC_BUILD
|
|
53
|
+
return 1;
|
|
54
|
+
#else
|
|
55
|
+
return 0;
|
|
56
|
+
#endif
|
|
57
|
+
}
|
|
@@ -168,7 +168,7 @@ static UNUSED_ATTR const U32 OF_defaultNormLog = OF_DEFAULTNORMLOG;
|
|
|
168
168
|
* Shared functions to include for inlining
|
|
169
169
|
*********************************************/
|
|
170
170
|
static void ZSTD_copy8(void* dst, const void* src) {
|
|
171
|
-
#if defined(ZSTD_ARCH_ARM_NEON)
|
|
171
|
+
#if defined(ZSTD_ARCH_ARM_NEON) && !defined(__aarch64__)
|
|
172
172
|
vst1_u8((uint8_t*)dst, vld1_u8((const uint8_t*)src));
|
|
173
173
|
#else
|
|
174
174
|
ZSTD_memcpy(dst, src, 8);
|
|
@@ -185,6 +185,8 @@ static void ZSTD_copy16(void* dst, const void* src) {
|
|
|
185
185
|
vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src));
|
|
186
186
|
#elif defined(ZSTD_ARCH_X86_SSE2)
|
|
187
187
|
_mm_storeu_si128((__m128i*)dst, _mm_loadu_si128((const __m128i*)src));
|
|
188
|
+
#elif defined(ZSTD_ARCH_RISCV_RVV)
|
|
189
|
+
__riscv_vse8_v_u8m1((uint8_t*)dst, __riscv_vle8_v_u8m1((const uint8_t*)src, 16), 16);
|
|
188
190
|
#elif defined(__clang__)
|
|
189
191
|
ZSTD_memmove(dst, src, 16);
|
|
190
192
|
#else
|
|
@@ -213,7 +215,7 @@ typedef enum {
|
|
|
213
215
|
* The src buffer must be before the dst buffer.
|
|
214
216
|
*/
|
|
215
217
|
MEM_STATIC FORCE_INLINE_ATTR
|
|
216
|
-
void ZSTD_wildcopy(void* dst, const void* src,
|
|
218
|
+
void ZSTD_wildcopy(void* dst, const void* src, size_t length, ZSTD_overlap_e const ovtype)
|
|
217
219
|
{
|
|
218
220
|
ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
|
|
219
221
|
const BYTE* ip = (const BYTE*)src;
|