zstd-ruby 1.5.2.3 → 1.5.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/ext/zstdruby/libzstd/common/bits.h +175 -0
  4. data/ext/zstdruby/libzstd/common/bitstream.h +18 -59
  5. data/ext/zstdruby/libzstd/common/compiler.h +22 -3
  6. data/ext/zstdruby/libzstd/common/cpu.h +1 -1
  7. data/ext/zstdruby/libzstd/common/debug.c +1 -1
  8. data/ext/zstdruby/libzstd/common/debug.h +1 -1
  9. data/ext/zstdruby/libzstd/common/entropy_common.c +12 -40
  10. data/ext/zstdruby/libzstd/common/error_private.c +9 -2
  11. data/ext/zstdruby/libzstd/common/error_private.h +1 -1
  12. data/ext/zstdruby/libzstd/common/fse.h +5 -83
  13. data/ext/zstdruby/libzstd/common/fse_decompress.c +7 -99
  14. data/ext/zstdruby/libzstd/common/huf.h +65 -156
  15. data/ext/zstdruby/libzstd/common/mem.h +39 -46
  16. data/ext/zstdruby/libzstd/common/pool.c +26 -10
  17. data/ext/zstdruby/libzstd/common/pool.h +7 -1
  18. data/ext/zstdruby/libzstd/common/portability_macros.h +22 -3
  19. data/ext/zstdruby/libzstd/common/threading.c +68 -14
  20. data/ext/zstdruby/libzstd/common/threading.h +5 -10
  21. data/ext/zstdruby/libzstd/common/xxhash.c +2 -2
  22. data/ext/zstdruby/libzstd/common/xxhash.h +8 -8
  23. data/ext/zstdruby/libzstd/common/zstd_common.c +1 -1
  24. data/ext/zstdruby/libzstd/common/zstd_deps.h +1 -1
  25. data/ext/zstdruby/libzstd/common/zstd_internal.h +17 -113
  26. data/ext/zstdruby/libzstd/common/zstd_trace.h +3 -3
  27. data/ext/zstdruby/libzstd/compress/clevels.h +1 -1
  28. data/ext/zstdruby/libzstd/compress/fse_compress.c +7 -124
  29. data/ext/zstdruby/libzstd/compress/hist.c +1 -1
  30. data/ext/zstdruby/libzstd/compress/hist.h +1 -1
  31. data/ext/zstdruby/libzstd/compress/huf_compress.c +234 -169
  32. data/ext/zstdruby/libzstd/compress/zstd_compress.c +1055 -455
  33. data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +165 -145
  34. data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +115 -39
  35. data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +16 -8
  36. data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +3 -3
  37. data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +1 -1
  38. data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +25 -21
  39. data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +1 -1
  40. data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +5 -3
  41. data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +95 -33
  42. data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +3 -2
  43. data/ext/zstdruby/libzstd/compress/zstd_fast.c +433 -148
  44. data/ext/zstdruby/libzstd/compress/zstd_fast.h +3 -2
  45. data/ext/zstdruby/libzstd/compress/zstd_lazy.c +306 -283
  46. data/ext/zstdruby/libzstd/compress/zstd_lazy.h +4 -2
  47. data/ext/zstdruby/libzstd/compress/zstd_ldm.c +5 -5
  48. data/ext/zstdruby/libzstd/compress/zstd_ldm.h +1 -1
  49. data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +1 -1
  50. data/ext/zstdruby/libzstd/compress/zstd_opt.c +104 -80
  51. data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
  52. data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +12 -5
  53. data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +1 -1
  54. data/ext/zstdruby/libzstd/decompress/huf_decompress.c +434 -441
  55. data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +30 -39
  56. data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +3 -4
  57. data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +1 -1
  58. data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +164 -42
  59. data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +186 -65
  60. data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +1 -1
  61. data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +4 -2
  62. data/ext/zstdruby/libzstd/dictBuilder/cover.c +19 -15
  63. data/ext/zstdruby/libzstd/dictBuilder/cover.h +1 -1
  64. data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +2 -2
  65. data/ext/zstdruby/libzstd/dictBuilder/zdict.c +9 -87
  66. data/ext/zstdruby/libzstd/zdict.h +53 -31
  67. data/ext/zstdruby/libzstd/zstd.h +489 -90
  68. data/ext/zstdruby/libzstd/zstd_errors.h +27 -8
  69. data/ext/zstdruby/main.c +4 -0
  70. data/lib/zstd-ruby/version.rb +1 -1
  71. metadata +7 -6
@@ -1,7 +1,7 @@
1
1
  /* ******************************************************************
2
2
  * FSE : Finite State Entropy codec
3
3
  * Public Prototypes declaration
4
- * Copyright (c) Yann Collet, Facebook, Inc.
4
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
6
6
  * You can contact the author at :
7
7
  * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
@@ -53,34 +53,6 @@ extern "C" {
53
53
  FSE_PUBLIC_API unsigned FSE_versionNumber(void); /**< library version number; to be used when checking dll version */
