zstdlib 0.14.0-x86_64-linux → 0.15.0-x86_64-linux

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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +5 -0
  3. data/ext/zstdlib_c/extconf.rb +1 -1
  4. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/bits.h +92 -87
  5. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/bitstream.h +26 -29
  6. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/compiler.h +36 -22
  7. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/cpu.h +1 -1
  8. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/debug.h +0 -9
  9. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/error_private.c +1 -0
  10. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/error_private.h +0 -10
  11. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/fse.h +2 -17
  12. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/fse_decompress.c +2 -0
  13. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/huf.h +0 -9
  14. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/mem.h +7 -11
  15. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/pool.h +0 -9
  16. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/portability_macros.h +22 -9
  17. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/threading.h +0 -8
  18. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/xxhash.h +93 -19
  19. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_deps.h +12 -0
  20. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_internal.h +1 -69
  21. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_trace.h +5 -12
  22. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/hist.c +10 -0
  23. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/hist.h +7 -0
  24. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress.c +1057 -367
  25. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_internal.h +227 -125
  26. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_literals.c +1 -1
  27. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_sequences.c +7 -7
  28. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_sequences.h +7 -6
  29. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_superblock.c +17 -17
  30. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_cwksp.h +41 -24
  31. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_double_fast.c +58 -50
  32. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_double_fast.h +4 -12
  33. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_fast.c +91 -74
  34. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_fast.h +4 -12
  35. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_lazy.c +64 -64
  36. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_lazy.h +30 -39
  37. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_ldm.c +48 -33
  38. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_ldm.h +6 -14
  39. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_opt.c +55 -51
  40. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_opt.h +8 -16
  41. data/ext/zstdlib_c/zstd-1.5.7/lib/compress/zstd_preSplit.c +238 -0
  42. data/ext/zstdlib_c/zstd-1.5.7/lib/compress/zstd_preSplit.h +33 -0
  43. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstdmt_compress.c +134 -93
  44. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstdmt_compress.h +4 -15
  45. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/huf_decompress_amd64.S +10 -3
  46. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress.c +14 -11
  47. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress_block.c +6 -12
  48. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress_internal.h +5 -5
  49. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/zdict.h +15 -8
  50. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/zstd.h +241 -132
  51. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/zstd_errors.h +1 -8
  52. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzwrite.c +2 -1
  53. data/lib/2.4/zstdlib_c.so +0 -0
  54. data/lib/2.5/zstdlib_c.so +0 -0
  55. data/lib/2.6/zstdlib_c.so +0 -0
  56. data/lib/2.7/zstdlib_c.so +0 -0
  57. data/lib/3.0/zstdlib_c.so +0 -0
  58. data/lib/3.1/zstdlib_c.so +0 -0
  59. data/lib/3.2/zstdlib_c.so +0 -0
  60. data/lib/3.3/zstdlib_c.so +0 -0
  61. data/lib/3.4/zstdlib_c.so +0 -0
  62. metadata +75 -73
  63. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/allocations.h +0 -0
  64. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/debug.c +0 -0
  65. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/entropy_common.c +0 -0
  66. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/pool.c +0 -0
  67. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/threading.c +0 -0
  68. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/xxhash.c +0 -0
  69. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/common/zstd_common.c +0 -0
  70. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/clevels.h +0 -0
  71. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/fse_compress.c +0 -0
  72. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/huf_compress.c +0 -0
  73. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_literals.h +0 -0
  74. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_compress_superblock.h +0 -0
  75. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/compress/zstd_ldm_geartab.h +0 -0
  76. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/huf_decompress.c +0 -0
  77. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_ddict.c +0 -0
  78. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_ddict.h +0 -0
  79. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/lib/decompress/zstd_decompress_block.h +0 -0
  80. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzclose.c +0 -0
  81. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzcompatibility.h +0 -0
  82. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzguts.h +0 -0
  83. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzlib.c +0 -0
  84. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/gzread.c +0 -0
  85. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/zstd_zlibwrapper.c +0 -0
  86. data/ext/zstdlib_c/{zstd-1.5.6 → zstd-1.5.7}/zlibWrapper/zstd_zlibwrapper.h +5 -5
@@ -24,10 +24,7 @@
24
24
  # include "zstdmt_compress.h"
25
25
  #endif
26
26
  #include "../common/bits.h" /* ZSTD_highbit32, ZSTD_NbCommonBytes */
