zstdlib 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +10 -0
  3. data/README.md +7 -1
  4. data/Rakefile +38 -8
  5. data/ext/{zstdlib → zstdlib_c}/extconf.rb +10 -5
  6. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.2/zstdlib.c +2 -2
  7. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.3/zstdlib.c +2 -2
  8. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.4/zstdlib.c +2 -2
  9. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.5/zstdlib.c +2 -2
  10. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.6/zstdlib.c +2 -2
  11. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-2.7/zstdlib.c +2 -2
  12. data/ext/{zstdlib → zstdlib_c}/ruby/zlib-3.0/zstdlib.c +2 -2
  13. data/ext/zstdlib_c/ruby/zlib-3.1/zstdlib.c +5076 -0
  14. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/adler32.c +0 -0
  15. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/compress.c +0 -0
  16. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/crc32.c +0 -0
  17. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/crc32.h +0 -0
  18. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/deflate.c +0 -0
  19. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/deflate.h +0 -0
  20. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/gzclose.c +0 -0
  21. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/gzguts.h +0 -0
  22. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/gzlib.c +0 -0
  23. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/gzread.c +0 -0
  24. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/gzwrite.c +0 -0
  25. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/infback.c +0 -0
  26. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/inffast.c +0 -0
  27. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/inffast.h +0 -0
  28. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/inffixed.h +0 -0
  29. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/inflate.c +0 -0
  30. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/inflate.h +0 -0
  31. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/inftrees.c +0 -0
  32. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/inftrees.h +0 -0
  33. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/trees.c +0 -0
  34. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/trees.h +0 -0
  35. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/uncompr.c +0 -0
  36. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/zconf.h +0 -0
  37. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/zlib.h +0 -0
  38. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/zutil.c +0 -0
  39. data/ext/{zstdlib → zstdlib_c}/zlib-1.2.11/zutil.h +0 -0
  40. data/ext/{zstdlib → zstdlib_c}/zlib.mk +0 -0
  41. data/ext/{zstdlib → zstdlib_c}/zlibwrapper/zlibwrapper.c +1 -5
  42. data/ext/{zstdlib → zstdlib_c}/zlibwrapper.mk +0 -0
  43. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/bitstream.h +24 -9
  44. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/compiler.h +89 -43
  45. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/cpu.h +0 -0
  46. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/debug.c +0 -0
  47. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/debug.h +0 -0
  48. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/entropy_common.c +11 -5
  49. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/error_private.c +0 -0
  50. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/error_private.h +79 -0
  51. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/fse.h +2 -1
  52. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/fse_decompress.c +1 -1
  53. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/huf.h +24 -22
  54. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/mem.h +18 -0
  55. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/pool.c +11 -6
  56. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/pool.h +2 -2
  57. data/ext/zstdlib_c/zstd-1.5.2/lib/common/portability_macros.h +137 -0
  58. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/threading.c +0 -0
  59. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/threading.h +0 -0
  60. data/ext/zstdlib_c/zstd-1.5.2/lib/common/xxhash.c +24 -0
  61. data/ext/zstdlib_c/zstd-1.5.2/lib/common/xxhash.h +5686 -0
  62. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/zstd_common.c +0 -0
  63. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/zstd_deps.h +0 -0
  64. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/zstd_internal.h +95 -92
  65. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/common/zstd_trace.h +12 -3
  66. data/ext/zstdlib_c/zstd-1.5.2/lib/compress/clevels.h +134 -0
  67. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/fse_compress.c +63 -27
  68. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/hist.c +0 -0
  69. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/hist.h +0 -0
  70. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/huf_compress.c +537 -104
  71. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress.c +307 -373
  72. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_internal.h +174 -83
  73. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_literals.c +4 -3
  74. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_literals.h +3 -1
  75. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_sequences.c +15 -14
  76. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_sequences.h +0 -0
  77. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_superblock.c +4 -3
  78. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_compress_superblock.h +0 -0
  79. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_cwksp.h +41 -27
  80. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_double_fast.c +295 -120
  81. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_double_fast.h +0 -0
  82. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_fast.c +309 -130
  83. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_fast.h +0 -0
  84. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_lazy.c +482 -562
  85. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_lazy.h +0 -0
  86. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_ldm.c +9 -7
  87. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_ldm.h +1 -1
  88. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_ldm_geartab.h +4 -1
  89. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_opt.c +249 -148
  90. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstd_opt.h +0 -0
  91. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstdmt_compress.c +76 -38
  92. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/compress/zstdmt_compress.h +4 -1
  93. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/decompress/huf_decompress.c +727 -189
  94. data/ext/zstdlib_c/zstd-1.5.2/lib/decompress/huf_decompress_amd64.S +585 -0
  95. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_ddict.c +0 -0
  96. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_ddict.h +0 -0
  97. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_decompress.c +85 -22
  98. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_decompress_block.c +744 -220
  99. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_decompress_block.h +8 -2
  100. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/decompress/zstd_decompress_internal.h +34 -3
  101. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/zdict.h +4 -4
  102. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/zstd.h +179 -136
  103. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/lib/zstd_errors.h +0 -0
  104. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzclose.c +0 -0
  105. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzcompatibility.h +0 -0
  106. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzguts.h +0 -0
  107. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzlib.c +0 -0
  108. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzread.c +0 -0
  109. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/zlibWrapper/gzwrite.c +0 -0
  110. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/zlibWrapper/zstd_zlibwrapper.c +7 -0
  111. data/ext/{zstdlib/zstd-1.5.0 → zstdlib_c/zstd-1.5.2}/zlibWrapper/zstd_zlibwrapper.h +0 -0
  112. data/ext/zstdlib_c/zstd.mk +15 -0
  113. data/lib/zstdlib.rb +2 -2
  114. metadata +118 -114
  115. data/ext/zstdlib/zstd-1.5.0/lib/common/xxhash.c +0 -824
  116. data/ext/zstdlib/zstd-1.5.0/lib/common/xxhash.h +0 -285
  117. data/ext/zstdlib/zstd.mk +0 -14
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,12 +1,8 @@
1
1
  /* Additional required wrappers not covered by zstd's zlibwrapper */