54
54
 
55
55
 
56
- /*-****************************************
57
- * FSE simple functions
58
- ******************************************/
59
- /*! FSE_compress() :
60
- Compress content of buffer 'src', of size 'srcSize', into destination buffer 'dst'.
61
- 'dst' buffer must be already allocated. Compression runs faster is dstCapacity >= FSE_compressBound(srcSize).
62
- @return : size of compressed data (<= dstCapacity).
63
- Special values : if return == 0, srcData is not compressible => Nothing is stored within dst !!!
64
- if return == 1, srcData is a single byte symbol * srcSize times. Use RLE compression instead.
65
- if FSE_isError(return), compression failed (more details using FSE_getErrorName())
66
- */
67
- FSE_PUBLIC_API size_t FSE_compress(void* dst, size_t dstCapacity,
68
- const void* src, size_t srcSize);
69
-
70
- /*! FSE_decompress():
71
- Decompress FSE data from buffer 'cSrc', of size 'cSrcSize',
72
- into already allocated destination buffer 'dst', of size 'dstCapacity'.
73
- @return : size of regenerated data (<= maxDstSize),
74
- or an error code, which can be tested using FSE_isError() .
75
-
76
- ** Important ** : FSE_decompress() does not decompress non-compressible nor RLE data !!!
77
- Why ? : making this distinction requires a header.
78
- Header management is intentionally delegated to the user layer, which can better manage special cases.
79
- */
80
- FSE_PUBLIC_API size_t FSE_decompress(void* dst, size_t dstCapacity,
81
- const void* cSrc, size_t cSrcSize);
82
-
83
-
84
56
  /*-*****************************************
85
57
  * Tool functions
86
58
  ******************************************/
@@ -91,20 +63,6 @@ FSE_PUBLIC_API unsigned FSE_isError(size_t code); /* tells if a return
91
63
  FSE_PUBLIC_API const char* FSE_getErrorName(size_t code); /* provides error code string (useful for debugging) */
92
64
 
93
65
 
94
- /*-*****************************************
95
- * FSE advanced functions
96
- ******************************************/
97
- /*! FSE_compress2() :
98
- Same as FSE_compress(), but allows the selection of 'maxSymbolValue' and 'tableLog'
99
- Both parameters can be defined as '0' to mean : use default value
100
- @return : size of compressed data
101
- Special values : if return == 0, srcData is not compressible => Nothing is stored within cSrc !!!
102
- if return == 1, srcData is a single byte symbol * srcSize times. Use RLE compression.
103
- if FSE_isError(return), it's an error code.
104
- */
105
- FSE_PUBLIC_API size_t FSE_compress2 (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog);
106
-
107
-
108
66
  /*-*****************************************
109
67
  * FSE detailed API
110
68
  ******************************************/