27
-
28
- #if defined (__cplusplus)
29
- extern "C" {
30
- #endif
27
+ #include "zstd_preSplit.h" /* ZSTD_SLIPBLOCK_WORKSPACESIZE */
31
28
 
32
29
  /*-*************************************
33
30
  * Constants
@@ -82,6 +79,70 @@ typedef struct {
82
79
  ZSTD_fseCTables_t fse;
83
80
  } ZSTD_entropyCTables_t;
84
81
 
82
+ /***********************************************
83
+ * Sequences *
84
+ ***********************************************/
85
+ typedef struct SeqDef_s {
86
+ U32 offBase; /* offBase == Offset + ZSTD_REP_NUM, or repcode 1,2,3 */
87
+ U16 litLength;
88
+ U16 mlBase; /* mlBase == matchLength - MINMATCH */
89
+ } SeqDef;
90
+
91
+ /* Controls whether seqStore has a single "long" litLength or matchLength. See SeqStore_t. */
92
+ typedef enum {
93
+ ZSTD_llt_none = 0, /* no longLengthType */
94
+ ZSTD_llt_literalLength = 1, /* represents a long literal */
95
+ ZSTD_llt_matchLength = 2 /* represents a long match */
96
+ } ZSTD_longLengthType_e;
97
+
98
+ typedef struct {
99
+ SeqDef* sequencesStart;
100
+ SeqDef* sequences; /* ptr to end of sequences */
101
+ BYTE* litStart;
102
+ BYTE* lit; /* ptr to end of literals */
103
+ BYTE* llCode;
104
+ BYTE* mlCode;
105
+ BYTE* ofCode;
106
+ size_t maxNbSeq;
107
+ size_t maxNbLit;
108
+
109
+ /* longLengthPos and longLengthType to allow us to represent either a single litLength or matchLength
110
+ * in the seqStore that has a value larger than U16 (if it exists). To do so, we increment
111
+ * the existing value of the litLength or matchLength by 0x10000.
112
+ */
113
+ ZSTD_longLengthType_e longLengthType;
114
+ U32 longLengthPos; /* Index of the sequence to apply long length modification to */
115
+ } SeqStore_t;
116
+
117
+ typedef struct {
118
+ U32 litLength;
119
+ U32 matchLength;
120
+ } ZSTD_SequenceLength;
121
+
122
+ /**
123
+ * Returns the ZSTD_SequenceLength for the given sequences. It handles the decoding of long sequences
124
+ * indicated by longLengthPos and longLengthType, and adds MINMATCH back to matchLength.
125
+ */
126
+ MEM_STATIC ZSTD_SequenceLength ZSTD_getSequenceLength(SeqStore_t const* seqStore, SeqDef const* seq)
127
+ {
128
+ ZSTD_SequenceLength seqLen;
129
+ seqLen.litLength = seq->litLength;
130
+ seqLen.matchLength = seq->mlBase + MINMATCH;
131
+ if (seqStore->longLengthPos == (U32)(seq - seqStore->sequencesStart)) {
132
+ if (seqStore->longLengthType == ZSTD_llt_literalLength) {
133
+ seqLen.litLength += 0x10000;
134
+ }
135
+ if (seqStore->longLengthType == ZSTD_llt_matchLength) {
136
+ seqLen.matchLength += 0x10000;
137
+ }
138
+ }
139
+ return seqLen;
140
+ }
141
+
142
+ const SeqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx); /* compress & dictBuilder */
143
+ int ZSTD_seqToCodes(const SeqStore_t* seqStorePtr); /* compress, dictBuilder, decodeCorpus (shouldn't get its definition from here) */
144
+
145
+
85
146
  /***********************************************
86
147
  * Entropy buffer statistics structs and funcs *
87
148
  ***********************************************/
