zstd-ruby 1.3.0.0 → 1.3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/zstdruby/libzstd/common/bitstream.h +40 -41
- data/ext/zstdruby/libzstd/common/compiler.h +85 -0
- data/ext/zstdruby/libzstd/common/error_private.c +8 -10
- data/ext/zstdruby/libzstd/common/error_private.h +4 -4
- data/ext/zstdruby/libzstd/common/fse.h +11 -5
- data/ext/zstdruby/libzstd/common/fse_decompress.c +3 -22
- data/ext/zstdruby/libzstd/common/huf.h +5 -6
- data/ext/zstdruby/libzstd/common/mem.h +6 -6
- data/ext/zstdruby/libzstd/common/pool.c +61 -27
- data/ext/zstdruby/libzstd/common/pool.h +10 -10
- data/ext/zstdruby/libzstd/common/threading.h +5 -6
- data/ext/zstdruby/libzstd/common/xxhash.c +28 -22
- data/ext/zstdruby/libzstd/common/zstd_common.c +4 -4
- data/ext/zstdruby/libzstd/common/zstd_errors.h +30 -32
- data/ext/zstdruby/libzstd/common/zstd_internal.h +57 -56
- data/ext/zstdruby/libzstd/compress/fse_compress.c +4 -22
- data/ext/zstdruby/libzstd/compress/huf_compress.c +4 -3
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +314 -304
- data/ext/zstdruby/libzstd/compress/zstd_opt.h +118 -116
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +223 -156
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +10 -9
- data/ext/zstdruby/libzstd/decompress/huf_decompress.c +8 -24
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +95 -115
- data/ext/zstdruby/libzstd/deprecated/zbuff.h +4 -4
- data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +4 -5
- data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +4 -4
- data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +4 -4
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +7 -9
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +5 -5
- data/ext/zstdruby/libzstd/dictBuilder/zdict.h +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +8 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v01.c +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v01.h +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v02.c +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v02.h +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v03.c +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v03.h +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v04.c +5 -5
- data/ext/zstdruby/libzstd/legacy/zstd_v04.h +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v05.c +5 -5
- data/ext/zstdruby/libzstd/legacy/zstd_v05.h +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v06.c +5 -5
- data/ext/zstdruby/libzstd/legacy/zstd_v06.h +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v07.c +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v07.h +4 -4
- data/ext/zstdruby/libzstd/zstd.h +16 -14
- data/lib/zstd-ruby/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48af64c3a8015d954ae016873a99cb5988e07b51
|
4
|
+
data.tar.gz: 34992d313542ff44254b5d234b2cea8c80564676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e80edaa544a84fa28ce973e19e96ecb79340f1d6e85e5618106d421200c5d6404762a0d84eb8645f42b9d1595726f8290b9f74293906ea759961dfc6dfaae3d3
|
7
|
+
data.tar.gz: 181ccfef8a7342066ce1c41232014d0879dc90d2b8f65c6b648ded882a3eb268fab005270eece025a18ccc5d97edc81e4a5cebec9500396428c6af766372925d
|
data/README.md
CHANGED
@@ -80,9 +80,9 @@ extern "C" {
|
|
80
80
|
* bitStream encoding API (write forward)
|
81
81
|
********************************************/
|
82
82
|
/* bitStream can mix input from multiple sources.
|
83
|
-
*
|
84
|
-
*
|
85
|
-
*/
|
83
|
+
* A critical property of these streams is that they encode and decode in **reverse** direction.
|
84
|
+
* So the first bit sequence you add will be the last to be read, like a LIFO stack.
|
85
|
+
*/
|
86
86
|
typedef struct
|
87
87
|
{
|
88
88
|
size_t bitContainer;
|
@@ -203,7 +203,7 @@ static const unsigned BIT_mask[] = { 0, 1, 3, 7, 0xF, 0x1F, 0x3F, 0x7F,
|
|
203
203
|
/*! BIT_initCStream() :
|
204
204
|
* `dstCapacity` must be > sizeof(size_t)
|
205
205
|
* @return : 0 if success,
|
206
|
-
|
206
|
+
* otherwise an error code (can be tested using ERR_isError()) */
|
207
207
|
MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC,
|
208
208
|
void* startPtr, size_t dstCapacity)
|
209
209
|
{
|
@@ -217,8 +217,8 @@ MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC,
|
|
217
217
|
}
|
218
218
|
|
219
219
|
/*! BIT_addBits() :
|
220
|
-
|
221
|
-
|
220
|
+
* can add up to 26 bits into `bitC`.
|
221
|
+
* Note : does not check for register overflow ! */
|
222
222
|
MEM_STATIC void BIT_addBits(BIT_CStream_t* bitC,
|
223
223
|
size_t value, unsigned nbBits)
|
224
224
|
{
|
@@ -268,7 +268,7 @@ MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC)
|
|
268
268
|
|
269
269
|
/*! BIT_closeCStream() :
|
270
270
|
* @return : size of CStream, in bytes,
|
271
|
-
|
271
|
+
* or 0 if it could not fit into dstBuffer */
|
272
272
|
MEM_STATIC size_t BIT_closeCStream(BIT_CStream_t* bitC)
|
273
273
|
{
|
274
274
|
BIT_addBitsFast(bitC, 1, 1); /* endMark */
|
@@ -279,14 +279,14 @@ MEM_STATIC size_t BIT_closeCStream(BIT_CStream_t* bitC)
|
|
279
279
|
|
280
280
|
|
281
281
|
/*-********************************************************
|
282
|
-
*
|
282
|
+
* bitStream decoding
|
283
283
|
**********************************************************/
|
284
284
|
/*! BIT_initDStream() :
|
285
|
-
*
|
286
|
-
*
|
287
|
-
*
|
288
|
-
*
|
289
|
-
*/
|
285
|
+
* Initialize a BIT_DStream_t.
|
286
|
+
* `bitD` : a pointer to an already allocated BIT_DStream_t structure.
|
287
|
+
* `srcSize` must be the *exact* size of the bitStream, in bytes.
|
288
|
+
* @return : size of stream (== srcSize), or an errorCode if a problem is detected
|
289
|
+
*/
|
290
290
|
MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, size_t srcSize)
|
291
291
|
{
|
292
292
|
if (srcSize < 1) { memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
|
@@ -305,29 +305,30 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si
|
|
305
305
|
bitD->bitContainer = *(const BYTE*)(bitD->start);
|
306
306
|
switch(srcSize)
|
307
307
|
{
|
308
|
-
|
309
|
-
|
308
|
+
case 7: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
|
309
|
+
/* fall-through */
|
310
310
|
|
311
|
-
|
312
|
-
|
311
|
+
case 6: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
|
312
|
+
/* fall-through */
|
313
313
|
|
314
|
-
|
315
|
-
|
314
|
+
case 5: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
|
315
|
+
/* fall-through */
|
316
316
|
|
317
|
-
|
318
|
-
|
317
|
+
case 4: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[3]) << 24;
|
318
|
+
/* fall-through */
|
319
319
|
|
320
|
-
|
321
|
-
|
320
|
+
case 3: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[2]) << 16;
|
321
|
+
/* fall-through */
|
322
322
|
|
323
|
-
|
324
|
-
|
323
|
+
case 2: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[1]) << 8;
|
324
|
+
/* fall-through */
|
325
325
|
|
326
|
-
|
326
|
+
default: break;
|
327
|
+
}
|
328
|
+
{ BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
|
329
|
+
bitD->bitsConsumed = lastByte ? 8 - BIT_highbit32(lastByte) : 0;
|
330
|
+
if (lastByte == 0) return ERROR(corruption_detected); /* endMark not present */
|
327
331
|
}
|
328
|
-
{ BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
|
329
|
-
bitD->bitsConsumed = lastByte ? 8 - BIT_highbit32(lastByte) : 0;
|
330
|
-
if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
|
331
332
|
bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
|
332
333
|
}
|
333
334
|
|
@@ -363,9 +364,8 @@ MEM_STATIC size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits)
|
|
363
364
|
* local register is not modified.
|
364
365
|
* On 32-bits, maxNbBits==24.
|
365
366
|
* On 64-bits, maxNbBits==56.
|
366
|
-
*
|
367
|
-
|
368
|
-
MEM_STATIC size_t BIT_lookBits(const BIT_DStream_t* bitD, U32 nbBits)
|
367
|
+
* @return : value extracted */
|
368
|
+
MEM_STATIC size_t BIT_lookBits(const BIT_DStream_t* bitD, U32 nbBits)
|
369
369
|
{
|
370
370
|
#if defined(__BMI__) && defined(__GNUC__) /* experimental; fails if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8 */
|
371
371
|
return BIT_getMiddleBits(bitD->bitContainer, (sizeof(bitD->bitContainer)*8) - bitD->bitsConsumed - nbBits, nbBits);
|
@@ -392,8 +392,7 @@ MEM_STATIC void BIT_skipBits(BIT_DStream_t* bitD, U32 nbBits)
|
|
392
392
|
/*! BIT_readBits() :
|
393
393
|
* Read (consume) next n bits from local register and update.
|
394
394
|
* Pay attention to not read more than nbBits contained into local register.
|
395
|
-
*
|
396
|
-
*/
|
395
|
+
* @return : extracted value. */
|
397
396
|
MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, U32 nbBits)
|
398
397
|
{
|
399
398
|
size_t const value = BIT_lookBits(bitD, nbBits);
|
@@ -402,7 +401,7 @@ MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, U32 nbBits)
|
|
402
401
|
}
|
403
402
|
|
404
403
|
/*! BIT_readBitsFast() :
|
405
|
-
*
|
404
|
+
* unsafe version; only works only if nbBits >= 1 */
|
406
405
|
MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, U32 nbBits)
|
407
406
|
{
|
408
407
|
size_t const value = BIT_lookBitsFast(bitD, nbBits);
|
@@ -412,10 +411,10 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, U32 nbBits)
|
|
412
411
|
}
|
413
412
|
|
414
413
|
/*! BIT_reloadDStream() :
|
415
|
-
*
|
416
|
-
*
|
417
|
-
*
|
418
|
-
|
414
|
+
* Refill `bitD` from buffer previously set in BIT_initDStream() .
|
415
|
+
* This function is safe, it guarantees it will not read beyond src buffer.
|
416
|
+
* @return : status of `BIT_DStream_t` internal register.
|
417
|
+
* when status == BIT_DStream_unfinished, internal register is filled with at least 25 or 57 bits */
|
419
418
|
MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD)
|
420
419
|
{
|
421
420
|
if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8)) /* overflow detected, like end of stream */
|
@@ -446,8 +445,8 @@ MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD)
|
|
446
445
|
}
|
447
446
|
|
448
447
|
/*! BIT_endOfDStream() :
|
449
|
-
*
|
450
|
-
*/
|
448
|
+
* @return : 1 if DStream has _exactly_ reached its end (all bits consumed).
|
449
|
+
*/
|
451
450
|
MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* DStream)
|
452
451
|
{
|
453
452
|
return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
|
@@ -0,0 +1,85 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* This source code is licensed under both the BSD-style license (found in the
|
6
|
+
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
7
|
+
* in the COPYING file in the root directory of this source tree).
|
8
|
+
*/
|
9
|
+
|
10
|
+
#ifndef ZSTD_COMPILER_H
|
11
|
+
#define ZSTD_COMPILER_H
|
12
|
+
|
13
|
+
/*-*******************************************************
|
14
|
+
* Compiler specifics
|
15
|
+
*********************************************************/
|
16
|
+
/* force inlining */
|
17
|
+
#if defined (__GNUC__) || defined(__cplusplus) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
|
18
|
+
# define INLINE_KEYWORD inline
|
19
|
+
#else
|
20
|
+
# define INLINE_KEYWORD
|
21
|
+
#endif
|
22
|
+
|
23
|
+
#if defined(__GNUC__)
|
24
|
+
# define FORCE_INLINE_ATTR __attribute__((always_inline))
|
25
|
+
#elif defined(_MSC_VER)
|
26
|
+
# define FORCE_INLINE_ATTR __forceinline
|
27
|
+
#else
|
28
|
+
# define FORCE_INLINE_ATTR
|
29
|
+
#endif
|
30
|
+
|
31
|
+
/**
|
32
|
+
* FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant
|
33
|
+
* parameters. They must be inlined for the compiler to elimininate the constant
|
34
|
+
* branches.
|
35
|
+
*/
|
36
|
+
#define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR
|
37
|
+
/**
|
38
|
+
* HINT_INLINE is used to help the compiler generate better code. It is *not*
|
39
|
+
* used for "templates", so it can be tweaked based on the compilers
|
40
|
+
* performance.
|
41
|
+
*
|
42
|
+
* gcc-4.8 and gcc-4.9 have been shown to benefit from leaving off the
|
43
|
+
* always_inline attribute.
|
44
|
+
*
|
45
|
+
* clang up to 5.0.0 (trunk) benefit tremendously from the always_inline
|
46
|
+
* attribute.
|
47
|
+
*/
|
48
|
+
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 && __GNUC__ < 5
|
49
|
+
# define HINT_INLINE static INLINE_KEYWORD
|
50
|
+
#else
|
51
|
+
# define HINT_INLINE static INLINE_KEYWORD FORCE_INLINE_ATTR
|
52
|
+
#endif
|
53
|
+
|
54
|
+
/* force no inlining */
|
55
|
+
#ifdef _MSC_VER
|
56
|
+
# define FORCE_NOINLINE static __declspec(noinline)
|
57
|
+
#else
|
58
|
+
# ifdef __GNUC__
|
59
|
+
# define FORCE_NOINLINE static __attribute__((__noinline__))
|
60
|
+
# else
|
61
|
+
# define FORCE_NOINLINE static
|
62
|
+
# endif
|
63
|
+
#endif
|
64
|
+
|
65
|
+
/* prefetch */
|
66
|
+
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */
|
67
|
+
# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */
|
68
|
+
# define PREFETCH(ptr) _mm_prefetch((const char*)ptr, _MM_HINT_T0)
|
69
|
+
#elif defined(__GNUC__)
|
70
|
+
# define PREFETCH(ptr) __builtin_prefetch(ptr, 0, 0)
|
71
|
+
#else
|
72
|
+
# define PREFETCH(ptr) /* disabled */
|
73
|
+
#endif
|
74
|
+
|
75
|
+
/* disable warnings */
|
76
|
+
#ifdef _MSC_VER /* Visual Studio */
|
77
|
+
# include <intrin.h> /* For Visual 2005 */
|
78
|
+
# pragma warning(disable : 4100) /* disable: C4100: unreferenced formal parameter */
|
79
|
+
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
|
80
|
+
# pragma warning(disable : 4204) /* disable: C4204: non-constant aggregate initializer */
|
81
|
+
# pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */
|
82
|
+
# pragma warning(disable : 4324) /* disable: C4324: padded structure */
|
83
|
+
#endif
|
84
|
+
|
85
|
+
#endif /* ZSTD_COMPILER_H */
|
@@ -1,10 +1,10 @@
|
|
1
|
-
|
1
|
+
/*
|
2
2
|
* Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
6
|
-
* LICENSE file in the root directory of this source tree
|
7
|
-
*
|
5
|
+
* This source code is licensed under both the BSD-style license (found in the
|
6
|
+
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
7
|
+
* in the COPYING file in the root directory of this source tree).
|
8
8
|
*/
|
9
9
|
|
10
10
|
/* The purpose of this file is to have a single list of error strings embedded in binary */
|
@@ -20,19 +20,17 @@ const char* ERR_getErrorString(ERR_enum code)
|
|
20
20
|
case PREFIX(GENERIC): return "Error (generic)";
|
21
21
|
case PREFIX(prefix_unknown): return "Unknown frame descriptor";
|
22
22
|
case PREFIX(version_unsupported): return "Version not supported";
|
23
|
-
case PREFIX(parameter_unknown): return "Unknown parameter type";
|
24
23
|
case PREFIX(frameParameter_unsupported): return "Unsupported frame parameter";
|
25
|
-
case PREFIX(frameParameter_unsupportedBy32bits): return "Frame parameter unsupported in 32-bits mode";
|
26
24
|
case PREFIX(frameParameter_windowTooLarge): return "Frame requires too much memory for decoding";
|
27
|
-
case PREFIX(
|
28
|
-
case PREFIX(
|
25
|
+
case PREFIX(corruption_detected): return "Corrupted block detected";
|
26
|
+
case PREFIX(checksum_wrong): return "Restored data doesn't match checksum";
|
27
|
+
case PREFIX(parameter_unsupported): return "Unsupported parameter";
|
28
|
+
case PREFIX(parameter_outOfBound): return "Parameter is out of bound";
|
29
29
|
case PREFIX(init_missing): return "Context should be init first";
|
30
30
|
case PREFIX(memory_allocation): return "Allocation error : not enough memory";
|
31
31
|
case PREFIX(stage_wrong): return "Operation not authorized at current processing stage";
|
32
32
|
case PREFIX(dstSize_tooSmall): return "Destination buffer is too small";
|
33
33
|
case PREFIX(srcSize_wrong): return "Src size is incorrect";
|
34
|
-
case PREFIX(corruption_detected): return "Corrupted block detected";
|
35
|
-
case PREFIX(checksum_wrong): return "Restored data doesn't match checksum";
|
36
34
|
case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported";
|
37
35
|
case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large";
|
38
36
|
case PREFIX(maxSymbolValue_tooSmall): return "Specified maxSymbolValue is too small";
|
@@ -1,10 +1,10 @@
|
|
1
|
-
|
1
|
+
/*
|
2
2
|
* Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
6
|
-
* LICENSE file in the root directory of this source tree
|
7
|
-
*
|
5
|
+
* This source code is licensed under both the BSD-style license (found in the
|
6
|
+
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
7
|
+
* in the COPYING file in the root directory of this source tree).
|
8
8
|
*/
|
9
9
|
|
10
10
|
/* Note : this module is expected to remain private, do not expose it */
|
@@ -31,13 +31,14 @@
|
|
31
31
|
You can contact the author at :
|
32
32
|
- Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
33
33
|
****************************************************************** */
|
34
|
-
#ifndef FSE_H
|
35
|
-
#define FSE_H
|
36
34
|
|
37
35
|
#if defined (__cplusplus)
|
38
36
|
extern "C" {
|
39
37
|
#endif
|
40
38
|
|
39
|
+
#ifndef FSE_H
|
40
|
+
#define FSE_H
|
41
|
+
|
41
42
|
|
42
43
|
/*-*****************************************
|
43
44
|
* Dependencies
|
@@ -297,8 +298,10 @@ FSE_decompress_usingDTable() result will tell how many bytes were regenerated (<
|
|
297
298
|
If there is an error, the function will return an error code, which can be tested using FSE_isError(). (ex: dst buffer too small)
|
298
299
|
*/
|
299
300
|
|
301
|
+
#endif /* FSE_H */
|
300
302
|
|
301
|
-
#
|
303
|
+
#if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY)
|
304
|
+
#define FSE_H_FSE_STATIC_LINKING_ONLY
|
302
305
|
|
303
306
|
/* *** Dependency *** */
|
304
307
|
#include "bitstream.h"
|
@@ -381,6 +384,11 @@ size_t FSE_buildDTable_rle (FSE_DTable* dt, unsigned char symbolValue);
|
|
381
384
|
size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, FSE_DTable* workSpace, unsigned maxLog);
|
382
385
|
/**< same as FSE_decompress(), using an externally allocated `workSpace` produced with `FSE_DTABLE_SIZE_U32(maxLog)` */
|
383
386
|
|
387
|
+
typedef enum {
|
388
|
+
FSE_repeat_none, /**< Cannot use the previous table */
|
389
|
+
FSE_repeat_check, /**< Can use the previous table but it must be checked */
|
390
|
+
FSE_repeat_valid /**< Can use the previous table and it is asumed to be valid */
|
391
|
+
} FSE_repeat;
|
384
392
|
|
385
393
|
/* *****************************************
|
386
394
|
* FSE symbol compression API
|
@@ -694,5 +702,3 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr)
|
|
694
702
|
#if defined (__cplusplus)
|
695
703
|
}
|
696
704
|
#endif
|
697
|
-
|
698
|
-
#endif /* FSE_H */
|
@@ -33,35 +33,16 @@
|
|
33
33
|
****************************************************************** */
|
34
34
|
|
35
35
|
|
36
|
-
/* **************************************************************
|
37
|
-
* Compiler specifics
|
38
|
-
****************************************************************/
|
39
|
-
#ifdef _MSC_VER /* Visual Studio */
|
40
|
-
# define FORCE_INLINE static __forceinline
|
41
|
-
# include <intrin.h> /* For Visual 2005 */
|
42
|
-
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
|
43
|
-
# pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */
|
44
|
-
#else
|
45
|
-
# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
|
46
|
-
# ifdef __GNUC__
|
47
|
-
# define FORCE_INLINE static inline __attribute__((always_inline))
|
48
|
-
# else
|
49
|
-
# define FORCE_INLINE static inline
|
50
|
-
# endif
|
51
|
-
# else
|
52
|
-
# define FORCE_INLINE static
|
53
|
-
# endif /* __STDC_VERSION__ */
|
54
|
-
#endif
|
55
|
-
|
56
|
-
|
57
36
|
/* **************************************************************
|
58
37
|
* Includes
|
59
38
|
****************************************************************/
|
60
39
|
#include <stdlib.h> /* malloc, free, qsort */
|
61
40
|
#include <string.h> /* memcpy, memset */
|
62
41
|
#include "bitstream.h"
|
42
|
+
#include "compiler.h"
|
63
43
|
#define FSE_STATIC_LINKING_ONLY
|
64
44
|
#include "fse.h"
|
45
|
+
#include "error_private.h"
|
65
46
|
|
66
47
|
|
67
48
|
/* **************************************************************
|
@@ -216,7 +197,7 @@ size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits)
|
|
216
197
|
return 0;
|
217
198
|
}
|
218
199
|
|
219
|
-
|
200
|
+
FORCE_INLINE_TEMPLATE size_t FSE_decompress_usingDTable_generic(
|
220
201
|
void* dst, size_t maxDstSize,
|
221
202
|
const void* cSrc, size_t cSrcSize,
|
222
203
|
const FSE_DTable* dt, const unsigned fast)
|
@@ -31,13 +31,13 @@
|
|
31
31
|
You can contact the author at :
|
32
32
|
- Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
33
33
|
****************************************************************** */
|
34
|
-
#ifndef HUF_H_298734234
|
35
|
-
#define HUF_H_298734234
|
36
34
|
|
37
35
|
#if defined (__cplusplus)
|
38
36
|
extern "C" {
|
39
37
|
#endif
|
40
38
|
|
39
|
+
#ifndef HUF_H_298734234
|
40
|
+
#define HUF_H_298734234
|
41
41
|
|
42
42
|
/* *** Dependencies *** */
|
43
43
|
#include <stddef.h> /* size_t */
|
@@ -124,6 +124,7 @@ HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity, const
|
|
124
124
|
#define HUF_DECOMPRESS_WORKSPACE_SIZE (2 << 10)
|
125
125
|
#define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32))
|
126
126
|
|
127
|
+
#endif /* HUF_H_298734234 */
|
127
128
|
|
128
129
|
/* ******************************************************************
|
129
130
|
* WARNING !!
|
@@ -132,7 +133,8 @@ HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity, const
|
|
132
133
|
* because they are not guaranteed to remain stable in the future.
|
133
134
|
* Only consider them in association with static linking.
|
134
135
|
*******************************************************************/
|
135
|
-
#
|
136
|
+
#if defined(HUF_STATIC_LINKING_ONLY) && !defined(HUF_H_HUF_STATIC_LINKING_ONLY)
|
137
|
+
#define HUF_H_HUF_STATIC_LINKING_ONLY
|
136
138
|
|
137
139
|
/* *** Dependencies *** */
|
138
140
|
#include "mem.h" /* U32 */
|
@@ -295,9 +297,6 @@ size_t HUF_decompress1X4_usingDTable(void* dst, size_t maxDstSize, const void* c
|
|
295
297
|
|
296
298
|
#endif /* HUF_STATIC_LINKING_ONLY */
|
297
299
|
|
298
|
-
|
299
300
|
#if defined (__cplusplus)
|
300
301
|
}
|
301
302
|
#endif
|
302
|
-
|
303
|
-
#endif /* HUF_H_298734234 */
|