@@ -164,8 +122,6 @@ FSE_PUBLIC_API size_t FSE_writeNCount (void* buffer, size_t bufferSize,
164
122
  /*! Constructor and Destructor of FSE_CTable.
165
123
  Note that FSE_CTable size depends on 'tableLog' and 'maxSymbolValue' */
166
124
  typedef unsigned FSE_CTable; /* don't allocate that. It's only meant to be more restrictive than void* */
167
- FSE_PUBLIC_API FSE_CTable* FSE_createCTable (unsigned maxSymbolValue, unsigned tableLog);
168
- FSE_PUBLIC_API void FSE_freeCTable (FSE_CTable* ct);
169
125
 
170
126
  /*! FSE_buildCTable():
171
127
  Builds `ct`, which must be already allocated, using FSE_createCTable().
@@ -241,23 +197,7 @@ FSE_PUBLIC_API size_t FSE_readNCount_bmi2(short* normalizedCounter,
241
197
  unsigned* maxSymbolValuePtr, unsigned* tableLogPtr,
242
198
  const void* rBuffer, size_t rBuffSize, int bmi2);
243
199
 
244
- /*! Constructor and Destructor of FSE_DTable.
245
- Note that its size depends on 'tableLog' */
246
200
  typedef unsigned FSE_DTable; /* don't allocate that. It's just a way to be more restrictive than void* */
247
- FSE_PUBLIC_API FSE_DTable* FSE_createDTable(unsigned tableLog);
248
- FSE_PUBLIC_API void FSE_freeDTable(FSE_DTable* dt);
249
-
250
- /*! FSE_buildDTable():
251
- Builds 'dt', which must be already allocated, using FSE_createDTable().
252
- return : 0, or an errorCode, which can be tested using FSE_isError() */
253
- FSE_PUBLIC_API size_t FSE_buildDTable (FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog);
254
-
255
- /*! FSE_decompress_usingDTable():
256
- Decompress compressed source `cSrc` of size `cSrcSize` using `dt`
257
- into `dst` which must be already allocated.
258
- @return : size of regenerated data (necessarily <= `dstCapacity`),
259
- or an errorCode, which can be tested using FSE_isError() */
260
- FSE_PUBLIC_API size_t FSE_decompress_usingDTable(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, const FSE_DTable* dt);
261
201
 
262
202
  /*!
263
203
  Tutorial :
@@ -320,16 +260,6 @@ If there is an error, the function will return an error code, which can be teste
320
260
  unsigned FSE_optimalTableLog_internal(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue, unsigned minus);
321
261
  /**< same as FSE_optimalTableLog(), which used `minus==2` */
322
262
 
323
- /* FSE_compress_wksp() :
324
- * Same as FSE_compress2(), but using an externally allocated scratch buffer (`workSpace`).
325
- * FSE_COMPRESS_WKSP_SIZE_U32() provides the minimum size required for `workSpace` as a table of FSE_CTable.
326
- */
327
- #define FSE_COMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) ( FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) + ((maxTableLog > 12) ? (1 << (maxTableLog - 2)) : 1024) )
328
- size_t FSE_compress_wksp (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
329
-
330
- size_t FSE_buildCTable_raw (FSE_CTable* ct, unsigned nbBits);
331
- /**< build a fake FSE_CTable, designed for a flat distribution, where each symbol uses nbBits */
332
-
333
263
  size_t FSE_buildCTable_rle (FSE_CTable* ct, unsigned char symbolValue);
334
264
  /**< build a fake FSE_CTable, designed to compress always the same symbolValue */
335
265
 
@@ -347,19 +277,11 @@ size_t FSE_buildCTable_wksp(FSE_CTable* ct, const short* normalizedCounter, unsi
347
277
  FSE_PUBLIC_API size_t FSE_buildDTable_wksp(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
348
278
  /**< Same as FSE_buildDTable(), using an externally allocated `workspace` produced with `FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxSymbolValue)` */
349
279
 
350
- size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits);
351
- /**< build a fake FSE_DTable, designed to read a flat distribution where each symbol uses nbBits */
352
-
353
- size_t FSE_buildDTable_rle (FSE_DTable* dt, unsigned char symbolValue);
354
- /**< build a fake FSE_DTable, designed to always generate the same symbolValue */
355
-
356
- #define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) + (FSE_MAX_SYMBOL_VALUE + 1) / 2 + 1)
280
+ #define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + 1 + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) + (FSE_MAX_SYMBOL_VALUE + 1) / 2 + 1)
357
281
  #define FSE_DECOMPRESS_WKSP_SIZE(maxTableLog, maxSymbolValue) (FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(unsigned))
358
- size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize);
359
- /**< same as FSE_decompress(), using an externally allocated `workSpace` produced with `FSE_DECOMPRESS_WKSP_SIZE_U32(maxLog, maxSymbolValue)` */
360
-
361
282
  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);
362
- /**< Same as FSE_decompress_wksp() but with dynamic BMI2 support. Pass 1 if your CPU supports BMI2 or 0 if it doesn't. */
283
+ /**< same as FSE_decompress(), using an externally allocated `workSpace` produced with `FSE_DECOMPRESS_WKSP_SIZE_U32(maxLog, maxSymbolValue)`.
284
+ * Set bmi2 to 1 if your CPU supports BMI2 or 0 if it doesn't */
363
285
 
364
286
  typedef enum {
365
287
  FSE_repeat_none, /**< Cannot use the previous table */
@@ -555,7 +477,7 @@ MEM_STATIC void FSE_flushCState(BIT_CStream_t* bitC, const FSE_CState_t* statePt
555
477
 
556
478
  /* FSE_getMaxNbBits() :
557
479
  * Approximate maximum cost of a symbol, in bits.
558
- * Fractional get rounded up (i.e : a symbol with a normalized frequency of 3 gives the same result as a frequency of 2)
480
+ * Fractional get rounded up (i.e. a symbol with a normalized frequency of 3 gives the same result as a frequency of 2)
559
481
  * note 1 : assume symbolValue is valid (<= maxSymbolValue)
560
482
  * note 2 : if freq[symbolValue]==0, @return a fake cost of tableLog+1 bits */
561
483
  MEM_STATIC U32 FSE_getMaxNbBits(const void* symbolTTPtr, U32 symbolValue)
@@ -1,6 +1,6 @@
1
1
  /* ******************************************************************
2
2
  * FSE : Finite State Entropy decoder
3
- * Copyright (c) Yann Collet, Facebook, Inc.
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
4
  *
5
5
  * You can contact the author at :
6
6
  * - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy
@@ -24,6 +24,7 @@
24
24
  #include "error_private.h"
25
25
  #define ZSTD_DEPS_NEED_MALLOC
26
26
  #include "zstd_deps.h"
27
+ #include "bits.h" /* ZSTD_highbit32 */
27
28
 
28
29
 
29
30
  /* **************************************************************
@@ -55,19 +56,6 @@
55
56
  #define FSE_FUNCTION_NAME(X,Y) FSE_CAT(X,Y)
56
57
  #define FSE_TYPE_NAME(X,Y) FSE_CAT(X,Y)
57
58
 
58
-
59
- /* Function templates */
60
- FSE_DTable* FSE_createDTable (unsigned tableLog)
61
- {
62
- if (tableLog > FSE_TABLELOG_ABSOLUTE_MAX) tableLog = FSE_TABLELOG_ABSOLUTE_MAX;
63
- return (FSE_DTable*)ZSTD_malloc( FSE_DTABLE_SIZE_U32(tableLog) * sizeof (U32) );
64
- }
65
-
66
- void FSE_freeDTable (FSE_DTable* dt)
67
- {
68
- ZSTD_free(dt);
69
- }
70
-
71
59
  static size_t FSE_buildDTable_internal(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize)
72
60
  {
73
61
  void* const tdPtr = dt+1; /* because *dt is unsigned, 32-bits aligned on 32-bits */
@@ -127,10 +115,10 @@ static size_t FSE_buildDTable_internal(FSE_DTable* dt, const short* normalizedCo
127
115
  }
128
116
  }
129
117
  /* Now we spread those positions across the table.
130
- * The benefit of doing it in two stages is that we avoid the the
118
+ * The benefit of doing it in two stages is that we avoid the
131
119
  * variable size inner loop, which caused lots of branch misses.
132
120
  * Now we can run through all the positions without any branch misses.
133
- * We unroll the loop twice, since that is what emperically worked best.
121
+ * We unroll the loop twice, since that is what empirically worked best.
134
122
  */
135
123
  {
136
124
  size_t position = 0;
@@ -166,7 +154,7 @@ static size_t FSE_buildDTable_internal(FSE_DTable* dt, const short* normalizedCo
166
154
  for (u=0; u<tableSize; u++) {
167
155
  FSE_FUNCTION_TYPE const symbol = (FSE_FUNCTION_TYPE)(tableDecode[u].symbol);
168
156
  U32 const nextState = symbolNext[symbol]++;
169
- tableDecode[u].nbBits = (BYTE) (tableLog - BIT_highbit32(nextState) );
157
+ tableDecode[u].nbBits = (BYTE) (tableLog - ZSTD_highbit32(nextState) );
170
158
  tableDecode[u].newState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
171
159
  } }
172
160
 
@@ -184,49 +172,6 @@ size_t FSE_buildDTable_wksp(FSE_DTable* dt, const short* normalizedCounter, unsi
184
172
  /*-*******************************************************
185
173
  * Decompression (Byte symbols)
186
174
  *********************************************************/
187
- size_t FSE_buildDTable_rle (FSE_DTable* dt, BYTE symbolValue)
188
- {
189
- void* ptr = dt;
190
- FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr;
191
- void* dPtr = dt + 1;
192
- FSE_decode_t* const cell = (FSE_decode_t*)dPtr;
193
-
194
- DTableH->tableLog = 0;
195
- DTableH->fastMode = 0;
196
-
197
- cell->newState = 0;
198
- cell->symbol = symbolValue;
199
- cell->nbBits = 0;
200
-
201
- return 0;
202
- }
203
-
204
-
205
- size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits)
206
- {
207
- void* ptr = dt;
208
- FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr;
209
- void* dPtr = dt + 1;
210
- FSE_decode_t* const dinfo = (FSE_decode_t*)dPtr;
211
- const unsigned tableSize = 1 << nbBits;
212
- const unsigned tableMask = tableSize - 1;
213
- const unsigned maxSV1 = tableMask+1;
214
- unsigned s;
215
-
216
- /* Sanity checks */
217
- if (nbBits < 1) return ERROR(GENERIC); /* min size */
218
-
219
- /* Build Decoding Table */
220
- DTableH->tableLog = (U16)nbBits;
221
- DTableH->fastMode = 1;
222
- for (s=0; s<maxSV1; s++) {
223
- dinfo[s].newState = 0;
224
- dinfo[s].symbol = (BYTE)s;
225
- dinfo[s].nbBits = (BYTE)nbBits;
226
- }
227
-
228
- return 0;
229
- }
230
175
 
231
176
  FORCE_INLINE_TEMPLATE size_t FSE_decompress_usingDTable_generic(
232
177
  void* dst, size_t maxDstSize,
@@ -290,26 +235,6 @@ FORCE_INLINE_TEMPLATE size_t FSE_decompress_usingDTable_generic(
290
235
  return op-ostart;
291
236
  }
292
237
 
293
-
294
- size_t FSE_decompress_usingDTable(void* dst, size_t originalSize,
295
- const void* cSrc, size_t cSrcSize,
296
- const FSE_DTable* dt)
297
- {
298
- const void* ptr = dt;
299
- const FSE_DTableHeader* DTableH = (const FSE_DTableHeader*)ptr;
300
- const U32 fastMode = DTableH->fastMode;
301
-
302
- /* select fast mode (static) */
303
- if (fastMode) return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 1);
304
- return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0);
305
- }
306
-
307
-
308
- size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize)
309
- {
310
- return FSE_decompress_wksp_bmi2(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, /* bmi2 */ 0);
311
- }
312
-
313
238
  typedef struct {
314
239
  short ncount[FSE_MAX_SYMBOL_VALUE + 1];
315
240
  FSE_DTable dtable[1]; /* Dynamically sized */
@@ -342,7 +267,8 @@ FORCE_INLINE_TEMPLATE size_t FSE_decompress_wksp_body(
342
267
  }
343
268
 
344
269
  if (FSE_DECOMPRESS_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(tableLog_tooLarge);
345
- workSpace = wksp->dtable + FSE_DTABLE_SIZE_U32(tableLog);
270
+ assert(sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog) <= wkspSize);
271
+ workSpace = (BYTE*)workSpace + sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog);
346
272
  wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog);
347
273
 
348
274
  CHECK_F( FSE_buildDTable_internal(wksp->dtable, wksp->ncount, maxSymbolValue, tableLog, workSpace, wkspSize) );
@@ -382,22 +308,4 @@ size_t FSE_decompress_wksp_bmi2(void* dst, size_t dstCapacity, const void* cSrc,
382
308
  return FSE_decompress_wksp_body_default(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize);
383
309
  }
384
310
 
385
-
386
- typedef FSE_DTable DTable_max_t[FSE_DTABLE_SIZE_U32(FSE_MAX_TABLELOG)];
387
-
388
- #ifndef ZSTD_NO_UNUSED_FUNCTIONS
389
- size_t FSE_buildDTable(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog) {
390
- U32 wksp[FSE_BUILD_DTABLE_WKSP_SIZE_U32(FSE_TABLELOG_ABSOLUTE_MAX, FSE_MAX_SYMBOL_VALUE)];
391
- return FSE_buildDTable_wksp(dt, normalizedCounter, maxSymbolValue, tableLog, wksp, sizeof(wksp));
392
- }
393
-
394
- size_t FSE_decompress(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize)
395
- {
396
- /* Static analyzer seems unable to understand this table will be properly initialized later */
397
- U32 wksp[FSE_DECOMPRESS_WKSP_SIZE_U32(FSE_MAX_TABLELOG, FSE_MAX_SYMBOL_VALUE)];
398
- return FSE_decompress_wksp(dst, dstCapacity, cSrc, cSrcSize, FSE_MAX_TABLELOG, wksp, sizeof(wksp));
399
- }
400
- #endif
401
-
402
-
403
311
  #endif /* FSE_COMMONDEFS_ONLY */
@@ -1,7 +1,7 @@
1
1
  /* ******************************************************************
2
2
  * huff0 huffman codec,
3
3
  * part of Finite State Entropy library
4
- * Copyright (c) Yann Collet, Facebook, Inc.
4
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
6
6
  * You can contact the author at :
7
7
  * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
@@ -21,99 +21,22 @@ extern "C" {
21
21
 
22
22
  /* *** Dependencies *** */
23
23
  #include "zstd_deps.h" /* size_t */
24
-
25
-
26
- /* *** library symbols visibility *** */
27
- /* Note : when linking with -fvisibility=hidden on gcc, or by default on Visual,
28
- * HUF symbols remain "private" (internal symbols for library only).
29
- * Set macro FSE_DLL_EXPORT to 1 if you want HUF symbols visible on DLL interface */
30
- #if defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) && defined(__GNUC__) && (__GNUC__ >= 4)
31
- # define HUF_PUBLIC_API __attribute__ ((visibility ("default")))
32
- #elif defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) /* Visual expected */
33
- # define HUF_PUBLIC_API __declspec(dllexport)
34
- #elif defined(FSE_DLL_IMPORT) && (FSE_DLL_IMPORT==1)
35
- # define HUF_PUBLIC_API __declspec(dllimport) /* not required, just to generate faster code (saves a function pointer load from IAT and an indirect jump) */
36
- #else
37
- # define HUF_PUBLIC_API
38
- #endif
39
-
40
-
41
- /* ========================== */
42
- /* *** simple functions *** */
43
- /* ========================== */
44
-
45
- /** HUF_compress() :
46
- * Compress content from buffer 'src', of size 'srcSize', into buffer 'dst'.
47
- * 'dst' buffer must be already allocated.
48
- * Compression runs faster if `dstCapacity` >= HUF_compressBound(srcSize).
49
- * `srcSize` must be <= `HUF_BLOCKSIZE_MAX` == 128 KB.
50
- * @return : size of compressed data (<= `dstCapacity`).
51
- * Special values : if return == 0, srcData is not compressible => Nothing is stored within dst !!!
52
- * if HUF_isError(return), compression failed (more details using HUF_getErrorName())
53
- */
54
- HUF_PUBLIC_API size_t HUF_compress(void* dst, size_t dstCapacity,
55
- const void* src, size_t srcSize);
56
-
57
- /** HUF_decompress() :
58
- * Decompress HUF data from buffer 'cSrc', of size 'cSrcSize',
59
- * into already allocated buffer 'dst', of minimum size 'dstSize'.
60
- * `originalSize` : **must** be the ***exact*** size of original (uncompressed) data.
61
- * Note : in contrast with FSE, HUF_decompress can regenerate
62
- * RLE (cSrcSize==1) and uncompressed (cSrcSize==dstSize) data,
63
- * because it knows size to regenerate (originalSize).
64
- * @return : size of regenerated data (== originalSize),
65
- * or an error code, which can be tested using HUF_isError()
66
- */
67
- HUF_PUBLIC_API size_t HUF_decompress(void* dst, size_t originalSize,
68
- const void* cSrc, size_t cSrcSize);
24
+ #include "mem.h" /* U32 */
25
+ #define FSE_STATIC_LINKING_ONLY
26
+ #include "fse.h"
69
27
 
70
28
 
71
29
  /* *** Tool functions *** */
72
- #define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */
73
- HUF_PUBLIC_API size_t HUF_compressBound(size_t size); /**< maximum compressed size (worst case) */
30
+ #define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */
31
+ size_t HUF_compressBound(size_t size); /**< maximum compressed size (worst case) */
74
32
 
75
33
  /* Error Management */
76
- HUF_PUBLIC_API unsigned HUF_isError(size_t code); /**< tells if a return value is an error code */
77
- HUF_PUBLIC_API const char* HUF_getErrorName(size_t code); /**< provides error code string (useful for debugging) */
34
+ unsigned HUF_isError(size_t code); /**< tells if a return value is an error code */
35
+ const char* HUF_getErrorName(size_t code); /**< provides error code string (useful for debugging) */
78
36
 
79
37
 
80
- /* *** Advanced function *** */
81
-
82
- /** HUF_compress2() :
83
- * Same as HUF_compress(), but offers control over `maxSymbolValue` and `tableLog`.
84
- * `maxSymbolValue` must be <= HUF_SYMBOLVALUE_MAX .
85
- * `tableLog` must be `<= HUF_TABLELOG_MAX` . */
86
- HUF_PUBLIC_API size_t HUF_compress2 (void* dst, size_t dstCapacity,
87
- const void* src, size_t srcSize,
88
- unsigned maxSymbolValue, unsigned tableLog);
89
-
90
- /** HUF_compress4X_wksp() :
91
- * Same as HUF_compress2(), but uses externally allocated `workSpace`.
92
- * `workspace` must be at least as large as HUF_WORKSPACE_SIZE */
93
38
  #define HUF_WORKSPACE_SIZE ((8 << 10) + 512 /* sorting scratch space */)
94
39
  #define HUF_WORKSPACE_SIZE_U64 (HUF_WORKSPACE_SIZE / sizeof(U64))
95
- HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity,
96
- const void* src, size_t srcSize,
97
- unsigned maxSymbolValue, unsigned tableLog,
98
- void* workSpace, size_t wkspSize);
99
-
100
- #endif /* HUF_H_298734234 */
101
-
102
- /* ******************************************************************
103
- * WARNING !!
104
- * The following section contains advanced and experimental definitions
105
- * which shall never be used in the context of a dynamic library,
106
- * because they are not guaranteed to remain stable in the future.
107
- * Only consider them in association with static linking.
108
- * *****************************************************************/
109
- #if defined(HUF_STATIC_LINKING_ONLY) && !defined(HUF_H_HUF_STATIC_LINKING_ONLY)
110
- #define HUF_H_HUF_STATIC_LINKING_ONLY
111
-
112
- /* *** Dependencies *** */
113
- #include "mem.h" /* U32 */
114
- #define FSE_STATIC_LINKING_ONLY
115
- #include "fse.h"
116
-
117
40
 
