multi_compress 0.6.0 → 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 +51 -0
- data/GET_STARTED.md +5 -3
- data/README.md +2 -2
- data/THIRD_PARTY_NOTICES.md +3 -3
- 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 +352 -149
- data/ext/multi_compress/vendor/.vendored +2 -2
- data/ext/multi_compress/vendor/brotli/c/common/version.h +2 -2
- data/ext/multi_compress/vendor/brotli/c/dec/decode.c +59 -30
- data/ext/multi_compress/vendor/brotli/c/include/brotli/decode.h +1 -3
- 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/active_record.rb +11 -5
- data/lib/multi_compress/codec.rb +164 -94
- data/lib/multi_compress/database/api.rb +42 -0
- data/lib/multi_compress/database/decoding.rb +42 -0
- data/lib/multi_compress/database/dictionary.rb +72 -0
- data/lib/multi_compress/database/encoding.rb +31 -0
- data/lib/multi_compress/database/header.rb +71 -0
- data/lib/multi_compress/database/operations.rb +73 -0
- data/lib/multi_compress/database/validation.rb +95 -0
- data/lib/multi_compress/database.rb +10 -282
- data/lib/multi_compress/db_deployment/bundle_archiver.rb +70 -0
- data/lib/multi_compress/db_deployment/bundle_metadata.rb +56 -0
- data/lib/multi_compress/db_deployment/bundle_stager.rb +62 -0
- data/lib/multi_compress/db_deployment/commands.rb +309 -0
- data/lib/multi_compress/db_deployment/deployment_bundle.rb +80 -0
- data/lib/multi_compress/db_deployment/deterministic_tar_writer.rb +76 -0
- data/lib/multi_compress/db_deployment/dictionary_registry.rb +244 -0
- data/lib/multi_compress/db_deployment/readable_view.rb +112 -0
- data/lib/multi_compress/db_deployment/readable_view_options.rb +51 -0
- data/lib/multi_compress/db_deployment/sql_identifiers.rb +45 -0
- data/lib/multi_compress/db_deployment.rb +10 -844
- data/lib/multi_compress/reader/buffer_operations.rb +57 -0
- data/lib/multi_compress/reader/read_operations.rb +69 -0
- data/lib/multi_compress/reader.rb +97 -0
- data/lib/multi_compress/stream_io.rb +13 -0
- data/lib/multi_compress/version.rb +1 -1
- data/lib/multi_compress/writer.rb +85 -0
- data/lib/multi_compress.rb +42 -333
- 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 +30 -10
- 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
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
zstd=1.
|
|
1
|
+
zstd=1.6.0
|
|
2
2
|
lz4=1.10.0
|
|
3
|
-
brotli=1.2.
|
|
3
|
+
brotli=1.2.1
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
#define BROTLI_VERSION_MAJOR 1
|
|
21
21
|
#define BROTLI_VERSION_MINOR 2
|
|
22
|
-
#define BROTLI_VERSION_PATCH
|
|
22
|
+
#define BROTLI_VERSION_PATCH 1
|
|
23
23
|
|
|
24
24
|
#define BROTLI_VERSION BROTLI_MAKE_HEX_VERSION( \
|
|
25
25
|
BROTLI_VERSION_MAJOR, BROTLI_VERSION_MINOR, BROTLI_VERSION_PATCH)
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
#define BROTLI_ABI_CURRENT 3
|
|
36
|
-
#define BROTLI_ABI_REVISION
|
|
36
|
+
#define BROTLI_ABI_REVISION 1
|
|
37
37
|
#define BROTLI_ABI_AGE 2
|
|
38
38
|
|
|
39
39
|
#if BROTLI_VERSION_MAJOR != (BROTLI_ABI_CURRENT - BROTLI_ABI_AGE)
|
|
@@ -1176,7 +1176,7 @@ static BrotliDecoderErrorCode DecodeContextMap(brotli_reg_t context_map_size,
|
|
|
1176
1176
|
|
|
1177
1177
|
/* Decodes a command or literal and updates block type ring-buffer.
|
|
1178
1178
|
Reads 3..54 bits. */
|
|
1179
|
-
static BROTLI_INLINE
|
|
1179
|
+
static BROTLI_INLINE BrotliDecoderErrorCode DecodeBlockTypeAndLength(
|
|
1180
1180
|
int safe, BrotliDecoderState* s, int tree_type) {
|
|
1181
1181
|
brotli_reg_t max_block_type = s->num_block_types[tree_type];
|
|
1182
1182
|
const HuffmanCode* type_tree = &s->block_type_trees[
|
|
@@ -1187,7 +1187,7 @@ static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(
|
|
|
1187
1187
|
brotli_reg_t* ringbuffer = &s->block_type_rb[tree_type * 2];
|
|
1188
1188
|
brotli_reg_t block_type;
|
|
1189
1189
|
if (max_block_type <= 1) {
|
|
1190
|
-
return
|
|
1190
|
+
return BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH;
|
|
1191
1191
|
}
|
|
1192
1192
|
|
|
1193
1193
|
/* Read 0..15 + 3..39 bits. */
|
|
@@ -1197,11 +1197,13 @@ static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(
|
|
|
1197
1197
|
} else {
|
|
1198
1198
|
BrotliBitReaderState memento;
|
|
1199
1199
|
BrotliBitReaderSaveState(br, &memento);
|
|
1200
|
-
if (!SafeReadSymbol(type_tree, br, &block_type))
|
|
1200
|
+
if (!SafeReadSymbol(type_tree, br, &block_type)) {
|
|
1201
|
+
return BROTLI_DECODER_NEEDS_MORE_INPUT;
|
|
1202
|
+
}
|
|
1201
1203
|
if (!SafeReadBlockLength(s, &s->block_length[tree_type], len_tree, br)) {
|
|
1202
1204
|
s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE;
|
|
1203
1205
|
BrotliBitReaderRestoreState(br, &memento);
|
|
1204
|
-
return
|
|
1206
|
+
return BROTLI_DECODER_NEEDS_MORE_INPUT;
|
|
1205
1207
|
}
|
|
1206
1208
|
}
|
|
1207
1209
|
|
|
@@ -1217,7 +1219,7 @@ static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(
|
|
|
1217
1219
|
}
|
|
1218
1220
|
ringbuffer[0] = ringbuffer[1];
|
|
1219
1221
|
ringbuffer[1] = block_type;
|
|
1220
|
-
return
|
|
1222
|
+
return BROTLI_DECODER_SUCCESS;
|
|
1221
1223
|
}
|
|
1222
1224
|
|
|
1223
1225
|
static BROTLI_INLINE void DetectTrivialLiteralBlockTypes(
|
|
@@ -1254,62 +1256,68 @@ static BROTLI_INLINE void PrepareLiteralDecoding(BrotliDecoderState* s) {
|
|
|
1254
1256
|
|
|
1255
1257
|
/* Decodes the block type and updates the state for literal context.
|
|
1256
1258
|
Reads 3..54 bits. */
|
|
1257
|
-
static BROTLI_INLINE
|
|
1259
|
+
static BROTLI_INLINE BrotliDecoderErrorCode DecodeLiteralBlockSwitchInternal(
|
|
1258
1260
|
int safe, BrotliDecoderState* s) {
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
+
BrotliDecoderErrorCode result = DecodeBlockTypeAndLength(safe, s, 0);
|
|
1262
|
+
if (result != BROTLI_DECODER_SUCCESS) {
|
|
1263
|
+
return result;
|
|
1261
1264
|
}
|
|
1262
1265
|
PrepareLiteralDecoding(s);
|
|
1263
|
-
return
|
|
1266
|
+
return BROTLI_DECODER_SUCCESS;
|
|
1264
1267
|
}
|
|
1265
1268
|
|
|
1266
|
-
static
|
|
1267
|
-
|
|
1269
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode
|
|
1270
|
+
DecodeLiteralBlockSwitch(BrotliDecoderState* s) {
|
|
1271
|
+
return DecodeLiteralBlockSwitchInternal(0, s);
|
|
1268
1272
|
}
|
|
1269
1273
|
|
|
1270
|
-
static
|
|
1274
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode SafeDecodeLiteralBlockSwitch(
|
|
1271
1275
|
BrotliDecoderState* s) {
|
|
1272
1276
|
return DecodeLiteralBlockSwitchInternal(1, s);
|
|
1273
1277
|
}
|
|
1274
1278
|
|
|
1275
1279
|
/* Block switch for insert/copy length.
|
|
1276
1280
|
Reads 3..54 bits. */
|
|
1277
|
-
static BROTLI_INLINE
|
|
1281
|
+
static BROTLI_INLINE BrotliDecoderErrorCode DecodeCommandBlockSwitchInternal(
|
|
1278
1282
|
int safe, BrotliDecoderState* s) {
|
|
1279
|
-
|
|
1280
|
-
|
|
1283
|
+
BrotliDecoderErrorCode result = DecodeBlockTypeAndLength(safe, s, 1);
|
|
1284
|
+
if (result != BROTLI_DECODER_SUCCESS) {
|
|
1285
|
+
return result;
|
|
1281
1286
|
}
|
|
1282
1287
|
s->htree_command = s->insert_copy_hgroup.htrees[s->block_type_rb[3]];
|
|
1283
|
-
return
|
|
1288
|
+
return BROTLI_DECODER_SUCCESS;
|
|
1284
1289
|
}
|
|
1285
1290
|
|
|
1286
|
-
static
|
|
1287
|
-
|
|
1291
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode
|
|
1292
|
+
DecodeCommandBlockSwitch(BrotliDecoderState* s) {
|
|
1293
|
+
return DecodeCommandBlockSwitchInternal(0, s);
|
|
1288
1294
|
}
|
|
1289
1295
|
|
|
1290
|
-
static
|
|
1291
|
-
|
|
1296
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode
|
|
1297
|
+
SafeDecodeCommandBlockSwitch(BrotliDecoderState* s) {
|
|
1292
1298
|
return DecodeCommandBlockSwitchInternal(1, s);
|
|
1293
1299
|
}
|
|
1294
1300
|
|
|
1295
1301
|
/* Block switch for distance codes.
|
|
1296
1302
|
Reads 3..54 bits. */
|
|
1297
|
-
static BROTLI_INLINE
|
|
1303
|
+
static BROTLI_INLINE BrotliDecoderErrorCode DecodeDistanceBlockSwitchInternal(
|
|
1298
1304
|
int safe, BrotliDecoderState* s) {
|
|
1299
|
-
|
|
1300
|
-
|
|
1305
|
+
BrotliDecoderErrorCode result = DecodeBlockTypeAndLength(safe, s, 2);
|
|
1306
|
+
if (result != BROTLI_DECODER_SUCCESS) {
|
|
1307
|
+
return result;
|
|
1301
1308
|
}
|
|
1302
1309
|
s->dist_context_map_slice = s->dist_context_map +
|
|
1303
1310
|
(s->block_type_rb[5] << BROTLI_DISTANCE_CONTEXT_BITS);
|
|
1304
1311
|
s->dist_htree_index = s->dist_context_map_slice[s->distance_context];
|
|
1305
|
-
return
|
|
1312
|
+
return BROTLI_DECODER_SUCCESS;
|
|
1306
1313
|
}
|
|
1307
1314
|
|
|
1308
|
-
static
|
|
1309
|
-
|
|
1315
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode
|
|
1316
|
+
DecodeDistanceBlockSwitch(BrotliDecoderState* s) {
|
|
1317
|
+
return DecodeDistanceBlockSwitchInternal(0, s);
|
|
1310
1318
|
}
|
|
1311
1319
|
|
|
1312
|
-
static
|
|
1320
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode SafeDecodeDistanceBlockSwitch(
|
|
1313
1321
|
BrotliDecoderState* s) {
|
|
1314
1322
|
return DecodeDistanceBlockSwitchInternal(1, s);
|
|
1315
1323
|
}
|
|
@@ -1940,6 +1948,9 @@ static BROTLI_INLINE BROTLI_BOOL CheckInputAmount(
|
|
|
1940
1948
|
return BrotliCheckInputAmount(br);
|
|
1941
1949
|
}
|
|
1942
1950
|
|
|
1951
|
+
/* NB: METHOD should return BROTLI_FALSE only in case there is not enough input;
|
|
1952
|
+
in case of "unsafe" execution, when input is guaranteed to be sufficient,
|
|
1953
|
+
result is ignored. */
|
|
1943
1954
|
#define BROTLI_SAFE(METHOD) \
|
|
1944
1955
|
{ \
|
|
1945
1956
|
if (safe) { \
|
|
@@ -1952,6 +1963,22 @@ static BROTLI_INLINE BROTLI_BOOL CheckInputAmount(
|
|
|
1952
1963
|
} \
|
|
1953
1964
|
}
|
|
1954
1965
|
|
|
1966
|
+
/* NB: METHOD should return BROTLI_DECODER_SUCCESS, BROTLI_DECODER_ERROR_*, or
|
|
1967
|
+
BROTLI_DECODER_NEEDS_MORE_INPUT; the later two break the processing. */
|
|
1968
|
+
#define BROTLI_SAFE_WITH_STATUS(METHOD) \
|
|
1969
|
+
{ \
|
|
1970
|
+
BrotliDecoderErrorCode status; \
|
|
1971
|
+
if (safe) { \
|
|
1972
|
+
status = Safe##METHOD; \
|
|
1973
|
+
} else { \
|
|
1974
|
+
status = METHOD; \
|
|
1975
|
+
} \
|
|
1976
|
+
if (status != BROTLI_DECODER_SUCCESS) { \
|
|
1977
|
+
result = status; \
|
|
1978
|
+
goto saveStateAndReturn; \
|
|
1979
|
+
} \
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1955
1982
|
static BROTLI_INLINE BrotliDecoderErrorCode ProcessCommandsInternal(
|
|
1956
1983
|
int safe, BrotliDecoderState* s) {
|
|
1957
1984
|
int pos = s->pos;
|
|
@@ -1991,7 +2018,7 @@ CommandBegin:
|
|
|
1991
2018
|
goto saveStateAndReturn;
|
|
1992
2019
|
}
|
|
1993
2020
|
if (BROTLI_PREDICT_FALSE(s->block_length[1] == 0)) {
|
|
1994
|
-
|
|
2021
|
+
BROTLI_SAFE_WITH_STATUS(DecodeCommandBlockSwitch(s));
|
|
1995
2022
|
goto CommandBegin;
|
|
1996
2023
|
}
|
|
1997
2024
|
/* Read the insert/copy length in the command. */
|
|
@@ -2136,7 +2163,7 @@ CommandPostDecodeLiterals:
|
|
|
2136
2163
|
} else {
|
|
2137
2164
|
/* Read distance code in the command, unless it was implicitly zero. */
|
|
2138
2165
|
if (BROTLI_PREDICT_FALSE(s->block_length[2] == 0)) {
|
|
2139
|
-
|
|
2166
|
+
BROTLI_SAFE_WITH_STATUS(DecodeDistanceBlockSwitch(s));
|
|
2140
2167
|
}
|
|
2141
2168
|
BROTLI_SAFE(ReadDistance(s, br));
|
|
2142
2169
|
}
|
|
@@ -2330,7 +2357,7 @@ CommandPostWrapCopy:
|
|
|
2330
2357
|
}
|
|
2331
2358
|
|
|
2332
2359
|
NextLiteralBlock:
|
|
2333
|
-
|
|
2360
|
+
BROTLI_SAFE_WITH_STATUS(DecodeLiteralBlockSwitch(s));
|
|
2334
2361
|
goto CommandInner;
|
|
2335
2362
|
|
|
2336
2363
|
saveStateAndReturn:
|
|
@@ -2552,6 +2579,8 @@ BrotliDecoderResult BrotliDecoderDecompressStream(
|
|
|
2552
2579
|
if (result != BROTLI_DECODER_SUCCESS) {
|
|
2553
2580
|
break;
|
|
2554
2581
|
}
|
|
2582
|
+
BROTLI_DCHECK(s->meta_block_remaining_len <=
|
|
2583
|
+
(int)BROTLI_BLOCK_SIZE_CAP);
|
|
2555
2584
|
BROTLI_LOG_UINT(s->is_last_metablock);
|
|
2556
2585
|
BROTLI_LOG_UINT(s->meta_block_remaining_len);
|
|
2557
2586
|
BROTLI_LOG_UINT(s->is_metadata);
|
|
@@ -85,9 +85,7 @@ typedef enum {
|
|
|
85
85
|
BROTLI_ERROR_CODE(_ERROR_FORMAT_, PADDING_1, -14) SEPARATOR \
|
|
86
86
|
BROTLI_ERROR_CODE(_ERROR_FORMAT_, PADDING_2, -15) SEPARATOR \
|
|
87
87
|
BROTLI_ERROR_CODE(_ERROR_FORMAT_, DISTANCE, -16) SEPARATOR \
|
|
88
|
-
|
|
89
|
-
/* -17 code is reserved */ \
|
|
90
|
-
\
|
|
88
|
+
BROTLI_ERROR_CODE(_ERROR_FORMAT_, BLOCK_SWITCH, -17) SEPARATOR \
|
|
91
89
|
BROTLI_ERROR_CODE(_ERROR_, COMPOUND_DICTIONARY, -18) SEPARATOR \
|
|
92
90
|
BROTLI_ERROR_CODE(_ERROR_, DICTIONARY_NOT_SET, -19) SEPARATOR \
|
|
93
91
|
BROTLI_ERROR_CODE(_ERROR_, INVALID_ARGUMENTS, -20) SEPARATOR \
|
|
@@ -32,7 +32,6 @@ cxx_library(
|
|
|
32
32
|
srcs=glob(['decompress/zstd*.c']),
|
|
33
33
|
deps=[
|
|
34
34
|
':common',
|
|
35
|
-
':legacy',
|
|
36
35
|
],
|
|
37
36
|
)
|
|
38
37
|
|
|
@@ -47,6 +46,14 @@ cxx_library(
|
|
|
47
46
|
deps=[':common'],
|
|
48
47
|
)
|
|
49
48
|
|
|
49
|
+
# Decoders for formats older than v0.8. Not a dependency of :decompress,
|
|
50
|
+
# because ZSTD_LEGACY_SUPPORT is 0 (see .buckconfig), which makes them
|
|
51
|
+
# unreachable.
|
|
52
|
+
# Enabling legacy formats means two edits, which only make sense together :
|
|
53
|
+
# raise the level in .buckconfig, AND add ':legacy' to :decompress deps.
|
|
54
|
+
# Raising the level alone fails to link, which is easy to notice. Adding the
|
|
55
|
+
# dep alone is silent : these decoders get compiled back in, while
|
|
56
|
+
# ZSTD_isLegacy() remains compiled out, so legacy frames are still rejected.
|
|
50
57
|
cxx_library(
|
|
51
58
|
name='legacy',
|
|
52
59
|
header_namespace='',
|
|
@@ -56,9 +63,6 @@ cxx_library(
|
|
|
56
63
|
]),
|
|
57
64
|
srcs=glob(['legacy/*.c']),
|
|
58
65
|
deps=[':common'],
|
|
59
|
-
exported_preprocessor_flags=[
|
|
60
|
-
'-DZSTD_LEGACY_SUPPORT=4',
|
|
61
|
-
],
|
|
62
66
|
)
|
|
63
67
|
|
|
64
68
|
cxx_library(
|
|
@@ -79,6 +83,7 @@ cxx_library(
|
|
|
79
83
|
header_namespace='',
|
|
80
84
|
visibility=['PUBLIC'],
|
|
81
85
|
exported_headers=subdir_glob([
|
|
86
|
+
('common', 'bmi2.h'),
|
|
82
87
|
('common', 'compiler.h'),
|
|
83
88
|
]),
|
|
84
89
|
)
|
|
@@ -132,7 +137,7 @@ cxx_library(
|
|
|
132
137
|
exported_headers=[
|
|
133
138
|
'zstd_errors.h',
|
|
134
139
|
'common/error_private.h',
|
|
135
|
-
]
|
|
140
|
+
],
|
|
136
141
|
srcs=['common/error_private.c'],
|
|
137
142
|
)
|
|
138
143
|
|
|
@@ -7,15 +7,30 @@ in order to make it easier to select or exclude features.
|
|
|
7
7
|
|
|
8
8
|
#### Building
|
|
9
9
|
|
|
10
|
-
`Makefile` script is provided, supporting [Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html#Makefile-Conventions),
|
|
10
|
+
A `Makefile` script is provided, supporting [Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html#Makefile-Conventions),
|
|
11
11
|
including commands variables, staged install, directory variables and standard targets.
|
|
12
12
|
- `make` : generates both static and dynamic libraries
|
|
13
|
-
- `make install` : install libraries and
|
|
13
|
+
- `make install` : install libraries, headers and pkg-config in local system directories
|
|
14
14
|
|
|
15
|
-
`libzstd` default scope
|
|
16
|
-
|
|
15
|
+
`libzstd` default scope includes compression, decompression, and dictionary builder.
|
|
16
|
+
Note: starting v1.6.0, support for decoding legacy formats is disabled by default.
|
|
17
|
+
See _modular build_ below to learn how to enable it.
|
|
17
18
|
The scope can be reduced on demand (see paragraph _modular build_).
|
|
18
19
|
|
|
20
|
+
#### Multiarch Support
|
|
21
|
+
|
|
22
|
+
For multiarch systems (like Debian/Ubuntu), libraries should be installed to architecture-specific directories.
|
|
23
|
+
When creating packages for such systems, use the `LIBDIR` variable to specify the correct multiarch path:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# For x86_64 systems on Ubuntu/Debian:
|
|
27
|
+
make install PREFIX=/usr LIBDIR=/usr/lib/x86_64-linux-gnu
|
|
28
|
+
|
|
29
|
+
# For ARM64 systems on Ubuntu/Debian:
|
|
30
|
+
make install PREFIX=/usr LIBDIR=/usr/lib/aarch64-linux-gnu
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This will not only install the files in the correct directories, but also generate the correct paths for `pkg-config`.
|
|
19
34
|
|
|
20
35
|
#### Multithreading support
|
|
21
36
|
|
|
@@ -85,7 +100,7 @@ The file structure is designed to make this selection manually achievable for an
|
|
|
85
100
|
Specifying a number limits versions supported to that version onward.
|
|
86
101
|
For example, `ZSTD_LEGACY_SUPPORT=2` means : "support legacy formats >= v0.2.0".
|
|
87
102
|
Conversely, `ZSTD_LEGACY_SUPPORT=0` means "do __not__ support legacy formats".
|
|
88
|
-
By default, this build macro is set as `ZSTD_LEGACY_SUPPORT=
|
|
103
|
+
By default, this build macro is set as `ZSTD_LEGACY_SUPPORT=0` (disabled).
|
|
89
104
|
Decoding supported legacy format is a transparent capability triggered within decompression functions.
|
|
90
105
|
It's also allowed to invoke legacy API directly, exposed in `lib/legacy/zstd_legacy.h`.
|
|
91
106
|
Each version does also provide its own set of advanced API.
|
|
@@ -193,6 +208,11 @@ The file structure is designed to make this selection manually achievable for an
|
|
|
193
208
|
and assembly decoding loops. You may want to use this macro if these loops are
|
|
194
209
|
slower on your platform.
|
|
195
210
|
|
|
211
|
+
- The macro `ZDICT_QSORT` can enforce selection of a specific sorting variant,
|
|
212
|
+
which is useful when autodetection fails, for example with older versions of `musl`.
|
|
213
|
+
For this scenario, it can be set as `ZDICT_QSORT=ZDICT_QSORT_C90`.
|
|
214
|
+
Other selectable suffixes are `_GNU`, `_APPLE`, `_MSVC` and `_C11`.
|
|
215
|
+
|
|
196
216
|
#### Windows : using MinGW+MSYS to create DLL
|
|
197
217
|
|
|
198
218
|
DLL can be created using MinGW+MSYS with the `make libzstd` command.
|
|
@@ -33,9 +33,13 @@ MEM_STATIC void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem)
|
|
|
33
33
|
MEM_STATIC void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem)
|
|
34
34
|
{
|
|
35
35
|
if (customMem.customAlloc) {
|
|
36
|
-
/* calloc implemented as malloc+memset
|
|
37
|
-
* not as efficient as calloc, but next best guess for custom malloc */
|
|
36
|
+
/* calloc implemented as malloc+memset */
|
|
38
37
|
void* const ptr = customMem.customAlloc(customMem.opaque, size);
|
|
38
|
+
|
|
39
|
+
if (ptr == NULL) {
|
|
40
|
+
return NULL;
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
ZSTD_memset(ptr, 0, size);
|
|
40
44
|
return ptr;
|
|
41
45
|
}
|
|
@@ -21,7 +21,7 @@ MEM_STATIC unsigned ZSTD_countTrailingZeros32_fallback(U32 val)
|
|
|
21
21
|
30, 22, 20, 15, 25, 17, 4, 8,
|
|
22
22
|
31, 27, 13, 23, 21, 19, 16, 7,
|
|
23
23
|
26, 12, 18, 6, 11, 5, 10, 9};
|
|
24
|
-
return DeBruijnBytePos[((U32) ((val & -
|
|
24
|
+
return DeBruijnBytePos[((U32) ((val & (0-val)) * 0x077CB531U)) >> 27];
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -102,8 +102,8 @@ typedef enum { BIT_DStream_unfinished = 0, /* fully refilled */
|
|
|
102
102
|
} BIT_DStream_status; /* result of BIT_reloadDStream() */
|
|
103
103
|
|
|
104
104
|
MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, size_t srcSize);
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
FORCE_INLINE_TEMPLATE BitContainerType BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits);
|
|
106
|
+
FORCE_INLINE_TEMPLATE BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD);
|
|
107
107
|
MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* bitD);
|
|
108
108
|
|
|
109
109
|
|
|
@@ -432,7 +432,7 @@ FORCE_INLINE_TEMPLATE BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD)
|
|
|
432
432
|
/* start < ptr < limitPtr => cautious update */
|
|
433
433
|
{ U32 nbBytes = bitD->bitsConsumed >> 3;
|
|
434
434
|
BIT_DStream_status result = BIT_DStream_unfinished;
|
|
435
|
-
if (bitD->ptr -
|
|
435
|
+
if (nbBytes > (size_t)(bitD->ptr - bitD->start)) {
|
|
436
436
|
nbBytes = (U32)(bitD->ptr - bitD->start); /* ptr > start */
|
|
437
437
|
result = BIT_DStream_endOfBuffer;
|
|
438
438
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under both the BSD-style license (found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
7
|
+
* in the COPYING file in the root directory of this source tree).
|
|
8
|
+
* You may select, at your option, one of the above-listed licenses.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef ZSTD_BMI2_H
|
|
12
|
+
#define ZSTD_BMI2_H
|
|
13
|
+
|
|
14
|
+
#include "portability_macros.h"
|
|
15
|
+
|
|
16
|
+
#if defined(ZSTD_USE_KERNEL_CPU_FEATURES)
|
|
17
|
+
# include <asm/cpufeature.h>
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* Select between the BMI2 and default implementations at the final dispatch
|
|
22
|
+
* site. Integrations may ignore the caller-provided hint and consult their own
|
|
23
|
+
* CPU-feature policy instead.
|
|
24
|
+
*
|
|
25
|
+
* ZSTD_USE_BMI2() may not evaluate its argument. ZSTD_SET_BMI2() may not
|
|
26
|
+
* evaluate its value argument, which avoids executing the userspace CPUID
|
|
27
|
+
* probe when the integration supplies the dispatch decision.
|
|
28
|
+
*/
|
|
29
|
+
#if !DYNAMIC_BMI2
|
|
30
|
+
# define ZSTD_USE_BMI2(bmi2) 0
|
|
31
|
+
# define ZSTD_SET_BMI2(state, value) do { } while (0)
|
|
32
|
+
#elif defined(ZSTD_USE_KERNEL_CPU_FEATURES)
|
|
33
|
+
# define ZSTD_USE_BMI2(bmi2) cpu_feature_enabled(X86_FEATURE_BMI2)
|
|
34
|
+
# define ZSTD_SET_BMI2(state, value) do { (state) = 0; } while (0)
|
|
35
|
+
#else
|
|
36
|
+
# define ZSTD_USE_BMI2(bmi2) (bmi2)
|
|
37
|
+
# define ZSTD_SET_BMI2(state, value) do { (state) = (value); } while (0)
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#endif /* ZSTD_BMI2_H */
|
|
@@ -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
|
}
|