2
2
 
3
3
  #include <zlib.h>
4
- #include "zstd_zlibwrapper.h"
5
4
 
6
- ZEXTERN const char* ZEXPORT z_zError OF((int a))
7
- {
8
- return zError(a);
9
- }
5
+ #include "zstd_zlibwrapper.h"
10
6
 
11
7
  ZEXTERN int ZEXPORT z_inflateSyncPoint OF((z_streamp a))
12
8
  {
File without changes
@@ -143,10 +143,16 @@ MEM_STATIC unsigned BIT_highbit32 (U32 val)
143
143
  {
144
144
  # if defined(_MSC_VER) /* Visual */
145
145
  # if STATIC_BMI2 == 1
146
- return _lzcnt_u32(val) ^ 31;
146
+ return _lzcnt_u32(val) ^ 31;
147
147
  # else
148
- unsigned long r = 0;
149
- return _BitScanReverse(&r, val) ? (unsigned)r : 0;
148
+ if (val != 0) {
149
+ unsigned long r;
150
+ _BitScanReverse(&r, val);
151
+ return (unsigned)r;
152
+ } else {
153
+ /* Should not reach this code path */
154
+ __assume(0);
155
+ }
150
156
  # endif
151
157
  # elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
152
158
  return __builtin_clz (val) ^ 31;
@@ -293,22 +299,22 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si
293
299
  switch(srcSize)
294
300
  {
295
301
  case 7: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
296
- /* fall-through */
302
+ ZSTD_FALLTHROUGH;
297
303
 
298
304
  case 6: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
299
- /* fall-through */
305
+ ZSTD_FALLTHROUGH;
300
306
 
301
307
  case 5: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
302
- /* fall-through */
308
+ ZSTD_FALLTHROUGH;
303
309
 
304
310
  case 4: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[3]) << 24;
305
- /* fall-through */
311
+ ZSTD_FALLTHROUGH;
306
312
 
307
313
  case 3: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[2]) << 16;
308
- /* fall-through */
314
+ ZSTD_FALLTHROUGH;
309
315
 
310
316
  case 2: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[1]) << 8;
