zstdlib 0.1.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES.md +9 -0
  3. data/Gemfile +3 -0
  4. data/README.md +96 -0
  5. data/Rakefile +29 -0
  6. data/ext/zstdlib/extconf.rb +53 -0
  7. data/ext/zstdlib/ruby/zlib-2.2/zlib.c +4659 -0
  8. data/ext/zstdlib/ruby/zlib-2.3/zlib.c +4686 -0
  9. data/ext/zstdlib/ruby/zlib-2.4/zlib.c +4843 -0
  10. data/ext/zstdlib/ruby/zlib-2.5/zlib.c +4848 -0
  11. data/ext/zstdlib/ruby/zlib-2.6/zlib.c +4890 -0
  12. data/ext/zstdlib/zlib-1.2.11/adler32.c +186 -0
  13. data/ext/zstdlib/zlib-1.2.11/compress.c +86 -0
  14. data/ext/zstdlib/zlib-1.2.11/crc32.c +442 -0
  15. data/ext/zstdlib/zlib-1.2.11/crc32.h +441 -0
  16. data/ext/zstdlib/zlib-1.2.11/deflate.c +2163 -0
  17. data/ext/zstdlib/zlib-1.2.11/deflate.h +349 -0
  18. data/ext/zstdlib/zlib-1.2.11/gzclose.c +25 -0
  19. data/ext/zstdlib/zlib-1.2.11/gzguts.h +218 -0
  20. data/ext/zstdlib/zlib-1.2.11/gzlib.c +637 -0
  21. data/ext/zstdlib/zlib-1.2.11/gzread.c +654 -0
  22. data/ext/zstdlib/zlib-1.2.11/gzwrite.c +665 -0
  23. data/ext/zstdlib/zlib-1.2.11/infback.c +640 -0
  24. data/ext/zstdlib/zlib-1.2.11/inffast.c +323 -0
  25. data/ext/zstdlib/zlib-1.2.11/inffast.h +11 -0
  26. data/ext/zstdlib/zlib-1.2.11/inffixed.h +94 -0
  27. data/ext/zstdlib/zlib-1.2.11/inflate.c +1561 -0
  28. data/ext/zstdlib/zlib-1.2.11/inflate.h +125 -0
  29. data/ext/zstdlib/zlib-1.2.11/inftrees.c +304 -0
  30. data/ext/zstdlib/zlib-1.2.11/inftrees.h +62 -0
  31. data/ext/zstdlib/zlib-1.2.11/trees.c +1203 -0
  32. data/ext/zstdlib/zlib-1.2.11/trees.h +128 -0
  33. data/ext/zstdlib/zlib-1.2.11/uncompr.c +93 -0
  34. data/ext/zstdlib/zlib-1.2.11/zconf.h +534 -0
  35. data/ext/zstdlib/zlib-1.2.11/zlib.h +1912 -0
  36. data/ext/zstdlib/zlib-1.2.11/zutil.c +325 -0
  37. data/ext/zstdlib/zlib-1.2.11/zutil.h +271 -0
  38. data/ext/zstdlib/zlib.mk +14 -0
  39. data/ext/zstdlib/zlibwrapper.mk +14 -0
  40. data/ext/zstdlib/zlibwrapper/zlibwrapper.c +14 -0
  41. data/ext/zstdlib/zstd-1.3.8/lib/common/bitstream.h +455 -0
  42. data/ext/zstdlib/zstd-1.3.8/lib/common/compiler.h +140 -0
  43. data/ext/zstdlib/zstd-1.3.8/lib/common/cpu.h +215 -0
  44. data/ext/zstdlib/zstd-1.3.8/lib/common/debug.c +44 -0
  45. data/ext/zstdlib/zstd-1.3.8/lib/common/debug.h +134 -0
  46. data/ext/zstdlib/zstd-1.3.8/lib/common/entropy_common.c +236 -0
  47. data/ext/zstdlib/zstd-1.3.8/lib/common/error_private.c +54 -0
  48. data/ext/zstdlib/zstd-1.3.8/lib/common/error_private.h +76 -0
  49. data/ext/zstdlib/zstd-1.3.8/lib/common/fse.h +708 -0
  50. data/ext/zstdlib/zstd-1.3.8/lib/common/fse_decompress.c +309 -0
  51. data/ext/zstdlib/zstd-1.3.8/lib/common/huf.h +358 -0
  52. data/ext/zstdlib/zstd-1.3.8/lib/common/mem.h +380 -0
  53. data/ext/zstdlib/zstd-1.3.8/lib/common/pool.c +340 -0
  54. data/ext/zstdlib/zstd-1.3.8/lib/common/pool.h +84 -0
  55. data/ext/zstdlib/zstd-1.3.8/lib/common/threading.c +75 -0
  56. data/ext/zstdlib/zstd-1.3.8/lib/common/threading.h +123 -0
  57. data/ext/zstdlib/zstd-1.3.8/lib/common/xxhash.c +876 -0
  58. data/ext/zstdlib/zstd-1.3.8/lib/common/xxhash.h +305 -0
  59. data/ext/zstdlib/zstd-1.3.8/lib/common/zstd_common.c +83 -0
  60. data/ext/zstdlib/zstd-1.3.8/lib/common/zstd_errors.h +93 -0
  61. data/ext/zstdlib/zstd-1.3.8/lib/common/zstd_internal.h +266 -0
  62. data/ext/zstdlib/zstd-1.3.8/lib/compress/fse_compress.c +721 -0
  63. data/ext/zstdlib/zstd-1.3.8/lib/compress/hist.c +203 -0
  64. data/ext/zstdlib/zstd-1.3.8/lib/compress/hist.h +95 -0
  65. data/ext/zstdlib/zstd-1.3.8/lib/compress/huf_compress.c +798 -0
  66. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_compress.c +4290 -0
  67. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_compress_internal.h +860 -0
  68. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_double_fast.c +499 -0
  69. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_double_fast.h +38 -0
  70. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_fast.c +391 -0
  71. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_fast.h +37 -0
  72. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_lazy.c +1106 -0
  73. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_lazy.h +67 -0
  74. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_ldm.c +597 -0
  75. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_ldm.h +105 -0
  76. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_opt.c +1217 -0
  77. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstd_opt.h +56 -0
  78. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstdmt_compress.c +2107 -0
  79. data/ext/zstdlib/zstd-1.3.8/lib/compress/zstdmt_compress.h +174 -0
  80. data/ext/zstdlib/zstd-1.3.8/lib/decompress/huf_decompress.c +1232 -0
  81. data/ext/zstdlib/zstd-1.3.8/lib/decompress/zstd_ddict.c +240 -0
  82. data/ext/zstdlib/zstd-1.3.8/lib/decompress/zstd_ddict.h +44 -0
  83. data/ext/zstdlib/zstd-1.3.8/lib/decompress/zstd_decompress.c +1672 -0
  84. data/ext/zstdlib/zstd-1.3.8/lib/decompress/zstd_decompress_block.c +1307 -0
  85. data/ext/zstdlib/zstd-1.3.8/lib/decompress/zstd_decompress_block.h +59 -0
  86. data/ext/zstdlib/zstd-1.3.8/lib/decompress/zstd_decompress_internal.h +168 -0
  87. data/ext/zstdlib/zstd-1.3.8/lib/zstd.h +1766 -0
  88. data/ext/zstdlib/zstd-1.3.8/zlibWrapper/gzclose.c +28 -0
  89. data/ext/zstdlib/zstd-1.3.8/zlibWrapper/gzcompatibility.h +68 -0
  90. data/ext/zstdlib/zstd-1.3.8/zlibWrapper/gzguts.h +227 -0
  91. data/ext/zstdlib/zstd-1.3.8/zlibWrapper/gzlib.c +640 -0
  92. data/ext/zstdlib/zstd-1.3.8/zlibWrapper/gzread.c +670 -0
  93. data/ext/zstdlib/zstd-1.3.8/zlibWrapper/gzwrite.c +671 -0
  94. data/ext/zstdlib/zstd-1.3.8/zlibWrapper/zstd_zlibwrapper.c +1105 -0
  95. data/ext/zstdlib/zstd-1.3.8/zlibWrapper/zstd_zlibwrapper.h +88 -0
  96. data/ext/zstdlib/zstd.mk +14 -0
  97. data/lib/2.2/zstdlib.so +0 -0
  98. data/lib/2.3/zstdlib.so +0 -0
  99. data/lib/2.4/zstdlib.so +0 -0
  100. data/lib/2.5/zstdlib.so +0 -0
  101. data/lib/2.6/zstdlib.so +0 -0
  102. data/lib/zstdlib.rb +6 -0
  103. data/test/zstdlib_test.rb +21 -0
  104. metadata +205 -0