118
41
  /* *** Constants *** */
119
42
  #define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
@@ -154,25 +77,49 @@ typedef U32 HUF_DTable;
154
77
  /* ****************************************
155
78
  * Advanced decompression functions
156
79
  ******************************************/
157
- size_t HUF_decompress4X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */
158
- #ifndef HUF_FORCE_DECOMPRESS_X1
159
- size_t HUF_decompress4X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */
160
- #endif
161
80
 
162
- size_t HUF_decompress4X_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< decodes RLE and uncompressed */
163
- size_t HUF_decompress4X_hufOnly(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< considers RLE and uncompressed as errors */
164
- size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< considers RLE and uncompressed as errors */
165
- size_t HUF_decompress4X1_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */
166
- size_t HUF_decompress4X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< single-symbol decoder */
167
- #ifndef HUF_FORCE_DECOMPRESS_X1
168
- size_t HUF_decompress4X2_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */
169
- size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< double-symbols decoder */
170
- #endif
81
+ /**
82
+ * Huffman flags bitset.
83
+ * For all flags, 0 is the default value.
84
+ */
85
+ typedef enum {
86
+ /**
87
+ * If compiled with DYNAMIC_BMI2: Set flag only if the CPU supports BMI2 at runtime.
88
+ * Otherwise: Ignored.
89
+ */
90
+ HUF_flags_bmi2 = (1 << 0),
91
+ /**
92
+ * If set: Test possible table depths to find the one that produces the smallest header + encoded size.
93
+ * If unset: Use heuristic to find the table depth.
94
+ */
95
+ HUF_flags_optimalDepth = (1 << 1),
96
+ /**
97
+ * If set: If the previous table can encode the input, always reuse the previous table.
98
+ * If unset: If the previous table can encode the input, reuse the previous table if it results in a smaller output.
99
+ */
100
+ HUF_flags_preferRepeat = (1 << 2),
101
+ /**
102
+ * If set: Sample the input and check if the sample is uncompressible, if it is then don't attempt to compress.
103
+ * If unset: Always histogram the entire input.
104
+ */
105
+ HUF_flags_suspectUncompressible = (1 << 3),
106
+ /**
107
+ * If set: Don't use assembly implementations
108
+ * If unset: Allow using assembly implementations
109
+ */
110
+ HUF_flags_disableAsm = (1 << 4),
111
+ /**
112
+ * If set: Don't use the fast decoding loop, always use the fallback decoding loop.
113
+ * If unset: Use the fast decoding loop when possible.
114
+ */
115
+ HUF_flags_disableFast = (1 << 5)
116
+ } HUF_flags_e;
171
117
 
172
118
 
173
119
  /* ****************************************
174
120
  * HUF detailed API
175
121
  * ****************************************/
122
+ #define HUF_OPTIMAL_DEPTH_THRESHOLD ZSTD_btultra
176
123
 
177
124
  /*! HUF_compress() does the following:
178
125
  * 1. count symbol occurrence from source[] into table count[] using FSE_count() (exposed within "fse.h")
@@ -185,12 +132,12 @@ size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize,
185
132
  * For example, it's possible to compress several blocks using the same 'CTable',
186
133
  * or to save and regenerate 'CTable' using external methods.
187
134
  */
188
- unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue);
189
- size_t HUF_buildCTable (HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue, unsigned maxNbBits); /* @return : maxNbBits; CTable and count can overlap. In which case, CTable will overwrite count content */
190
- size_t HUF_writeCTable (void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog);
135
+ unsigned HUF_minTableLog(unsigned symbolCardinality);
136
+ unsigned HUF_cardinality(const unsigned* count, unsigned maxSymbolValue);
137
+ unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue, void* workSpace,
138
+ size_t wkspSize, HUF_CElt* table, const unsigned* count, int flags); /* table is used as scratch space for building and testing tables, not a return value */
191
139
  size_t HUF_writeCTable_wksp(void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog, void* workspace, size_t workspaceSize);