311
- /* fall-through */
317
+ ZSTD_FALLTHROUGH;
312
318
 
313
319
  default: break;
314
320
  }
@@ -332,7 +338,16 @@ MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getMiddleBits(size_t bitContainer, U32 c
332
338
  U32 const regMask = sizeof(bitContainer)*8 - 1;
333
339
  /* if start > regMask, bitstream is corrupted, and result is undefined */
334
340
  assert(nbBits < BIT_MASK_SIZE);
341
+ /* x86 transform & ((1 << nbBits) - 1) to bzhi instruction, it is better
342
+ * than accessing memory. When bmi2 instruction is not present, we consider
343
+ * such cpus old (pre-Haswell, 2013) and their performance is not of that
344
+ * importance.
345
+ */
346
+ #if defined(__x86_64__) || defined(_M_X86)
347
+ return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
348
+ #else
335
349
  return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
350
+ #endif
336
351
  }
337
352
 
338
353
  MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits)
@@ -11,6 +11,8 @@
11
11
  #ifndef ZSTD_COMPILER_H
12
12
  #define ZSTD_COMPILER_H
13
13
 
14
+ #include "portability_macros.h"
15
+
14
16
  /*-*******************************************************
15
17
  * Compiler specifics
16
18
  *********************************************************/
@@ -40,7 +42,7 @@
40
42
 
41
43
  /**
42
44
  On MSVC qsort requires that functions passed into it use the __cdecl calling conversion(CC).
43
- This explictly marks such functions as __cdecl so that the code will still compile
45
+ This explicitly marks such functions as __cdecl so that the code will still compile
44
46
  if a CC other than __cdecl has been made the default.
45
47
  */
46
48
  #if defined(_MSC_VER)
@@ -92,29 +94,17 @@
92
94
 
93
95
 
94
96
  /* target attribute */
95
- #ifndef __has_attribute
96
- #define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
97
- #endif
98
97
  #if defined(__GNUC__) || defined(__ICCARM__)
99
98
  # define TARGET_ATTRIBUTE(target) __attribute__((__target__(target)))
100
99
  #else
101
100
  # define TARGET_ATTRIBUTE(target)
102
101
  #endif
103
102
 
104
- /* Enable runtime BMI2 dispatch based on the CPU.
105
- * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default.
103
+ /* Target attribute for BMI2 dynamic dispatch.
104
+ * Enable lzcnt, bmi, and bmi2.
105
+ * We test for bmi1 & bmi2. lzcnt is included in bmi1.
106
106
  */
107
- #ifndef DYNAMIC_BMI2
108
- #if ((defined(__clang__) && __has_attribute(__target__)) \
109
- || (defined(__GNUC__) \
110
- && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \
111
- && (defined(__x86_64__) || defined(_M_X86)) \
112
- && !defined(__BMI2__)
113
- # define DYNAMIC_BMI2 1
114
- #else
115
- # define DYNAMIC_BMI2 0
116
- #endif
117
- #endif
107
+ #define BMI2_TARGET_ATTRIBUTE TARGET_ATTRIBUTE("lzcnt,bmi,bmi2")
118
108
 
119
109
  /* prefetch
120
110
  * can be disabled, by declaring NO_PREFETCH build macro */
@@ -150,8 +140,9 @@
150
140
  }
151
141
 
152
142
  /* vectorization
153
- * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax */
154
- #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__)
143
+ * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax,
144
+ * and some compilers, like Intel ICC and MCST LCC, do not support it at all. */
145
+ #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && !defined(__LCC__)
155
146
  # if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5)
156
147
  # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
157
148
  # else
@@ -197,25 +188,91 @@
197
188
  #define STATIC_BMI2 0
198
189
  #endif
199
190
 