@@ -0,0 +1,309 @@
1
+ /* ******************************************************************
2
+ FSE : Finite State Entropy decoder
3
+ Copyright (C) 2013-2015, Yann Collet.
4
+
5
+ BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are
9
+ met:
10
+
11
+ * Redistributions of source code must retain the above copyright
12
+ notice, this list of conditions and the following disclaimer.
13
+ * Redistributions in binary form must reproduce the above
14
+ copyright notice, this list of conditions and the following disclaimer
15
+ in the documentation and/or other materials provided with the
16
+ distribution.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ You can contact the author at :
31
+ - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy
32
+ - Public forum : https://groups.google.com/forum/#!forum/lz4c
33
+ ****************************************************************** */
34
+
35
+
36
+ /* **************************************************************
37
+ * Includes
38
+ ****************************************************************/
39
+ #include <stdlib.h> /* malloc, free, qsort */
40
+ #include <string.h> /* memcpy, memset */
41
+ #include "bitstream.h"
42
+ #include "compiler.h"
43
+ #define FSE_STATIC_LINKING_ONLY
44
+ #include "fse.h"
45
+ #include "error_private.h"
46
+
47
+
48
+ /* **************************************************************
49
+ * Error Management
50
+ ****************************************************************/
51
+ #define FSE_isError ERR_isError
52
+ #define FSE_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c) /* use only *after* variable declarations */
53
+
54
+ /* check and forward error code */
55
+ #define CHECK_F(f) { size_t const e = f; if (FSE_isError(e)) return e; }
56
+
57
+
58
+ /* **************************************************************
59
+ * Templates
60
+ ****************************************************************/
61
+ /*
62
+ designed to be included
63
+ for type-specific functions (template emulation in C)
64
+ Objective is to write these functions only once, for improved maintenance
65
+ */
66
+
67
+ /* safety checks */
68
+ #ifndef FSE_FUNCTION_EXTENSION
69
+ # error "FSE_FUNCTION_EXTENSION must be defined"
70
+ #endif
71
+ #ifndef FSE_FUNCTION_TYPE
72
+ # error "FSE_FUNCTION_TYPE must be defined"
73
+ #endif
74
+
75
+ /* Function names */
76
+ #define FSE_CAT(X,Y) X##Y
77
+ #define FSE_FUNCTION_NAME(X,Y) FSE_CAT(X,Y)
78
+ #define FSE_TYPE_NAME(X,Y) FSE_CAT(X,Y)
79
+
80
+
81
+ /* Function templates */
82
+ FSE_DTable* FSE_createDTable (unsigned tableLog)
83
+ {
84
+ if (tableLog > FSE_TABLELOG_ABSOLUTE_MAX) tableLog = FSE_TABLELOG_ABSOLUTE_MAX;
85
+ return (FSE_DTable*)malloc( FSE_DTABLE_SIZE_U32(tableLog) * sizeof (U32) );
86
+ }
87
+
88
+ void FSE_freeDTable (FSE_DTable* dt)
89
+ {
90
+ free(dt);
91
+ }
92
+
93
+ size_t FSE_buildDTable(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog)
94
+ {
95
+ void* const tdPtr = dt+1; /* because *dt is unsigned, 32-bits aligned on 32-bits */
96
+ FSE_DECODE_TYPE* const tableDecode = (FSE_DECODE_TYPE*) (tdPtr);
97
+ U16 symbolNext[FSE_MAX_SYMBOL_VALUE+1];
98
+
99
+ U32 const maxSV1 = maxSymbolValue + 1;
100
+ U32 const tableSize = 1 << tableLog;
101
+ U32 highThreshold = tableSize-1;
102
+
103
+ /* Sanity Checks */
104
+ if (maxSymbolValue > FSE_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge);
105
+ if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
106
+
107
+ /* Init, lay down lowprob symbols */
108
+ { FSE_DTableHeader DTableH;
109
+ DTableH.tableLog = (U16)tableLog;
110
+ DTableH.fastMode = 1;
111
+ { S16 const largeLimit= (S16)(1 << (tableLog-1));
112
+ U32 s;
113
+ for (s=0; s<maxSV1; s++) {
114
+ if (normalizedCounter[s]==-1) {
115
+ tableDecode[highThreshold--].symbol = (FSE_FUNCTION_TYPE)s;
116
+ symbolNext[s] = 1;
117
+ } else {
118
+ if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
119
+ symbolNext[s] = normalizedCounter[s];
120
+ } } }
121
+ memcpy(dt, &DTableH, sizeof(DTableH));
122
+ }
123
+
124
+ /* Spread symbols */
125
+ { U32 const tableMask = tableSize-1;
126
+ U32 const step = FSE_TABLESTEP(tableSize);
127
+ U32 s, position = 0;
128
+ for (s=0; s<maxSV1; s++) {
129
+ int i;
130
+ for (i=0; i<normalizedCounter[s]; i++) {
131
+ tableDecode[position].symbol = (FSE_FUNCTION_TYPE)s;
132
+ position = (position + step) & tableMask;
133
+ while (position > highThreshold) position = (position + step) & tableMask; /* lowprob area */
134
+ } }
135
+ if (position!=0) return ERROR(GENERIC); /* position must reach all cells once, otherwise normalizedCounter is incorrect */
136
+ }
137
+
138
+ /* Build Decoding table */
139
+ { U32 u;
140
+ for (u=0; u<tableSize; u++) {
141
+ FSE_FUNCTION_TYPE const symbol = (FSE_FUNCTION_TYPE)(tableDecode[u].symbol);
142
+ U32 const nextState = symbolNext[symbol]++;
143
+ tableDecode[u].nbBits = (BYTE) (tableLog - BIT_highbit32(nextState) );
144
+ tableDecode[u].newState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
145
+ } }
146
+
147
+ return 0;
148
+ }
149
+
150
+
151
+ #ifndef FSE_COMMONDEFS_ONLY
152
+
153
+ /*-*******************************************************
154
+ * Decompression (Byte symbols)
155
+ *********************************************************/
156
+ size_t FSE_buildDTable_rle (FSE_DTable* dt, BYTE symbolValue)
157
+ {
158
+ void* ptr = dt;
159
+ FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr;
160
+ void* dPtr = dt + 1;
161
+ FSE_decode_t* const cell = (FSE_decode_t*)dPtr;
162
+
163
+ DTableH->tableLog = 0;
164
+ DTableH->fastMode = 0;
165
+
166
+ cell->newState = 0;
167
+ cell->symbol = symbolValue;
168
+ cell->nbBits = 0;
169
+
170
+ return 0;
171
+ }
172
+
173
+
174
+ size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits)
175
+ {
176
+ void* ptr = dt;
177
+ FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr;
178
+ void* dPtr = dt + 1;
179
+ FSE_decode_t* const dinfo = (FSE_decode_t*)dPtr;
180
+ const unsigned tableSize = 1 << nbBits;
181
+ const unsigned tableMask = tableSize - 1;
182
+ const unsigned maxSV1 = tableMask+1;
183
+ unsigned s;
184
+
185
+ /* Sanity checks */
186
+ if (nbBits < 1) return ERROR(GENERIC); /* min size */
187
+
188
+ /* Build Decoding Table */
189
+ DTableH->tableLog = (U16)nbBits;
190
+ DTableH->fastMode = 1;
191
+ for (s=0; s<maxSV1; s++) {
192
+ dinfo[s].newState = 0;
193
+ dinfo[s].symbol = (BYTE)s;
194
+ dinfo[s].nbBits = (BYTE)nbBits;
195
+ }
196
+
197
+ return 0;
198
+ }
199
+
200
+ FORCE_INLINE_TEMPLATE size_t FSE_decompress_usingDTable_generic(
201
+ void* dst, size_t maxDstSize,
202
+ const void* cSrc, size_t cSrcSize,
203
+ const FSE_DTable* dt, const unsigned fast)
204
+ {
205
+ BYTE* const ostart = (BYTE*) dst;
206
+ BYTE* op = ostart;
207
+ BYTE* const omax = op + maxDstSize;
208
+ BYTE* const olimit = omax-3;
209
+
210
+ BIT_DStream_t bitD;
211
+ FSE_DState_t state1;
212
+ FSE_DState_t state2;
213
+
214
+ /* Init */
215
+ CHECK_F(BIT_initDStream(&bitD, cSrc, cSrcSize));
216
+
217
+ FSE_initDState(&state1, &bitD, dt);
218
+ FSE_initDState(&state2, &bitD, dt);
219
+
220
+ #define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
221
+
222
+ /* 4 symbols per loop */
223
+ for ( ; (BIT_reloadDStream(&bitD)==BIT_DStream_unfinished) & (op<olimit) ; op+=4) {
224
+ op[0] = FSE_GETSYMBOL(&state1);
225
+
226
+ if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */
227
+ BIT_reloadDStream(&bitD);
228
+
229
+ op[1] = FSE_GETSYMBOL(&state2);
230
+
231
+ if (FSE_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */
232
+ { if (BIT_reloadDStream(&bitD) > BIT_DStream_unfinished) { op+=2; break; } }
233
+
234
+ op[2] = FSE_GETSYMBOL(&state1);
235
+
236
+ if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */
237
+ BIT_reloadDStream(&bitD);
238
+
239
+ op[3] = FSE_GETSYMBOL(&state2);
240
+ }
241
+
242
+ /* tail */
243
+ /* note : BIT_reloadDStream(&bitD) >= FSE_DStream_partiallyFilled; Ends at exactly BIT_DStream_completed */
244
+ while (1) {
245
+ if (op>(omax-2)) return ERROR(dstSize_tooSmall);
246
+ *op++ = FSE_GETSYMBOL(&state1);
247
+ if (BIT_reloadDStream(&bitD)==BIT_DStream_overflow) {
248
+ *op++ = FSE_GETSYMBOL(&state2);
249
+ break;
250
+ }
251
+
252
+ if (op>(omax-2)) return ERROR(dstSize_tooSmall);
253
+ *op++ = FSE_GETSYMBOL(&state2);
254
+ if (BIT_reloadDStream(&bitD)==BIT_DStream_overflow) {
255
+ *op++ = FSE_GETSYMBOL(&state1);
256
+ break;
257
+ } }
258
+
259
+ return op-ostart;
260
+ }
261
+
262
+
263
+ size_t FSE_decompress_usingDTable(void* dst, size_t originalSize,
264
+ const void* cSrc, size_t cSrcSize,
265
+ const FSE_DTable* dt)
266
+ {
267
+ const void* ptr = dt;
268
+ const FSE_DTableHeader* DTableH = (const FSE_DTableHeader*)ptr;
269
+ const U32 fastMode = DTableH->fastMode;
270
+
271
+ /* select fast mode (static) */
272
+ if (fastMode) return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 1);
273
+ return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0);
274
+ }
275
+
276
+
277
+ size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, FSE_DTable* workSpace, unsigned maxLog)
278
+ {
279
+ const BYTE* const istart = (const BYTE*)cSrc;
280
+ const BYTE* ip = istart;
281
+ short counting[FSE_MAX_SYMBOL_VALUE+1];
282
+ unsigned tableLog;
283
+ unsigned maxSymbolValue = FSE_MAX_SYMBOL_VALUE;
284
+
285
+ /* normal FSE decoding mode */
286
+ size_t const NCountLength = FSE_readNCount (counting, &maxSymbolValue, &tableLog, istart, cSrcSize);
287
+ if (FSE_isError(NCountLength)) return NCountLength;
288
+ //if (NCountLength >= cSrcSize) return ERROR(srcSize_wrong); /* too small input size; supposed to be already checked in NCountLength, only remaining case : NCountLength==cSrcSize */
289
+ if (tableLog > maxLog) return ERROR(tableLog_tooLarge);
290
+ ip += NCountLength;
291
+ cSrcSize -= NCountLength;
292
+
293
+ CHECK_F( FSE_buildDTable (workSpace, counting, maxSymbolValue, tableLog) );
294
+
295
+ return FSE_decompress_usingDTable (dst, dstCapacity, ip, cSrcSize, workSpace); /* always return, even if it is an error code */
296
+ }
297
+
298
+
299
+ typedef FSE_DTable DTable_max_t[FSE_DTABLE_SIZE_U32(FSE_MAX_TABLELOG)];
300
+
301
+ size_t FSE_decompress(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize)
302
+ {
303
+ DTable_max_t dt; /* Static analyzer seems unable to understand this table will be properly initialized later */
304
+ return FSE_decompress_wksp(dst, dstCapacity, cSrc, cSrcSize, dt, FSE_MAX_TABLELOG);
305
+ }
306
+
307
+
308
+
309
+ #endif /* FSE_COMMONDEFS_ONLY */
@@ -0,0 +1,358 @@
1
+ /* ******************************************************************
2
+ huff0 huffman codec,
3
+ part of Finite State Entropy library
4
+ Copyright (C) 2013-present, Yann Collet.
5
+
6
+ BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
7
+
8
+ Redistribution and use in source and binary forms, with or without
9
+ modification, are permitted provided that the following conditions are
10
+ met:
11
+
12
+ * Redistributions of source code must retain the above copyright
13
+ notice, this list of conditions and the following disclaimer.
14
+ * Redistributions in binary form must reproduce the above
15
+ copyright notice, this list of conditions and the following disclaimer
16
+ in the documentation and/or other materials provided with the
17
+ distribution.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ You can contact the author at :
32
+ - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
33
+ ****************************************************************** */
34
+
35
+ #if defined (__cplusplus)
36
+ extern "C" {
37
+ #endif
38
+
39
+ #ifndef HUF_H_298734234
40
+ #define HUF_H_298734234
41
+
42
+ /* *** Dependencies *** */
43
+ #include <stddef.h> /* size_t */
44
+
45
+
46
+ /* *** library symbols visibility *** */
47
+ /* Note : when linking with -fvisibility=hidden on gcc, or by default on Visual,
48
+ * HUF symbols remain "private" (internal symbols for library only).
49
+ * Set macro FSE_DLL_EXPORT to 1 if you want HUF symbols visible on DLL interface */
50
+ #if defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) && defined(__GNUC__) && (__GNUC__ >= 4)
51
+ # define HUF_PUBLIC_API __attribute__ ((visibility ("default")))
52
+ #elif defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) /* Visual expected */
53
+ # define HUF_PUBLIC_API __declspec(dllexport)
54
+ #elif defined(FSE_DLL_IMPORT) && (FSE_DLL_IMPORT==1)
55
+ # define HUF_PUBLIC_API __declspec(dllimport) /* not required, just to generate faster code (saves a function pointer load from IAT and an indirect jump) */
56
+ #else
57
+ # define HUF_PUBLIC_API
58
+ #endif
59
+
60
+
61
+ /* ========================== */
62
+ /* *** simple functions *** */
63
+ /* ========================== */
64
+
65
+ /** HUF_compress() :
66
+ * Compress content from buffer 'src', of size 'srcSize', into buffer 'dst'.
67
+ * 'dst' buffer must be already allocated.
68
+ * Compression runs faster if `dstCapacity` >= HUF_compressBound(srcSize).
69
+ * `srcSize` must be <= `HUF_BLOCKSIZE_MAX` == 128 KB.
70
+ * @return : size of compressed data (<= `dstCapacity`).
71
+ * Special values : if return == 0, srcData is not compressible => Nothing is stored within dst !!!
72
+ * if HUF_isError(return), compression failed (more details using HUF_getErrorName())
73
+ */
74
+ HUF_PUBLIC_API size_t HUF_compress(void* dst, size_t dstCapacity,
75
+ const void* src, size_t srcSize);
76
+
77
+ /** HUF_decompress() :
78
+ * Decompress HUF data from buffer 'cSrc', of size 'cSrcSize',
79
+ * into already allocated buffer 'dst', of minimum size 'dstSize'.
80
+ * `originalSize` : **must** be the ***exact*** size of original (uncompressed) data.
81
+ * Note : in contrast with FSE, HUF_decompress can regenerate
82
+ * RLE (cSrcSize==1) and uncompressed (cSrcSize==dstSize) data,
83
+ * because it knows size to regenerate (originalSize).
84
+ * @return : size of regenerated data (== originalSize),
85
+ * or an error code, which can be tested using HUF_isError()
86
+ */
87
+ HUF_PUBLIC_API size_t HUF_decompress(void* dst, size_t originalSize,
88
+ const void* cSrc, size_t cSrcSize);
89
+
90
+
91
+ /* *** Tool functions *** */
92
+ #define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */
93
+ HUF_PUBLIC_API size_t HUF_compressBound(size_t size); /**< maximum compressed size (worst case) */
94
+
95
+ /* Error Management */
96
+ HUF_PUBLIC_API unsigned HUF_isError(size_t code); /**< tells if a return value is an error code */
97
+ HUF_PUBLIC_API const char* HUF_getErrorName(size_t code); /**< provides error code string (useful for debugging) */
98
+
99
+
100
+ /* *** Advanced function *** */
101
+
102
+ /** HUF_compress2() :
103
+ * Same as HUF_compress(), but offers control over `maxSymbolValue` and `tableLog`.
104
+ * `maxSymbolValue` must be <= HUF_SYMBOLVALUE_MAX .
105
+ * `tableLog` must be `<= HUF_TABLELOG_MAX` . */
106
+ HUF_PUBLIC_API size_t HUF_compress2 (void* dst, size_t dstCapacity,
107
+ const void* src, size_t srcSize,
108
+ unsigned maxSymbolValue, unsigned tableLog);
109
+
110
+ /** HUF_compress4X_wksp() :
111
+ * Same as HUF_compress2(), but uses externally allocated `workSpace`.
112
+ * `workspace` must have minimum alignment of 4, and be at least as large as HUF_WORKSPACE_SIZE */
113
+ #define HUF_WORKSPACE_SIZE (6 << 10)
114
+ #define HUF_WORKSPACE_SIZE_U32 (HUF_WORKSPACE_SIZE / sizeof(U32))
115
+ HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity,
116
+ const void* src, size_t srcSize,
117
+ unsigned maxSymbolValue, unsigned tableLog,
118
+ void* workSpace, size_t wkspSize);
119
+
120
+ #endif /* HUF_H_298734234 */
121
+
122
+ /* ******************************************************************
123
+ * WARNING !!
124
+ * The following section contains advanced and experimental definitions
125
+ * which shall never be used in the context of a dynamic library,
126
+ * because they are not guaranteed to remain stable in the future.
127
+ * Only consider them in association with static linking.
128
+ * *****************************************************************/
129
+ #if defined(HUF_STATIC_LINKING_ONLY) && !defined(HUF_H_HUF_STATIC_LINKING_ONLY)
130
+ #define HUF_H_HUF_STATIC_LINKING_ONLY
131
+
132
+ /* *** Dependencies *** */
133
+ #include "mem.h" /* U32 */
134
+
135
+
136
+ /* *** Constants *** */
137
+ #define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */
138
+ #define HUF_TABLELOG_DEFAULT 11 /* default tableLog value when none specified */
139
+ #define HUF_SYMBOLVALUE_MAX 255
140
+
141
+ #define HUF_TABLELOG_ABSOLUTEMAX 15 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */
142
+ #if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX)
143
+ # error "HUF_TABLELOG_MAX is too large !"
144
+ #endif
145
+
146
+
147
+ /* ****************************************
148
+ * Static allocation
149
+ ******************************************/
150
+ /* HUF buffer bounds */
151
+ #define HUF_CTABLEBOUND 129
152
+ #define HUF_BLOCKBOUND(size) (size + (size>>8) + 8) /* only true when incompressible is pre-filtered with fast heuristic */
153
+ #define HUF_COMPRESSBOUND(size) (HUF_CTABLEBOUND + HUF_BLOCKBOUND(size)) /* Macro version, useful for static allocation */
154
+
155
+ /* static allocation of HUF's Compression Table */
156
+ #define HUF_CTABLE_SIZE_U32(maxSymbolValue) ((maxSymbolValue)+1) /* Use tables of U32, for proper alignment */
157
+ #define HUF_CTABLE_SIZE(maxSymbolValue) (HUF_CTABLE_SIZE_U32(maxSymbolValue) * sizeof(U32))
158
+ #define HUF_CREATE_STATIC_CTABLE(name, maxSymbolValue) \
159
+ U32 name##hb[HUF_CTABLE_SIZE_U32(maxSymbolValue)]; \
160
+ void* name##hv = &(name##hb); \
161
+ HUF_CElt* name = (HUF_CElt*)(name##hv) /* no final ; */
162
+
163
+ /* static allocation of HUF's DTable */
164
+ typedef U32 HUF_DTable;
165
+ #define HUF_DTABLE_SIZE(maxTableLog) (1 + (1<<(maxTableLog)))
166
+ #define HUF_CREATE_STATIC_DTABLEX1(DTable, maxTableLog) \
167
+ HUF_DTable DTable[HUF_DTABLE_SIZE((maxTableLog)-1)] = { ((U32)((maxTableLog)-1) * 0x01000001) }
168
+ #define HUF_CREATE_STATIC_DTABLEX2(DTable, maxTableLog) \
169
+ HUF_DTable DTable[HUF_DTABLE_SIZE(maxTableLog)] = { ((U32)(maxTableLog) * 0x01000001) }
170
+
171
+
172
+ /* ****************************************
173
+ * Advanced decompression functions
174
+ ******************************************/
175
+ size_t HUF_decompress4X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */
176
+ #ifndef HUF_FORCE_DECOMPRESS_X1
177
+ size_t HUF_decompress4X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */
178
+ #endif
179
+
180
+ size_t HUF_decompress4X_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< decodes RLE and uncompressed */
181
+ 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 */
182
+ 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 */
183
+ size_t HUF_decompress4X1_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */
184
+ 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 */
185
+ #ifndef HUF_FORCE_DECOMPRESS_X1
186
+ size_t HUF_decompress4X2_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */
187
+ 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 */
188
+ #endif
189
+
190
+
191
+ /* ****************************************
192
+ * HUF detailed API
193
+ * ****************************************/
194
+
195
+ /*! HUF_compress() does the following:
196
+ * 1. count symbol occurrence from source[] into table count[] using FSE_count() (exposed within "fse.h")
197
+ * 2. (optional) refine tableLog using HUF_optimalTableLog()
198
+ * 3. build Huffman table from count using HUF_buildCTable()
199
+ * 4. save Huffman table to memory buffer using HUF_writeCTable()
200
+ * 5. encode the data stream using HUF_compress4X_usingCTable()
201
+ *
202
+ * The following API allows targeting specific sub-functions for advanced tasks.
203
+ * For example, it's possible to compress several blocks using the same 'CTable',
204
+ * or to save and regenerate 'CTable' using external methods.
205
+ */
206
+ unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue);
207
+ typedef struct HUF_CElt_s HUF_CElt; /* incomplete type */
208
+ 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 */
209
+ size_t HUF_writeCTable (void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog);
210
+ size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable);
211
+
212
+ typedef enum {
213
+ HUF_repeat_none, /**< Cannot use the previous table */
214
+ 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 */
215
+ HUF_repeat_valid /**< Can use the previous table and it is assumed to be valid */
216
+ } HUF_repeat;
217
+ /** HUF_compress4X_repeat() :
218
+ * Same as HUF_compress4X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
219
+ * If it uses hufTable it does not modify hufTable or repeat.
220
+ * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
221
+ * If preferRepeat then the old table will always be used if valid. */
222
+ size_t HUF_compress4X_repeat(void* dst, size_t dstSize,
223
+ const void* src, size_t srcSize,
224
+ unsigned maxSymbolValue, unsigned tableLog,
225
+ void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */
226
+ HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2);
227
+
228
+ /** HUF_buildCTable_wksp() :
229
+ * Same as HUF_buildCTable(), but using externally allocated scratch buffer.
230
+ * `workSpace` must be aligned on 4-bytes boundaries, and its size must be >= HUF_CTABLE_WORKSPACE_SIZE.
231
+ */
232
+ #define HUF_CTABLE_WORKSPACE_SIZE_U32 (2*HUF_SYMBOLVALUE_MAX +1 +1)
233
+ #define HUF_CTABLE_WORKSPACE_SIZE (HUF_CTABLE_WORKSPACE_SIZE_U32 * sizeof(unsigned))
234
+ size_t HUF_buildCTable_wksp (HUF_CElt* tree,
235
+ const unsigned* count, U32 maxSymbolValue, U32 maxNbBits,
236
+ void* workSpace, size_t wkspSize);
237
+
238
+ /*! HUF_readStats() :
239
+ * Read compact Huffman tree, saved by HUF_writeCTable().
240
+ * `huffWeight` is destination buffer.
241
+ * @return : size read from `src` , or an error Code .
242
+ * Note : Needed by HUF_readCTable() and HUF_readDTableXn() . */
243
+ size_t HUF_readStats(BYTE* huffWeight, size_t hwSize,
244
+ U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr,
245
+ const void* src, size_t srcSize);
246
+
247
+ /** HUF_readCTable() :
248
+ * Loading a CTable saved with HUF_writeCTable() */
249
+ size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize);
250
+
251
+ /** HUF_getNbBits() :
252
+ * Read nbBits from CTable symbolTable, for symbol `symbolValue` presumed <= HUF_SYMBOLVALUE_MAX
253
+ * Note 1 : is not inlined, as HUF_CElt definition is private
254
+ * Note 2 : const void* used, so that it can provide a statically allocated table as argument (which uses type U32) */
255
+ U32 HUF_getNbBits(const void* symbolTable, U32 symbolValue);
256
+
257
+ /*
258
+ * HUF_decompress() does the following:
259
+ * 1. select the decompression algorithm (X1, X2) based on pre-computed heuristics
260
+ * 2. build Huffman table from save, using HUF_readDTableX?()
261
+ * 3. decode 1 or 4 segments in parallel using HUF_decompress?X?_usingDTable()
262
+ */
263
+
264
+ /** HUF_selectDecoder() :
265
+ * Tells which decoder is likely to decode faster,
266
+ * based on a set of pre-computed metrics.
267
+ * @return : 0==HUF_decompress4X1, 1==HUF_decompress4X2 .
268
+ * Assumption : 0 < dstSize <= 128 KB */
269
+ U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize);
270
+
271
+ /**
272
+ * The minimum workspace size for the `workSpace` used in
273
+ * HUF_readDTableX1_wksp() and HUF_readDTableX2_wksp().
274
+ *
275
+ * The space used depends on HUF_TABLELOG_MAX, ranging from ~1500 bytes when
276
+ * HUF_TABLE_LOG_MAX=12 to ~1850 bytes when HUF_TABLE_LOG_MAX=15.
277
+ * Buffer overflow errors may potentially occur if code modifications result in
278
+ * a required workspace size greater than that specified in the following
279
+ * macro.
280
+ */
281
+ #define HUF_DECOMPRESS_WORKSPACE_SIZE (2 << 10)
282
+ #define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32))
283
+
284
+ #ifndef HUF_FORCE_DECOMPRESS_X2
285
+ size_t HUF_readDTableX1 (HUF_DTable* DTable, const void* src, size_t srcSize);
286
+ size_t HUF_readDTableX1_wksp (HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize);
287
+ #endif
288
+ #ifndef HUF_FORCE_DECOMPRESS_X1
289
+ size_t HUF_readDTableX2 (HUF_DTable* DTable, const void* src, size_t srcSize);
290
+ size_t HUF_readDTableX2_wksp (HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize);
291
+ #endif
292
+
293
+ size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
294
+ #ifndef HUF_FORCE_DECOMPRESS_X2
295
+ size_t HUF_decompress4X1_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
296
+ #endif
297
+ #ifndef HUF_FORCE_DECOMPRESS_X1
298
+ size_t HUF_decompress4X2_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
299
+ #endif
300
+
301
+
302
+ /* ====================== */
303
+ /* single stream variants */
304
+ /* ====================== */
305
+
306
+ size_t HUF_compress1X (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog);
307
+ 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 */
308
+ size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable);
309
+ /** HUF_compress1X_repeat() :
310
+ * Same as HUF_compress1X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
311
+ * If it uses hufTable it does not modify hufTable or repeat.
312
+ * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
313
+ * If preferRepeat then the old table will always be used if valid. */
314
+ size_t HUF_compress1X_repeat(void* dst, size_t dstSize,
315
+ const void* src, size_t srcSize,
316
+ unsigned maxSymbolValue, unsigned tableLog,
317
+ 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);
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
335
+
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
340
+ #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);
342
+ #endif
343
+
344
+ /* BMI2 variants.
345
+ * If the CPU has BMI2 support, pass bmi2=1, otherwise pass bmi2=0.
346
+ */
347
+ size_t HUF_decompress1X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2);
348
+ #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);
350
+ #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);
353
+
354
+ #endif /* HUF_STATIC_LINKING_ONLY */
355
+
356
+ #if defined (__cplusplus)
357
+ }
358
+ #endif