192
- size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable);
193
- size_t HUF_compress4X_usingCTable_bmi2(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable, int bmi2);
140
+ size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable, int flags);
194
141
  size_t HUF_estimateCompressedSize(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue);
195
142
  int HUF_validateCTable(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue);
196
143
 
@@ -199,6 +146,7 @@ typedef enum {
199
146
  HUF_repeat_check, /**< Can use the previous table but it must be checked. Note : The previous table must have been constructed by HUF_compress{1, 4}X_repeat */
200
147
  HUF_repeat_valid /**< Can use the previous table and it is assumed to be valid */
201
148
  } HUF_repeat;
149
+
202
150
  /** HUF_compress4X_repeat() :
203
151
  * Same as HUF_compress4X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
204
152
  * If it uses hufTable it does not modify hufTable or repeat.
@@ -209,13 +157,13 @@ size_t HUF_compress4X_repeat(void* dst, size_t dstSize,
209
157
  const void* src, size_t srcSize,
210
158
  unsigned maxSymbolValue, unsigned tableLog,
211
159
  void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */
212
- HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2, unsigned suspectUncompressible);
160
+ HUF_CElt* hufTable, HUF_repeat* repeat, int flags);
213
161
 
214
162
  /** HUF_buildCTable_wksp() :
215
163
  * Same as HUF_buildCTable(), but using externally allocated scratch buffer.
216
164
  * `workSpace` must be aligned on 4-bytes boundaries, and its size must be >= HUF_CTABLE_WORKSPACE_SIZE.
217
165
  */