200
- /* compat. with non-clang compilers */
201
- #ifndef __has_builtin
202
- # define __has_builtin(x) 0
191
+ /* compile time determination of SIMD support */
192
+ #if !defined(ZSTD_NO_INTRINSICS)
193
+ # if defined(__SSE2__) || defined(_M_AMD64) || (defined (_M_IX86) && defined(_M_IX86_FP) && (_M_IX86_FP >= 2))
194
+ # define ZSTD_ARCH_X86_SSE2
195
+ # endif
196
+ # if defined(__ARM_NEON) || defined(_M_ARM64)
197
+ # define ZSTD_ARCH_ARM_NEON
198
+ # endif
199
+ #
200
+ # if defined(ZSTD_ARCH_X86_SSE2)
201
+ # include <emmintrin.h>
202
+ # elif defined(ZSTD_ARCH_ARM_NEON)
203
+ # include <arm_neon.h>
204
+ # endif
203
205
  #endif
204
206
 
205
- /* compat. with non-clang compilers */
206
- #ifndef __has_feature
207
- # define __has_feature(x) 0
207
+ /* C-language Attributes are added in C23. */
208
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201710L) && defined(__has_c_attribute)
209
+ # define ZSTD_HAS_C_ATTRIBUTE(x) __has_c_attribute(x)
210
+ #else
211
+ # define ZSTD_HAS_C_ATTRIBUTE(x) 0
208
212
  #endif
209
213
 
210
- /* detects whether we are being compiled under msan */
211
- #ifndef ZSTD_MEMORY_SANITIZER
212
- # if __has_feature(memory_sanitizer)
213
- # define ZSTD_MEMORY_SANITIZER 1
214
- # else
215
- # define ZSTD_MEMORY_SANITIZER 0
216
- # endif
214
+ /* Only use C++ attributes in C++. Some compilers report support for C++
215
+ * attributes when compiling with C.
216
+ */
217
+ #if defined(__cplusplus) && defined(__has_cpp_attribute)
218
+ # define ZSTD_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
219
+ #else
220
+ # define ZSTD_HAS_CPP_ATTRIBUTE(x) 0
217
221
  #endif
218
222
 
223
+ /* Define ZSTD_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute.
224
+ * - C23: https://en.cppreference.com/w/c/language/attributes/fallthrough
225
+ * - CPP17: https://en.cppreference.com/w/cpp/language/attributes/fallthrough
226
+ * - Else: __attribute__((__fallthrough__))
227
+ */
228
+ #ifndef ZSTD_FALLTHROUGH
229
+ # if ZSTD_HAS_C_ATTRIBUTE(fallthrough)
230
+ # define ZSTD_FALLTHROUGH [[fallthrough]]
231
+ # elif ZSTD_HAS_CPP_ATTRIBUTE(fallthrough)
232
+ # define ZSTD_FALLTHROUGH [[fallthrough]]
233
+ # elif __has_attribute(__fallthrough__)
234
+ /* Leading semicolon is to satisfy gcc-11 with -pedantic. Without the semicolon
235
+ * gcc complains about: a label can only be part of a statement and a declaration is not a statement.
236
+ */
237
+ # define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
238
+ # else
239
+ # define ZSTD_FALLTHROUGH
240
+ # endif
241
+ #endif
242
+
243
+ /*-**************************************************************
244
+ * Alignment check
245
+ *****************************************************************/
246
+
247
+ /* this test was initially positioned in mem.h,
248
+ * but this file is removed (or replaced) for linux kernel
249
+ * so it's now hosted in compiler.h,
250
+ * which remains valid for both user & kernel spaces.
251
+ */
252
+
253
+ #ifndef ZSTD_ALIGNOF
254
+ # if defined(__GNUC__) || defined(_MSC_VER)
255
+ /* covers gcc, clang & MSVC */
256
+ /* note : this section must come first, before C11,
257
+ * due to a limitation in the kernel source generator */
258
+ # define ZSTD_ALIGNOF(T) __alignof(T)
259
+
260
+ # elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
261
+ /* C11 support */
262
+ # include <stdalign.h>
263
+ # define ZSTD_ALIGNOF(T) alignof(T)
264
+
265
+ # else
266
+ /* No known support for alignof() - imperfect backup */
267
+ # define ZSTD_ALIGNOF(T) (sizeof(void*) < sizeof(T) ? sizeof(void*) : sizeof(T))
268
+
269
+ # endif
270
+ #endif /* ZSTD_ALIGNOF */
271
+
272
+ /*-**************************************************************
273
+ * Sanitizer
274
+ *****************************************************************/
275
+
219
276
  #if ZSTD_MEMORY_SANITIZER