@@ -91,7 +152,7 @@ typedef struct {
91
152
  * hufDesSize refers to the size of huffman tree description in bytes.
92
153
  * This metadata is populated in ZSTD_buildBlockEntropyStats_literals() */
93
154
  typedef struct {
94
- symbolEncodingType_e hType;
155
+ SymbolEncodingType_e hType;
95
156
  BYTE hufDesBuffer[ZSTD_MAX_HUF_HEADER_SIZE];
96
157
  size_t hufDesSize;
97
158
  } ZSTD_hufCTablesMetadata_t;
@@ -102,9 +163,9 @@ typedef struct {
102
163
  * fseTablesSize refers to the size of fse tables in bytes.
103
164
  * This metadata is populated in ZSTD_buildBlockEntropyStats_sequences() */
104
165
  typedef struct {
105
- symbolEncodingType_e llType;
106
- symbolEncodingType_e ofType;
107
- symbolEncodingType_e mlType;
166
+ SymbolEncodingType_e llType;
167
+ SymbolEncodingType_e ofType;
168
+ SymbolEncodingType_e mlType;
108
169
  BYTE fseTablesBuffer[ZSTD_MAX_FSE_HEADERS_SIZE];
109
170
  size_t fseTablesSize;
110
171
  size_t lastCountSize; /* This is to account for bug in 1.3.4. More detail in ZSTD_entropyCompressSeqStore_internal() */
@@ -119,7 +180,7 @@ typedef struct {
119
180
  * Builds entropy for the block.
120
181
  * @return : 0 on success or error code */
121
182
  size_t ZSTD_buildBlockEntropyStats(
122
- const seqStore_t* seqStorePtr,
183
+ const SeqStore_t* seqStorePtr,
123
184
  const ZSTD_entropyCTables_t* prevEntropy,
124
185
  ZSTD_entropyCTables_t* nextEntropy,
125
186
  const ZSTD_CCtx_params* cctxParams,
@@ -148,15 +209,9 @@ typedef struct {
148
209
  stopped. posInSequence <= seq[pos].litLength + seq[pos].matchLength */
149
210
  size_t size; /* The number of sequences. <= capacity. */
150
211
  size_t capacity; /* The capacity starting from `seq` pointer */
151
- } rawSeqStore_t;
212
+ } RawSeqStore_t;
152
213
 
153
- typedef struct {
154
- U32 idx; /* Index in array of ZSTD_Sequence */
155
- U32 posInSequence; /* Position within sequence at idx */
156
- size_t posInSrc; /* Number of bytes given by sequences provided so far */
157
- } ZSTD_sequencePosition;
158
-
159
- UNUSED_ATTR static const rawSeqStore_t kNullRawSeqStore = {NULL, 0, 0, 0, 0};
214
+ UNUSED_ATTR static const RawSeqStore_t kNullRawSeqStore = {NULL, 0, 0, 0, 0};
160
215
 
161
216
  typedef struct {
162
217
  int price; /* price from beginning of segment to this position */
@@ -188,7 +243,7 @@ typedef struct {
188
243
  U32 offCodeSumBasePrice; /* to compare to log2(offreq) */
189
244
  ZSTD_OptPrice_e priceType; /* prices can be determined dynamically, or follow a pre-defined cost structure */
190
245
  const ZSTD_entropyCTables_t* symbolCosts; /* pre-calculated dictionary statistics */
191
- ZSTD_paramSwitch_e literalCompressionMode;
246
+ ZSTD_ParamSwitch_e literalCompressionMode;
192
247
  } optState_t;
193
248
 
194
249
  typedef struct {
@@ -210,11 +265,11 @@ typedef struct {
210
265
 
211
266
  #define ZSTD_WINDOW_START_INDEX 2
212
267
 
213
- typedef struct ZSTD_matchState_t ZSTD_matchState_t;
268
+ typedef struct ZSTD_MatchState_t ZSTD_MatchState_t;
214
269
 
215
270
  #define ZSTD_ROW_HASH_CACHE_SIZE 8 /* Size of prefetching hash cache for row-based matchfinder */
216
271
 
217
- struct ZSTD_matchState_t {
272
+ struct ZSTD_MatchState_t {
218
273
  ZSTD_window_t window; /* State for window round buffer management */
219
274
  U32 loadedDictEnd; /* index of end of dictionary, within context's referential.
220
275
  * When loadedDictEnd != 0, a dictionary is in use, and still valid.
@@ -236,15 +291,15 @@ struct ZSTD_matchState_t {
236
291
  U32* hashTable3;
237
292
  U32* chainTable;
238
293
 
239
- U32 forceNonContiguous; /* Non-zero if we should force non-contiguous load for the next window update. */
294
+ int forceNonContiguous; /* Non-zero if we should force non-contiguous load for the next window update. */
240
295
 
241
296
  int dedicatedDictSearch; /* Indicates whether this matchState is using the
242
297
  * dedicated dictionary search structure.
243
298
  */
244
299
  optState_t opt; /* optimal parser state */
245
- const ZSTD_matchState_t* dictMatchState;
300
+ const ZSTD_MatchState_t* dictMatchState;
246
301
  ZSTD_compressionParameters cParams;
247
- const rawSeqStore_t* ldmSeqStore;
302
+ const RawSeqStore_t* ldmSeqStore;
248
303
 
249
304
  /* Controls prefetching in some dictMatchState matchfinders.
250
305
  * This behavior is controlled from the cctx ms.
@@ -262,7 +317,7 @@ struct ZSTD_matchState_t {
262
317
  typedef struct {
263
318
  ZSTD_compressedBlockState_t* prevCBlock;
264
319
  ZSTD_compressedBlockState_t* nextCBlock;
265
- ZSTD_matchState_t matchState;
320
+ ZSTD_MatchState_t matchState;
266
321
  } ZSTD_blockState_t;
267
322
 
268
323
  typedef struct {
@@ -289,7 +344,7 @@ typedef struct {
289
344
  } ldmState_t;
290
345
 
291
346
  typedef struct {
292
- ZSTD_paramSwitch_e enableLdm; /* ZSTD_ps_enable to enable LDM. ZSTD_ps_auto by default */
347
+ ZSTD_ParamSwitch_e enableLdm; /* ZSTD_ps_enable to enable LDM. ZSTD_ps_auto by default */
293
348
  U32 hashLog; /* Log size of hashTable */
294
349
  U32 bucketSizeLog; /* Log bucket size for collision resolution, at most 8 */
295
350
  U32 minMatchLength; /* Minimum match length */
@@ -320,7 +375,7 @@ struct ZSTD_CCtx_params_s {
320
375
  * There is no guarantee that hint is close to actual source size */
321
376
 
322
377
  ZSTD_dictAttachPref_e attachDictPref;
323
- ZSTD_paramSwitch_e literalCompressionMode;
378
+ ZSTD_ParamSwitch_e literalCompressionMode;
324
379
 
325
380
  /* Multithreading: used to pass parameters to mtctx */
326
381
  int nbWorkers;
@@ -339,14 +394,27 @@ struct ZSTD_CCtx_params_s {
339
394
  ZSTD_bufferMode_e outBufferMode;
340
395
 
341
396
  /* Sequence compression API */
342
- ZSTD_sequenceFormat_e blockDelimiters;
397
+ ZSTD_SequenceFormat_e blockDelimiters;
343
398
  int validateSequences;
344
399
 
345
- /* Block splitting */
346
- ZSTD_paramSwitch_e useBlockSplitter;
400
+ /* Block splitting
401
+ * @postBlockSplitter executes split analysis after sequences are produced,
402
+ * it's more accurate but consumes more resources.
403
+ * @preBlockSplitter_level splits before knowing sequences,
404
+ * it's more approximative but also cheaper.
405
+ * Valid @preBlockSplitter_level values range from 0 to 6 (included).
406
+ * 0 means auto, 1 means do not split,
407
+ * then levels are sorted in increasing cpu budget, from 2 (fastest) to 6 (slowest).
408
+ * Highest @preBlockSplitter_level combines well with @postBlockSplitter.
409
+ */
410
+ ZSTD_ParamSwitch_e postBlockSplitter;
411
+ int preBlockSplitter_level;
412
+
413
+ /* Adjust the max block size*/
414
+ size_t maxBlockSize;
347
415
 
348
416
  /* Param for deciding whether to use row-based matchfinder */
349
- ZSTD_paramSwitch_e useRowMatchFinder;
417
+ ZSTD_ParamSwitch_e useRowMatchFinder;
350
418
 
351
419
  /* Always load a dictionary in ext-dict mode (not prefix mode)? */
352
420
  int deterministicRefPrefix;
@@ -355,7 +423,7 @@ struct ZSTD_CCtx_params_s {
355
423
  ZSTD_customMem customMem;
356
424
 
357
425
  /* Controls prefetching in some dictMatchState matchfinders */
358
- ZSTD_paramSwitch_e prefetchCDictTables;
426
+ ZSTD_ParamSwitch_e prefetchCDictTables;
359
427
 
360
428
  /* Controls whether zstd will fall back to an internal matchfinder
361
429
  * if the external matchfinder returns an error code. */
@@ -367,15 +435,13 @@ struct ZSTD_CCtx_params_s {
367
435
  void* extSeqProdState;
368
436
  ZSTD_sequenceProducer_F extSeqProdFunc;
369
437
 
370
- /* Adjust the max block size*/
371
- size_t maxBlockSize;
372
-
373
438
  /* Controls repcode search in external sequence parsing */
374
- ZSTD_paramSwitch_e searchForExternalRepcodes;
439
+ ZSTD_ParamSwitch_e searchForExternalRepcodes;
375
440
  }; /* typedef'd to ZSTD_CCtx_params within "zstd.h" */
376
441
 
377
442
  #define COMPRESS_SEQUENCES_WORKSPACE_SIZE (sizeof(unsigned) * (MaxSeq + 2))
378
443
  #define ENTROPY_WORKSPACE_SIZE (HUF_WORKSPACE_SIZE + COMPRESS_SEQUENCES_WORKSPACE_SIZE)
444
+ #define TMP_WORKSPACE_SIZE (MAX(ENTROPY_WORKSPACE_SIZE, ZSTD_SLIPBLOCK_WORKSPACESIZE))
379
445
 
380
446
  /**
381
447
  * Indicates whether this compression proceeds directly from user-provided
@@ -393,11 +459,11 @@ typedef enum {
393
459
  */
394
460
  #define ZSTD_MAX_NB_BLOCK_SPLITS 196
395
461
  typedef struct {
396
- seqStore_t fullSeqStoreChunk;
397
- seqStore_t firstHalfSeqStore;
398
- seqStore_t secondHalfSeqStore;
399
- seqStore_t currSeqStore;
400
- seqStore_t nextSeqStore;
462
+ SeqStore_t fullSeqStoreChunk;
463
+ SeqStore_t firstHalfSeqStore;
464
+ SeqStore_t secondHalfSeqStore;
465
+ SeqStore_t currSeqStore;
466
+ SeqStore_t nextSeqStore;
401
467
 
402
468
  U32 partitions[ZSTD_MAX_NB_BLOCK_SPLITS];
403
469
  ZSTD_entropyCTablesMetadata_t entropyMetadata;
@@ -414,7 +480,7 @@ struct ZSTD_CCtx_s {
414
480
  size_t dictContentSize;
415
481
 
416
482
  ZSTD_cwksp workspace; /* manages buffer for dynamic allocations */
417
- size_t blockSize;
483
+ size_t blockSizeMax;
418
484
  unsigned long long pledgedSrcSizePlusOne; /* this way, 0 (default) == unknown */
419
485
  unsigned long long consumedSrcSize;
420
486
  unsigned long long producedCSize;
@@ -426,13 +492,14 @@ struct ZSTD_CCtx_s {
426
492
  int isFirstBlock;
427
493
  int initialized;
428
494
 
429
- seqStore_t seqStore; /* sequences storage ptrs */
495
+ SeqStore_t seqStore; /* sequences storage ptrs */
430
496
  ldmState_t ldmState; /* long distance matching state */
431
497
  rawSeq* ldmSequences; /* Storage for the ldm output sequences */
432
498
  size_t maxNbLdmSequences;
433
- rawSeqStore_t externSeqStore; /* Mutable reference to external sequences */
499
+ RawSeqStore_t externSeqStore; /* Mutable reference to external sequences */
434
500
  ZSTD_blockState_t blockState;
435
- U32* entropyWorkspace; /* entropy workspace of ENTROPY_WORKSPACE_SIZE bytes */
501
+ void* tmpWorkspace; /* used as substitute of stack space - must be aligned for S64 type */
502
+ size_t tmpWkspSize;
436
503
 
437
504
  /* Whether we are streaming or not */
438
505
  ZSTD_buffered_policy_e bufferedPolicy;
@@ -506,12 +573,12 @@ typedef enum {
506
573
  * behavior of taking both the source size and the dict size into account
507
574
  * when selecting and adjusting parameters.
508
575
  */
509
- } ZSTD_cParamMode_e;
576
+ } ZSTD_CParamMode_e;
510
577
 
511
- typedef size_t (*ZSTD_blockCompressor) (
512
- ZSTD_matchState_t* bs, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
578
+ typedef size_t (*ZSTD_BlockCompressor_f) (
579
+ ZSTD_MatchState_t* bs, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
513
580
  void const* src, size_t srcSize);
514
- ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_paramSwitch_e rowMatchfinderMode, ZSTD_dictMode_e dictMode);
581
+ ZSTD_BlockCompressor_f ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_ParamSwitch_e rowMatchfinderMode, ZSTD_dictMode_e dictMode);
515
582
 
516
583
 
517
584
  MEM_STATIC U32 ZSTD_LLcode(U32 litLength)
@@ -557,6 +624,25 @@ MEM_STATIC int ZSTD_cParam_withinBounds(ZSTD_cParameter cParam, int value)
557
624
  return 1;
558
625
  }
559
626
 
627
+ /* ZSTD_selectAddr:
628
+ * @return index >= lowLimit ? candidate : backup,
629
+ * tries to force branchless codegen. */
630
+ MEM_STATIC const BYTE*
631
+ ZSTD_selectAddr(U32 index, U32 lowLimit, const BYTE* candidate, const BYTE* backup)
632
+ {
633
+ #if defined(__GNUC__) && defined(__x86_64__)
634
+ __asm__ (
635
+ "cmp %1, %2\n"
636
+ "cmova %3, %0\n"
637
+ : "+r"(candidate)
638
+ : "r"(index), "r"(lowLimit), "r"(backup)
639
+ );
640
+ return candidate;
641
+ #else
642
+ return index >= lowLimit ? candidate : backup;
643
+ #endif
644
+ }
645
+
560
646
  /* ZSTD_noCompressBlock() :
561
647
  * Writes uncompressed block to dst buffer from given src.
562
648
  * Returns the size of the block */
@@ -639,14 +725,55 @@ ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const iend, BYTE con
639
725
  #define OFFBASE_TO_OFFSET(o) (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
640
726
  #define OFFBASE_TO_REPCODE(o) (assert(OFFBASE_IS_REPCODE(o)), (o)) /* returns ID 1,2,3 */
641
727
 
728
+ /*! ZSTD_storeSeqOnly() :
729
+ * Store a sequence (litlen, litPtr, offBase and matchLength) into SeqStore_t.
730
+ * Literals themselves are not copied, but @litPtr is updated.
731
+ * @offBase : Users should employ macros REPCODE_TO_OFFBASE() and OFFSET_TO_OFFBASE().
732
+ * @matchLength : must be >= MINMATCH
733
+ */
734
+ HINT_INLINE UNUSED_ATTR void
735
+ ZSTD_storeSeqOnly(SeqStore_t* seqStorePtr,
736
+ size_t litLength,
737
+ U32 offBase,
738
+ size_t matchLength)
739
+ {
740
+ assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
741
+
742
+ /* literal Length */
743
+ assert(litLength <= ZSTD_BLOCKSIZE_MAX);
744
+ if (UNLIKELY(litLength>0xFFFF)) {
745
+ assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */
746
+ seqStorePtr->longLengthType = ZSTD_llt_literalLength;
747
+ seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
748
+ }
749
+ seqStorePtr->sequences[0].litLength = (U16)litLength;
750
+
751
+ /* match offset */
752
+ seqStorePtr->sequences[0].offBase = offBase;
753
+
754
+ /* match Length */
755
+ assert(matchLength <= ZSTD_BLOCKSIZE_MAX);
756
+ assert(matchLength >= MINMATCH);
757
+ { size_t const mlBase = matchLength - MINMATCH;
758
+ if (UNLIKELY(mlBase>0xFFFF)) {
759
+ assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */
760
+ seqStorePtr->longLengthType = ZSTD_llt_matchLength;
761
+ seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
762
+ }
763
+ seqStorePtr->sequences[0].mlBase = (U16)mlBase;
764
+ }
765
+
766
+ seqStorePtr->sequences++;
767
+ }
768
+
642
769
  /*! ZSTD_storeSeq() :
643
- * Store a sequence (litlen, litPtr, offBase and matchLength) into seqStore_t.
770
+ * Store a sequence (litlen, litPtr, offBase and matchLength) into SeqStore_t.
644
771
  * @offBase : Users should employ macros REPCODE_TO_OFFBASE() and OFFSET_TO_OFFBASE().
645
772
  * @matchLength : must be >= MINMATCH
646
773
  * Allowed to over-read literals up to litLimit.
647
774
  */
648
775
  HINT_INLINE UNUSED_ATTR void
649
- ZSTD_storeSeq(seqStore_t* seqStorePtr,
776
+ ZSTD_storeSeq(SeqStore_t* seqStorePtr,
650
777
  size_t litLength, const BYTE* literals, const BYTE* litLimit,
651
778
  U32 offBase,
652
779
  size_t matchLength)
@@ -680,29 +807,7 @@ ZSTD_storeSeq(seqStore_t* seqStorePtr,
680
807
  }
681
808
  seqStorePtr->lit += litLength;
682
809
 
683
- /* literal Length */
684
- if (litLength>0xFFFF) {
685
- assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */
686
- seqStorePtr->longLengthType = ZSTD_llt_literalLength;
687
- seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
688
- }
689
- seqStorePtr->sequences[0].litLength = (U16)litLength;
690
-
691
- /* match offset */
692
- seqStorePtr->sequences[0].offBase = offBase;
693
-
694
- /* match Length */
695
- assert(matchLength >= MINMATCH);
696
- { size_t const mlBase = matchLength - MINMATCH;
697
- if (mlBase>0xFFFF) {
698
- assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */
699
- seqStorePtr->longLengthType = ZSTD_llt_matchLength;
700
- seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
701
- }
702
- seqStorePtr->sequences[0].mlBase = (U16)mlBase;
703
- }
704
-
705
- seqStorePtr->sequences++;
810
+ ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength);
706
811
  }
707
812
 
708
813
  /* ZSTD_updateRep() :
@@ -731,12 +836,12 @@ ZSTD_updateRep(U32 rep[ZSTD_REP_NUM], U32 const offBase, U32 const ll0)
731
836
 
732
837
  typedef struct repcodes_s {
733
838
  U32 rep[3];
734
- } repcodes_t;
839
+ } Repcodes_t;
735
840
 
736
- MEM_STATIC repcodes_t
841
+ MEM_STATIC Repcodes_t
737
842
  ZSTD_newRep(U32 const rep[ZSTD_REP_NUM], U32 const offBase, U32 const ll0)
738
843
  {
739
- repcodes_t newReps;
844
+ Repcodes_t newReps;
740
845
  ZSTD_memcpy(&newReps, rep, sizeof(newReps));
741
846
  ZSTD_updateRep(newReps.rep, offBase, ll0);
742
847
  return newReps;
@@ -779,8 +884,8 @@ ZSTD_count_2segments(const BYTE* ip, const BYTE* match,
779
884
  size_t const matchLength = ZSTD_count(ip, match, vEnd);
780
885
  if (match + matchLength != mEnd) return matchLength;
781
886
  DEBUGLOG(7, "ZSTD_count_2segments: found a 2-parts match (current length==%zu)", matchLength);
782
- DEBUGLOG(7, "distance from match beginning to end dictionary = %zi", mEnd - match);
783
- DEBUGLOG(7, "distance from current pos to end buffer = %zi", iEnd - ip);
887
+ DEBUGLOG(7, "distance from match beginning to end dictionary = %i", (int)(mEnd - match));
888
+ DEBUGLOG(7, "distance from current pos to end buffer = %i", (int)(iEnd - ip));
784
889
  DEBUGLOG(7, "next byte : ip==%02X, istart==%02X", ip[matchLength], *iStart);
785
890
  DEBUGLOG(7, "final match length = %zu", matchLength + ZSTD_count(ip+matchLength, iStart, iEnd));
786
891
  return matchLength + ZSTD_count(ip+matchLength, iStart, iEnd);
@@ -918,11 +1023,12 @@ MEM_STATIC U64 ZSTD_rollingHash_rotate(U64 hash, BYTE toRemove, BYTE toAdd, U64
918
1023
  /*-*************************************
919
1024
  * Round buffer management
920
1025
  ***************************************/
921
- #if (ZSTD_WINDOWLOG_MAX_64 > 31)
922
- # error "ZSTD_WINDOWLOG_MAX is too large : would overflow ZSTD_CURRENT_MAX"
923
- #endif
924
- /* Max current allowed */
925
- #define ZSTD_CURRENT_MAX ((3U << 29) + (1U << ZSTD_WINDOWLOG_MAX))
1026
+ /* Max @current value allowed:
1027
+ * In 32-bit mode: we want to avoid crossing the 2 GB limit,
1028
+ * reducing risks of side effects in case of signed operations on indexes.
1029
+ * In 64-bit mode: we want to ensure that adding the maximum job size (512 MB)
1030
+ * doesn't overflow U32 index capacity (4 GB) */
1031
+ #define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
926
1032
  /* Maximum chunk size before overflow correction needs to be called again */
927
1033
  #define ZSTD_CHUNKSIZE_MAX \
928
1034
  ( ((U32)-1) /* Maximum ending current index */ \
@@ -962,7 +1068,7 @@ MEM_STATIC U32 ZSTD_window_hasExtDict(ZSTD_window_t const window)
962
1068
  * Inspects the provided matchState and figures out what dictMode should be
963
1069
  * passed to the compressor.
964
1070
  */
965
- MEM_STATIC ZSTD_dictMode_e ZSTD_matchState_dictMode(const ZSTD_matchState_t *ms)
1071
+ MEM_STATIC ZSTD_dictMode_e ZSTD_matchState_dictMode(const ZSTD_MatchState_t *ms)
966
1072
  {
967
1073
  return ZSTD_window_hasExtDict(ms->window) ?
968
1074
  ZSTD_extDict :
@@ -1151,7 +1257,7 @@ ZSTD_window_enforceMaxDist(ZSTD_window_t* window,
1151
1257
  const void* blockEnd,
1152
1258
  U32 maxDist,
1153
1259
  U32* loadedDictEndPtr,
1154
- const ZSTD_matchState_t** dictMatchStatePtr)
1260
+ const ZSTD_MatchState_t** dictMatchStatePtr)
1155
1261
  {
1156
1262
  U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base);
1157
1263
  U32 const loadedDictEnd = (loadedDictEndPtr != NULL) ? *loadedDictEndPtr : 0;
@@ -1196,7 +1302,7 @@ ZSTD_checkDictValidity(const ZSTD_window_t* window,
1196
1302
  const void* blockEnd,
1197
1303
  U32 maxDist,
1198
1304
  U32* loadedDictEndPtr,
1199
- const ZSTD_matchState_t** dictMatchStatePtr)
1305
+ const ZSTD_MatchState_t** dictMatchStatePtr)
1200
1306
  {
1201
1307
  assert(loadedDictEndPtr != NULL);
1202
1308
  assert(dictMatchStatePtr != NULL);
@@ -1246,8 +1352,8 @@ MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) {
1246
1352
  MEM_STATIC
1247
1353
  ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
1248
1354
  U32 ZSTD_window_update(ZSTD_window_t* window,
1249
- void const* src, size_t srcSize,
1250
- int forceNonContiguous)
1355
+ const void* src, size_t srcSize,
1356
+ int forceNonContiguous)
1251
1357
  {
1252
1358
  BYTE const* const ip = (BYTE const*)src;
1253
1359
  U32 contiguous = 1;
@@ -1274,8 +1380,9 @@ U32 ZSTD_window_update(ZSTD_window_t* window,
1274
1380
  /* if input and dictionary overlap : reduce dictionary (area presumed modified by input) */
1275
1381
  if ( (ip+srcSize > window->dictBase + window->lowLimit)
1276
1382
  & (ip < window->dictBase + window->dictLimit)) {
1277
- ptrdiff_t const highInputIdx = (ip + srcSize) - window->dictBase;
1278
- U32 const lowLimitMax = (highInputIdx > (ptrdiff_t)window->dictLimit) ? window->dictLimit : (U32)highInputIdx;
1383
+ size_t const highInputIdx = (size_t)((ip + srcSize) - window->dictBase);
1384
+ U32 const lowLimitMax = (highInputIdx > (size_t)window->dictLimit) ? window->dictLimit : (U32)highInputIdx;
1385
+ assert(highInputIdx < UINT_MAX);
1279
1386
  window->lowLimit = lowLimitMax;
1280
1387
  DEBUGLOG(5, "Overlapping extDict and input : new lowLimit = %u", window->lowLimit);
1281
1388
  }
@@ -1285,7 +1392,7 @@ U32 ZSTD_window_update(ZSTD_window_t* window,
1285
1392
  /**
1286
1393
  * Returns the lowest allowed match index. It may either be in the ext-dict or the prefix.
1287
1394
  */
1288
- MEM_STATIC U32 ZSTD_getLowestMatchIndex(const ZSTD_matchState_t* ms, U32 curr, unsigned windowLog)
1395
+ MEM_STATIC U32 ZSTD_getLowestMatchIndex(const ZSTD_MatchState_t* ms, U32 curr, unsigned windowLog)
1289
1396
  {
1290
1397
  U32 const maxDistance = 1U << windowLog;
1291
1398
  U32 const lowestValid = ms->window.lowLimit;
@@ -1302,7 +1409,7 @@ MEM_STATIC U32 ZSTD_getLowestMatchIndex(const ZSTD_matchState_t* ms, U32 curr, u
1302
1409
  /**
1303
1410
  * Returns the lowest allowed match index in the prefix.
1304
1411
  */
1305
- MEM_STATIC U32 ZSTD_getLowestPrefixIndex(const ZSTD_matchState_t* ms, U32 curr, unsigned windowLog)
1412
+ MEM_STATIC U32 ZSTD_getLowestPrefixIndex(const ZSTD_MatchState_t* ms, U32 curr, unsigned windowLog)
1306
1413
  {
1307
1414
  U32 const maxDistance = 1U << windowLog;
1308
1415
  U32 const lowestValid = ms->window.dictLimit;
@@ -1315,6 +1422,13 @@ MEM_STATIC U32 ZSTD_getLowestPrefixIndex(const ZSTD_matchState_t* ms, U32 curr,
1315
1422
  return matchLowest;
1316
1423
  }
1317
1424
 
1425
+ /* index_safety_check:
1426
+ * intentional underflow : ensure repIndex isn't overlapping dict + prefix
1427
+ * @return 1 if values are not overlapping,
1428
+ * 0 otherwise */
1429
+ MEM_STATIC int ZSTD_index_overlap_check(const U32 prefixLowestIndex, const U32 repIndex) {
1430
+ return ((U32)((prefixLowestIndex-1) - repIndex) >= 3);
1431
+ }
1318
1432
 
1319
1433
 
1320
1434
  /* debug functions */
@@ -1385,10 +1499,6 @@ MEM_STATIC int ZSTD_comparePackedTags(size_t packedTag1, size_t packedTag2) {
1385
1499
  return tag1 == tag2;
1386
1500
  }
1387
1501
 
1388
- #if defined (__cplusplus)
1389
- }
1390
- #endif
1391
-
1392
1502
  /* ===============================================================
1393
1503
  * Shared internal declarations
1394
1504
  * These prototypes may be called from sources not in lib/compress
@@ -1404,6 +1514,25 @@ size_t ZSTD_loadCEntropy(ZSTD_compressedBlockState_t* bs, void* workspace,
1404
1514
 
1405
1515
  void ZSTD_reset_compressedBlockState(ZSTD_compressedBlockState_t* bs);
1406
1516
 
1517
+ typedef struct {
1518
+ U32 idx; /* Index in array of ZSTD_Sequence */
1519
+ U32 posInSequence; /* Position within sequence at idx */
1520
+ size_t posInSrc; /* Number of bytes given by sequences provided so far */
1521
+ } ZSTD_SequencePosition;
1522
+
1523
+ /* for benchmark */
1524
+ size_t ZSTD_convertBlockSequences(ZSTD_CCtx* cctx,
1525
+ const ZSTD_Sequence* const inSeqs, size_t nbSequences,
1526
+ int const repcodeResolution);
1527
+
1528
+ typedef struct {
1529
+ size_t nbSequences;
1530
+ size_t blockSize;
1531
+ size_t litSize;
1532
+ } BlockSummary;
1533
+
1534
+ BlockSummary ZSTD_get1BlockSummary(const ZSTD_Sequence* seqs, size_t nbSeqs);
1535
+
1407
1536
  /* ==============================================================
1408
1537
  * Private declarations
1409
1538
  * These prototypes shall only be called from within lib/compress
@@ -1415,7 +1544,7 @@ void ZSTD_reset_compressedBlockState(ZSTD_compressedBlockState_t* bs);
1415
1544
  * Note: srcSizeHint == 0 means 0!
1416
1545
  */
1417
1546
  ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams(
1418
- const ZSTD_CCtx_params* CCtxParams, U64 srcSizeHint, size_t dictSize, ZSTD_cParamMode_e mode);
1547
+ const ZSTD_CCtx_params* CCtxParams, U64 srcSizeHint, size_t dictSize, ZSTD_CParamMode_e mode);
1419
1548
 
1420
1549
  /*! ZSTD_initCStream_internal() :
1421
1550
  * Private use only. Init streaming operation.
@@ -1427,7 +1556,7 @@ size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs,
1427
1556
  const ZSTD_CDict* cdict,
1428
1557
  const ZSTD_CCtx_params* params, unsigned long long pledgedSrcSize);
1429
1558
 
1430
- void ZSTD_resetSeqStore(seqStore_t* ssPtr);
1559
+ void ZSTD_resetSeqStore(SeqStore_t* ssPtr);
1431
1560
 
1432
1561
  /*! ZSTD_getCParamsFromCDict() :
1433
1562
  * as the name implies */
@@ -1480,33 +1609,6 @@ U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat);
1480
1609
  */
1481
1610
  void ZSTD_CCtx_trace(ZSTD_CCtx* cctx, size_t extraCSize);
1482
1611
 
1483
- /* Returns 0 on success, and a ZSTD_error otherwise. This function scans through an array of
1484
- * ZSTD_Sequence, storing the sequences it finds, until it reaches a block delimiter.
1485
- * Note that the block delimiter must include the last literals of the block.
1486
- */
1487
- size_t
1488
- ZSTD_copySequencesToSeqStoreExplicitBlockDelim(ZSTD_CCtx* cctx,
1489
- ZSTD_sequencePosition* seqPos,
1490
- const ZSTD_Sequence* const inSeqs, size_t inSeqsSize,
1491
- const void* src, size_t blockSize, ZSTD_paramSwitch_e externalRepSearch);
1492
-
1493
- /* Returns the number of bytes to move the current read position back by.
1494
- * Only non-zero if we ended up splitting a sequence.
1495
- * Otherwise, it may return a ZSTD error if something went wrong.
1496
- *
1497
- * This function will attempt to scan through blockSize bytes
1498
- * represented by the sequences in @inSeqs,
1499
- * storing any (partial) sequences.
1500
- *
1501
- * Occasionally, we may want to change the actual number of bytes we consumed from inSeqs to
1502
- * avoid splitting a match, or to avoid splitting a match such that it would produce a match
1503
- * smaller than MINMATCH. In this case, we return the number of bytes that we didn't read from this block.
1504
- */
1505
- size_t
1506
- ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_sequencePosition* seqPos,
1507
- const ZSTD_Sequence* const inSeqs, size_t inSeqsSize,
1508
- const void* src, size_t blockSize, ZSTD_paramSwitch_e externalRepSearch);
1509
-
1510
1612
  /* Returns 1 if an external sequence producer is registered, otherwise returns 0. */
1511
1613
  MEM_STATIC int ZSTD_hasExtSeqProd(const ZSTD_CCtx_params* params) {
1512
1614
  return params->extSeqProdFunc != NULL;
@@ -140,7 +140,7 @@ size_t ZSTD_compressLiterals (
140
140
  size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB);
141
141
  BYTE* const ostart = (BYTE*)dst;
142
142
  U32 singleStream = srcSize < 256;
143
- symbolEncodingType_e hType = set_compressed;
143
+ SymbolEncodingType_e hType = set_compressed;
144
144
  size_t cLitSize;
145
145
 
146
146
  DEBUGLOG(5,"ZSTD_compressLiterals (disableLiteralCompression=%i, srcSize=%u, dstCapacity=%zu)",