218
- #define HUF_CTABLE_WORKSPACE_SIZE_U32 (2*HUF_SYMBOLVALUE_MAX +1 +1)
166
+ #define HUF_CTABLE_WORKSPACE_SIZE_U32 ((4 * (HUF_SYMBOLVALUE_MAX + 1)) + 192)
219
167
  #define HUF_CTABLE_WORKSPACE_SIZE (HUF_CTABLE_WORKSPACE_SIZE_U32 * sizeof(unsigned))
220
168
  size_t HUF_buildCTable_wksp (HUF_CElt* tree,
221
169
  const unsigned* count, U32 maxSymbolValue, U32 maxNbBits,
@@ -241,7 +189,7 @@ size_t HUF_readStats_wksp(BYTE* huffWeight, size_t hwSize,
241
189
  U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr,
242
190
  const void* src, size_t srcSize,
243
191
  void* workspace, size_t wkspSize,
244
- int bmi2);
192
+ int flags);
245
193
 
246
194
  /** HUF_readCTable() :
247
195
  * Loading a CTable saved with HUF_writeCTable() */
@@ -279,32 +227,12 @@ U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize);
279
227
  #define HUF_DECOMPRESS_WORKSPACE_SIZE ((2 << 10) + (1 << 9))
280
228
  #define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32))