220
277
  /* Not all platforms that support msan provide sanitizers/msan_interface.h.
221
278
  * We therefore declare the functions we need ourselves, rather than trying to
@@ -237,17 +294,6 @@ void __msan_poison(const volatile void *a, size_t size);
237
294
  intptr_t __msan_test_shadow(const volatile void *x, size_t size);
238
295
  #endif
239
296
 
240
- /* detects whether we are being compiled under asan */
241
- #ifndef ZSTD_ADDRESS_SANITIZER
242
- # if __has_feature(address_sanitizer)
243
- # define ZSTD_ADDRESS_SANITIZER 1
244
- # elif defined(__SANITIZE_ADDRESS__)
245
- # define ZSTD_ADDRESS_SANITIZER 1
246
- # else
247
- # define ZSTD_ADDRESS_SANITIZER 0
248
- # endif
249
- #endif
250
-
251
297
  #if ZSTD_ADDRESS_SANITIZER
252
298
  /* Not all platforms that support asan provide sanitizers/asan_interface.h.
253
299
  * We therefore declare the functions we need ourselves, rather than trying to
@@ -43,8 +43,14 @@ static U32 FSE_ctz(U32 val)
43
43
  assert(val != 0);
44
44
  {
45
45
  # if defined(_MSC_VER) /* Visual */
46
- unsigned long r=0;
47
- return _BitScanForward(&r, val) ? (unsigned)r : 0;
46
+ if (val != 0) {
47
+ unsigned long r;
48
+ _BitScanForward(&r, val);
49
+ return (unsigned)r;
50
+ } else {
51
+ /* Should not reach this code path */
52
+ __assume(0);
53
+ }
48
54
  # elif defined(__GNUC__) && (__GNUC__ >= 3) /* GCC Intrinsic */
49
55
  return __builtin_ctz(val);
50
56
  # elif defined(__ICCARM__) /* IAR Intrinsic */
@@ -217,7 +223,7 @@ static size_t FSE_readNCount_body_default(
217
223
  }
218
224
 
219
225
  #if DYNAMIC_BMI2
220
- TARGET_ATTRIBUTE("bmi2") static size_t FSE_readNCount_body_bmi2(
226
+ BMI2_TARGET_ATTRIBUTE static size_t FSE_readNCount_body_bmi2(
221
227
  short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
222
228
  const void* headerBuffer, size_t hbSize)
223
229
  {
@@ -299,7 +305,7 @@ HUF_readStats_body(BYTE* huffWeight, size_t hwSize, U32* rankStats,
299
305
  ZSTD_memset(rankStats, 0, (HUF_TABLELOG_MAX + 1) * sizeof(U32));
300
306
  weightTotal = 0;
301
307
  { U32 n; for (n=0; n<oSize; n++) {
302
- if (huffWeight[n] >= HUF_TABLELOG_MAX) return ERROR(corruption_detected);
308
+ if (huffWeight[n] > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
303
309
  rankStats[huffWeight[n]]++;
304
310
  weightTotal += (1 << huffWeight[n]) >> 1;
305
311
  } }
@@ -337,7 +343,7 @@ static size_t HUF_readStats_body_default(BYTE* huffWeight, size_t hwSize, U32* r
337
343
  }
338
344
 
339
345
  #if DYNAMIC_BMI2
340
- static TARGET_ATTRIBUTE("bmi2") size_t HUF_readStats_body_bmi2(BYTE* huffWeight, size_t hwSize, U32* rankStats,
346
+ static BMI2_TARGET_ATTRIBUTE size_t HUF_readStats_body_bmi2(BYTE* huffWeight, size_t hwSize, U32* rankStats,
341
347
  U32* nbSymbolsPtr, U32* tableLogPtr,
342
348
  const void* src, size_t srcSize,
343
349
  void* workSpace, size_t wkspSize)
@@ -22,6 +22,8 @@ extern "C" {
22
22
  * Dependencies
23
23
  ******************************************/
24
24
  #include "../zstd_errors.h" /* enum list */
25
+ #include "compiler.h"
26
+ #include "debug.h"
25
27
  #include "zstd_deps.h" /* size_t */
26
28
 
27
29
 
@@ -73,6 +75,83 @@ ERR_STATIC const char* ERR_getErrorName(size_t code)
73
75
  return ERR_getErrorString(ERR_getErrorCode(code));
74
76
  }
75
77
 
78
+ /**
79
+ * Ignore: this is an internal helper.
80
+ *
81
+ * This is a helper function to help force C99-correctness during compilation.
82
+ * Under strict compilation modes, variadic macro arguments can't be empty.
83
+ * However, variadic function arguments can be. Using a function therefore lets
84
+ * us statically check that at least one (string) argument was passed,
85
+ * independent of the compilation flags.
86
+ */
87
+ static INLINE_KEYWORD UNUSED_ATTR
88
+ void _force_has_format_string(const char *format, ...) {
89
+ (void)format;
90
+ }
91
+
92
+ /**
93
+ * Ignore: this is an internal helper.
94
+ *
95
+ * We want to force this function invocation to be syntactically correct, but
96
+ * we don't want to force runtime evaluation of its arguments.
97
+ */
98
+ #define _FORCE_HAS_FORMAT_STRING(...) \
99
+ if (0) { \
100
+ _force_has_format_string(__VA_ARGS__); \
101
+ }
102
+
103
+ #define ERR_QUOTE(str) #str
104
+
105
+ /**
106
+ * Return the specified error if the condition evaluates to true.
107
+ *
108
+ * In debug modes, prints additional information.
109
+ * In order to do that (particularly, printing the conditional that failed),
110
+ * this can't just wrap RETURN_ERROR().
111
+ */
112
+ #define RETURN_ERROR_IF(cond, err, ...) \
113
+ if (cond) { \
114
+ RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", \
115
+ __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
116
+ _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
117
+ RAWLOG(3, ": " __VA_ARGS__); \
118
+ RAWLOG(3, "\n"); \
119
+ return ERROR(err); \
120
+ }
121
+
122
+ /**
123
+ * Unconditionally return the specified error.
124
+ *
125
+ * In debug modes, prints additional information.
126
+ */
127
+ #define RETURN_ERROR(err, ...) \
128
+ do { \
129
+ RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
130
+ __FILE__, __LINE__, ERR_QUOTE(ERROR(err))); \
131
+ _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
132
+ RAWLOG(3, ": " __VA_ARGS__); \
133
+ RAWLOG(3, "\n"); \
134
+ return ERROR(err); \
135
+ } while(0);
136
+
137
+ /**
138
+ * If the provided expression evaluates to an error code, returns that error code.
139
+ *
140
+ * In debug modes, prints additional information.
141
+ */
142
+ #define FORWARD_IF_ERROR(err, ...) \
143
+ do { \
144
+ size_t const err_code = (err); \
145
+ if (ERR_isError(err_code)) { \
146
+ RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", \
147
+ __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
148
+ _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
149
+ RAWLOG(3, ": " __VA_ARGS__); \
150
+ RAWLOG(3, "\n"); \
151
+ return err_code; \
152
+ } \
153
+ } while(0);
154
+
76
155
  #if defined (__cplusplus)
77
156
  }
78
157
  #endif
@@ -336,8 +336,9 @@ size_t FSE_buildCTable_rle (FSE_CTable* ct, unsigned char symbolValue);
336
336
  /* FSE_buildCTable_wksp() :
337
337
  * Same as FSE_buildCTable(), but using an externally allocated scratch buffer (`workSpace`).
338
338
  * `wkspSize` must be >= `FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog)` of `unsigned`.
339
+ * See FSE_buildCTable_wksp() for breakdown of workspace usage.
339
340
  */
340
- #define FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog) (maxSymbolValue + 2 + (1ull << (tableLog - 2)))
341
+ #define FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog) (((maxSymbolValue + 2) + (1ull << (tableLog)))/2 + sizeof(U64)/sizeof(U32) /* additional 8 bytes for potential table overwrite */)
341
342
  #define FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) (sizeof(unsigned) * FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog))
342
343
  size_t FSE_buildCTable_wksp(FSE_CTable* ct, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
343
344
 
@@ -365,7 +365,7 @@ static size_t FSE_decompress_wksp_body_default(void* dst, size_t dstCapacity, co
365
365
  }
366
366
 
367
367
  #if DYNAMIC_BMI2
368
- TARGET_ATTRIBUTE("bmi2") static size_t FSE_decompress_wksp_body_bmi2(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize)
368
+ BMI2_TARGET_ATTRIBUTE static size_t FSE_decompress_wksp_body_bmi2(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize)
369
369
  {
370
370
  return FSE_decompress_wksp_body(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, 1);
371
371
  }
@@ -89,9 +89,9 @@ HUF_PUBLIC_API size_t HUF_compress2 (void* dst, size_t dstCapacity,
89
89
 
90
90
  /** HUF_compress4X_wksp() :
91
91
  * Same as HUF_compress2(), but uses externally allocated `workSpace`.
92
- * `workspace` must have minimum alignment of 4, and be at least as large as HUF_WORKSPACE_SIZE */
93
- #define HUF_WORKSPACE_SIZE ((6 << 10) + 256)
94
- #define HUF_WORKSPACE_SIZE_U32 (HUF_WORKSPACE_SIZE / sizeof(U32))
92
+ * `workspace` must be at least as large as HUF_WORKSPACE_SIZE */
93
+ #define HUF_WORKSPACE_SIZE ((8 << 10) + 512 /* sorting scratch space */)
94
+ #define HUF_WORKSPACE_SIZE_U64 (HUF_WORKSPACE_SIZE / sizeof(U64))
95
95
  HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity,
96
96
  const void* src, size_t srcSize,
97
97
  unsigned maxSymbolValue, unsigned tableLog,
@@ -116,11 +116,11 @@ HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity,
116
116
 
117
117
 
118
118
  /* *** Constants *** */
119
- #define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */
119
+ #define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
120
120
  #define HUF_TABLELOG_DEFAULT 11 /* default tableLog value when none specified */
121
121
  #define HUF_SYMBOLVALUE_MAX 255
122
122
 
123
- #define HUF_TABLELOG_ABSOLUTEMAX 15 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */
123
+ #define HUF_TABLELOG_ABSOLUTEMAX 12 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */
124
124
  #if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX)
125
125
  # error "HUF_TABLELOG_MAX is too large !"
126
126
  #endif
@@ -136,15 +136,11 @@ HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity,
136
136
 
137
137
  /* static allocation of HUF's Compression Table */
138
138
  /* this is a private definition, just exposed for allocation and strict aliasing purpose. never EVER access its members directly */
139
- struct HUF_CElt_s {
140
- U16 val;
141
- BYTE nbBits;
142
- }; /* typedef'd to HUF_CElt */
143
- typedef struct HUF_CElt_s HUF_CElt; /* consider it an incomplete type */
144
- #define HUF_CTABLE_SIZE_U32(maxSymbolValue) ((maxSymbolValue)+1) /* Use tables of U32, for proper alignment */
145
- #define HUF_CTABLE_SIZE(maxSymbolValue) (HUF_CTABLE_SIZE_U32(maxSymbolValue) * sizeof(U32))
139
+ typedef size_t HUF_CElt; /* consider it an incomplete type */
140
+ #define HUF_CTABLE_SIZE_ST(maxSymbolValue) ((maxSymbolValue)+2) /* Use tables of size_t, for proper alignment */
141
+ #define HUF_CTABLE_SIZE(maxSymbolValue) (HUF_CTABLE_SIZE_ST(maxSymbolValue) * sizeof(size_t))
146
142
  #define HUF_CREATE_STATIC_CTABLE(name, maxSymbolValue) \
147
- HUF_CElt name[HUF_CTABLE_SIZE_U32(maxSymbolValue)] /* no final ; */
143
+ HUF_CElt name[HUF_CTABLE_SIZE_ST(maxSymbolValue)] /* no final ; */
148
144
 
149
145
  /* static allocation of HUF's DTable */
150
146
  typedef U32 HUF_DTable;
@@ -194,6 +190,7 @@ size_t HUF_buildCTable (HUF_CElt* CTable, const unsigned* count, unsigned maxSym
194
190
  size_t HUF_writeCTable (void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog);
195
191
  size_t HUF_writeCTable_wksp(void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog, void* workspace, size_t workspaceSize);
196
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);
197
194
  size_t HUF_estimateCompressedSize(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue);
198
195
  int HUF_validateCTable(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue);
199
196
 
@@ -206,12 +203,13 @@ typedef enum {
206
203
  * Same as HUF_compress4X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
207
204
  * If it uses hufTable it does not modify hufTable or repeat.
208
205
  * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
209
- * If preferRepeat then the old table will always be used if valid. */
206
+ * If preferRepeat then the old table will always be used if valid.
207
+ * If suspectUncompressible then some sampling checks will be run to potentially skip huffman coding */
210
208
  size_t HUF_compress4X_repeat(void* dst, size_t dstSize,
211
209
  const void* src, size_t srcSize,
212
210
  unsigned maxSymbolValue, unsigned tableLog,
213
211
  void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */
214
- HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2);
212
+ HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2, unsigned suspectUncompressible);
215
213
 
216
214
  /** HUF_buildCTable_wksp() :
217
215
  * Same as HUF_buildCTable(), but using externally allocated scratch buffer.
@@ -249,11 +247,10 @@ size_t HUF_readStats_wksp(BYTE* huffWeight, size_t hwSize,
249
247
  * Loading a CTable saved with HUF_writeCTable() */
250
248
  size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize, unsigned *hasZeroWeights);
251
249
 
252
- /** HUF_getNbBits() :
250
+ /** HUF_getNbBitsFromCTable() :
253
251
  * Read nbBits from CTable symbolTable, for symbol `symbolValue` presumed <= HUF_SYMBOLVALUE_MAX
254
- * Note 1 : is not inlined, as HUF_CElt definition is private
255
- * Note 2 : const void* used, so that it can provide a statically allocated table as argument (which uses type U32) */
256
- U32 HUF_getNbBits(const void* symbolTable, U32 symbolValue);
252
+ * Note 1 : is not inlined, as HUF_CElt definition is private */
253
+ U32 HUF_getNbBitsFromCTable(const HUF_CElt* symbolTable, U32 symbolValue);
257
254
 
258
255
  /*
259
256
  * HUF_decompress() does the following:
@@ -305,18 +302,20 @@ size_t HUF_decompress4X2_usingDTable(void* dst, size_t maxDstSize, const void* c
305
302
  /* ====================== */
306
303
 
307
304
  size_t HUF_compress1X (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog);
308
- 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_U32 unsigned */
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 */
309
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);
310
308
  /** HUF_compress1X_repeat() :
311
309
  * Same as HUF_compress1X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
312
310
  * If it uses hufTable it does not modify hufTable or repeat.
313
311
  * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
314
- * If preferRepeat then the old table will always be used if valid. */
312
+ * If preferRepeat then the old table will always be used if valid.
313
+ * If suspectUncompressible then some sampling checks will be run to potentially skip huffman coding */
315
314
  size_t HUF_compress1X_repeat(void* dst, size_t dstSize,
316
315
  const void* src, size_t srcSize,
317
316
  unsigned maxSymbolValue, unsigned tableLog,
318
317
  void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */
319
- HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2);
318
+ HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2, unsigned suspectUncompressible);
320
319
 
321
320
  size_t HUF_decompress1X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* single-symbol decoder */
322
321
  #ifndef HUF_FORCE_DECOMPRESS_X1
@@ -354,6 +353,9 @@ size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t ds
354
353
  #ifndef HUF_FORCE_DECOMPRESS_X2
355
354
  size_t HUF_readDTableX1_wksp_bmi2(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int bmi2);
356
355
  #endif
356
+ #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);
358
+ #endif
357
359
 
358
360
  #endif /* HUF_STATIC_LINKING_ONLY */
359
361