281
229
 
282
- #ifndef HUF_FORCE_DECOMPRESS_X2
283
- size_t HUF_readDTableX1 (HUF_DTable* DTable, const void* src, size_t srcSize);
284
- size_t HUF_readDTableX1_wksp (HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize);
285
- #endif
286
- #ifndef HUF_FORCE_DECOMPRESS_X1
287
- size_t HUF_readDTableX2 (HUF_DTable* DTable, const void* src, size_t srcSize);
288
- size_t HUF_readDTableX2_wksp (HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize);
289
- #endif
290
-
291
- size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
292
- #ifndef HUF_FORCE_DECOMPRESS_X2
293
- size_t HUF_decompress4X1_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
294
- #endif
295
- #ifndef HUF_FORCE_DECOMPRESS_X1
296
- size_t HUF_decompress4X2_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
297
- #endif
298
-
299
230
 
300
231
  /* ====================== */
301
232
  /* single stream variants */
302
233
  /* ====================== */
303
234
 
304
- size_t HUF_compress1X (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog);
305
- size_t HUF_compress1X_wksp (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize); /**< `workSpace` must be a table of at least HUF_WORKSPACE_SIZE_U64 U64 */
306
- size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable);
307
- size_t HUF_compress1X_usingCTable_bmi2(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable, int bmi2);
235
+ size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable, int flags);
308
236
  /** HUF_compress1X_repeat() :
309
237
  * Same as HUF_compress1X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
310
238
  * If it uses hufTable it does not modify hufTable or repeat.
@@ -315,49 +243,30 @@ size_t HUF_compress1X_repeat(void* dst, size_t dstSize,
315
243
  const void* src, size_t srcSize,
316
244
  unsigned maxSymbolValue, unsigned tableLog,
317
245
  void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */
318
- HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2, unsigned suspectUncompressible);
319
-
320
- size_t HUF_decompress1X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* single-symbol decoder */
321
- #ifndef HUF_FORCE_DECOMPRESS_X1
322
- size_t HUF_decompress1X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* double-symbol decoder */
323
- #endif
324
-
325
- size_t HUF_decompress1X_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize);
326
- size_t HUF_decompress1X_DCtx_wksp (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize);
327
- #ifndef HUF_FORCE_DECOMPRESS_X2
328
- size_t HUF_decompress1X1_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */
329
- size_t HUF_decompress1X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< single-symbol decoder */
330
- #endif
331
- #ifndef HUF_FORCE_DECOMPRESS_X1
332
- size_t HUF_decompress1X2_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */
333
- size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< double-symbols decoder */
334
- #endif
246
+ HUF_CElt* hufTable, HUF_repeat* repeat, int flags);
335
247
 
336
- size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); /**< automatic selection of sing or double symbol decoder, based on DTable */
337
- #ifndef HUF_FORCE_DECOMPRESS_X2
338
- size_t HUF_decompress1X1_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
339
- #endif
248
+ size_t HUF_decompress1X_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags);
340
249
  #ifndef HUF_FORCE_DECOMPRESS_X1
341
- size_t HUF_decompress1X2_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
250
+ size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags); /**< double-symbols decoder */
342
251
  #endif
343
252
 
344
253
  /* BMI2 variants.
345
254
  * If the CPU has BMI2 support, pass bmi2=1, otherwise pass bmi2=0.
346
255
  */
347
- size_t HUF_decompress1X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2);
256
+ size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int flags);
348
257
  #ifndef HUF_FORCE_DECOMPRESS_X2
349
- size_t HUF_decompress1X1_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2);
258
+ size_t HUF_decompress1X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags);
350
259
  #endif
351
- size_t HUF_decompress4X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2);
352
- size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2);
260
+ size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int flags);
261
+ size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags);
353
262
  #ifndef HUF_FORCE_DECOMPRESS_X2
354
- size_t HUF_readDTableX1_wksp_bmi2(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int bmi2);
263
+ size_t HUF_readDTableX1_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int flags);
355
264
  #endif
356
265
  #ifndef HUF_FORCE_DECOMPRESS_X1
357
- size_t HUF_readDTableX2_wksp_bmi2(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int bmi2);
266
+ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int flags);
358
267
  #endif
359
268
 
360
- #endif /* HUF_STATIC_LINKING_ONLY */
269
+ #endif /* HUF_H_298734234 */
361
270
 
362
271
  #if defined (__cplusplus)
363
272
  }