extzstd 0.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +5 -5
  2. data/HISTORY.ja.md +39 -0
  3. data/README.md +38 -56
  4. data/contrib/zstd/CHANGELOG +613 -0
  5. data/contrib/zstd/CODE_OF_CONDUCT.md +5 -0
  6. data/contrib/zstd/CONTRIBUTING.md +406 -0
  7. data/contrib/zstd/COPYING +339 -0
  8. data/contrib/zstd/Makefile +420 -0
  9. data/contrib/zstd/README.md +179 -41
  10. data/contrib/zstd/TESTING.md +44 -0
  11. data/contrib/zstd/appveyor.yml +292 -0
  12. data/contrib/zstd/lib/BUCK +234 -0
  13. data/contrib/zstd/lib/Makefile +451 -0
  14. data/contrib/zstd/lib/README.md +207 -0
  15. data/contrib/zstd/{common → lib/common}/bitstream.h +187 -138
  16. data/contrib/zstd/lib/common/compiler.h +288 -0
  17. data/contrib/zstd/lib/common/cpu.h +213 -0
  18. data/contrib/zstd/lib/common/debug.c +24 -0
  19. data/contrib/zstd/lib/common/debug.h +107 -0
  20. data/contrib/zstd/lib/common/entropy_common.c +362 -0
  21. data/contrib/zstd/{common → lib/common}/error_private.c +25 -12
  22. data/contrib/zstd/{common → lib/common}/error_private.h +14 -10
  23. data/contrib/zstd/{common → lib/common}/fse.h +173 -92
  24. data/contrib/zstd/{common → lib/common}/fse_decompress.c +149 -85
  25. data/contrib/zstd/lib/common/huf.h +361 -0
  26. data/contrib/zstd/{common → lib/common}/mem.h +115 -59
  27. data/contrib/zstd/lib/common/pool.c +350 -0
  28. data/contrib/zstd/lib/common/pool.h +84 -0
  29. data/contrib/zstd/lib/common/threading.c +122 -0
  30. data/contrib/zstd/lib/common/threading.h +155 -0
  31. data/contrib/zstd/{common → lib/common}/xxhash.c +55 -96
  32. data/contrib/zstd/{common → lib/common}/xxhash.h +23 -47
  33. data/contrib/zstd/lib/common/zstd_common.c +83 -0
  34. data/contrib/zstd/lib/common/zstd_deps.h +111 -0
  35. data/contrib/zstd/lib/common/zstd_errors.h +95 -0
  36. data/contrib/zstd/lib/common/zstd_internal.h +478 -0
  37. data/contrib/zstd/{compress → lib/compress}/fse_compress.c +214 -319
  38. data/contrib/zstd/lib/compress/hist.c +181 -0
  39. data/contrib/zstd/lib/compress/hist.h +75 -0
  40. data/contrib/zstd/lib/compress/huf_compress.c +913 -0
  41. data/contrib/zstd/lib/compress/zstd_compress.c +5208 -0
  42. data/contrib/zstd/lib/compress/zstd_compress_internal.h +1203 -0
  43. data/contrib/zstd/lib/compress/zstd_compress_literals.c +158 -0
  44. data/contrib/zstd/lib/compress/zstd_compress_literals.h +29 -0
  45. data/contrib/zstd/lib/compress/zstd_compress_sequences.c +433 -0
  46. data/contrib/zstd/lib/compress/zstd_compress_sequences.h +54 -0
  47. data/contrib/zstd/lib/compress/zstd_compress_superblock.c +849 -0
  48. data/contrib/zstd/lib/compress/zstd_compress_superblock.h +32 -0
  49. data/contrib/zstd/lib/compress/zstd_cwksp.h +561 -0
  50. data/contrib/zstd/lib/compress/zstd_double_fast.c +521 -0
  51. data/contrib/zstd/lib/compress/zstd_double_fast.h +38 -0
  52. data/contrib/zstd/lib/compress/zstd_fast.c +496 -0
  53. data/contrib/zstd/lib/compress/zstd_fast.h +37 -0
  54. data/contrib/zstd/lib/compress/zstd_lazy.c +1412 -0
  55. data/contrib/zstd/lib/compress/zstd_lazy.h +87 -0
  56. data/contrib/zstd/lib/compress/zstd_ldm.c +660 -0
  57. data/contrib/zstd/lib/compress/zstd_ldm.h +116 -0
  58. data/contrib/zstd/lib/compress/zstd_opt.c +1345 -0
  59. data/contrib/zstd/lib/compress/zstd_opt.h +56 -0
  60. data/contrib/zstd/lib/compress/zstdmt_compress.c +1811 -0
  61. data/contrib/zstd/lib/compress/zstdmt_compress.h +110 -0
  62. data/contrib/zstd/lib/decompress/huf_decompress.c +1350 -0
  63. data/contrib/zstd/lib/decompress/zstd_ddict.c +244 -0
  64. data/contrib/zstd/lib/decompress/zstd_ddict.h +44 -0
  65. data/contrib/zstd/lib/decompress/zstd_decompress.c +1930 -0
  66. data/contrib/zstd/lib/decompress/zstd_decompress_block.c +1540 -0
  67. data/contrib/zstd/lib/decompress/zstd_decompress_block.h +62 -0
  68. data/contrib/zstd/lib/decompress/zstd_decompress_internal.h +190 -0
  69. data/contrib/zstd/{common → lib/deprecated}/zbuff.h +68 -45
  70. data/contrib/zstd/lib/deprecated/zbuff_common.c +26 -0
  71. data/contrib/zstd/lib/deprecated/zbuff_compress.c +147 -0
  72. data/contrib/zstd/lib/deprecated/zbuff_decompress.c +75 -0
  73. data/contrib/zstd/lib/dictBuilder/cover.c +1245 -0
  74. data/contrib/zstd/lib/dictBuilder/cover.h +157 -0
  75. data/contrib/zstd/{dictBuilder → lib/dictBuilder}/divsufsort.c +3 -3
  76. data/contrib/zstd/{dictBuilder → lib/dictBuilder}/divsufsort.h +0 -0
  77. data/contrib/zstd/lib/dictBuilder/fastcover.c +758 -0
  78. data/contrib/zstd/{dictBuilder → lib/dictBuilder}/zdict.c +318 -194
  79. data/contrib/zstd/lib/dictBuilder/zdict.h +305 -0
  80. data/contrib/zstd/{legacy → lib/legacy}/zstd_legacy.h +171 -15
  81. data/contrib/zstd/{legacy → lib/legacy}/zstd_v01.c +191 -124
  82. data/contrib/zstd/{legacy → lib/legacy}/zstd_v01.h +19 -5
  83. data/contrib/zstd/{legacy → lib/legacy}/zstd_v02.c +125 -125
  84. data/contrib/zstd/{legacy → lib/legacy}/zstd_v02.h +19 -5
  85. data/contrib/zstd/{legacy → lib/legacy}/zstd_v03.c +125 -124
  86. data/contrib/zstd/{legacy → lib/legacy}/zstd_v03.h +20 -6
  87. data/contrib/zstd/{legacy → lib/legacy}/zstd_v04.c +151 -299
  88. data/contrib/zstd/{legacy → lib/legacy}/zstd_v04.h +19 -5
  89. data/contrib/zstd/{legacy → lib/legacy}/zstd_v05.c +237 -243
  90. data/contrib/zstd/{legacy → lib/legacy}/zstd_v05.h +19 -6
  91. data/contrib/zstd/{legacy → lib/legacy}/zstd_v06.c +130 -143
  92. data/contrib/zstd/{legacy → lib/legacy}/zstd_v06.h +18 -5
  93. data/contrib/zstd/{legacy → lib/legacy}/zstd_v07.c +158 -157
  94. data/contrib/zstd/{legacy → lib/legacy}/zstd_v07.h +19 -5
  95. data/contrib/zstd/lib/libzstd.pc.in +15 -0
  96. data/contrib/zstd/lib/zstd.h +2391 -0
  97. data/ext/depend +2 -0
  98. data/ext/extconf.rb +15 -6
  99. data/ext/extzstd.c +76 -145
  100. data/ext/extzstd.h +80 -31
  101. data/ext/extzstd_stream.c +417 -142
  102. data/ext/libzstd_conf.h +8 -0
  103. data/ext/zstd_common.c +10 -7
  104. data/ext/zstd_compress.c +14 -5
  105. data/ext/zstd_decompress.c +5 -4
  106. data/ext/zstd_dictbuilder.c +9 -4
  107. data/ext/zstd_dictbuilder_fastcover.c +3 -0
  108. data/ext/zstd_legacy_v01.c +3 -1
  109. data/ext/zstd_legacy_v02.c +3 -1
  110. data/ext/zstd_legacy_v03.c +3 -1
  111. data/ext/zstd_legacy_v04.c +3 -1
  112. data/ext/zstd_legacy_v05.c +3 -1
  113. data/ext/zstd_legacy_v06.c +3 -1
  114. data/ext/zstd_legacy_v07.c +3 -1
  115. data/gemstub.rb +10 -24
  116. data/lib/extzstd.rb +64 -179
  117. data/lib/extzstd/version.rb +6 -1
  118. data/test/test_basic.rb +9 -6
  119. metadata +113 -57
  120. data/HISTORY.ja +0 -5
  121. data/contrib/zstd/common/entropy_common.c +0 -225
  122. data/contrib/zstd/common/huf.h +0 -228
  123. data/contrib/zstd/common/zstd_common.c +0 -83
  124. data/contrib/zstd/common/zstd_errors.h +0 -60
  125. data/contrib/zstd/common/zstd_internal.h +0 -267
  126. data/contrib/zstd/compress/huf_compress.c +0 -533
  127. data/contrib/zstd/compress/zbuff_compress.c +0 -319
  128. data/contrib/zstd/compress/zstd_compress.c +0 -3264
  129. data/contrib/zstd/compress/zstd_opt.h +0 -900
  130. data/contrib/zstd/decompress/huf_decompress.c +0 -883
  131. data/contrib/zstd/decompress/zbuff_decompress.c +0 -252
  132. data/contrib/zstd/decompress/zstd_decompress.c +0 -1842
  133. data/contrib/zstd/dictBuilder/zdict.h +0 -111
  134. data/contrib/zstd/zstd.h +0 -640
@@ -1,10 +1,11 @@
1
- /**
2
- * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
1
+ /*
2
+ * Copyright (c) 2016-2020, 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. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
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
+ * You may select, at your option, one of the above-listed licenses.
8
9
  */
9
10
 
10
11
  /* The purpose of this file is to have a single list of error strings embedded in binary */
@@ -13,6 +14,10 @@
13
14
 
14
15
  const char* ERR_getErrorString(ERR_enum code)
15
16
  {
17
+ #ifdef ZSTD_STRIP_ERROR_STRINGS
18
+ (void)code;
19
+ return "Error strings stripped";
20
+ #else
16
21
  static const char* const notErrorCode = "Unspecified error code";
17
22
  switch( code )
18
23
  {
@@ -20,24 +25,32 @@ const char* ERR_getErrorString(ERR_enum code)
20
25
  case PREFIX(GENERIC): return "Error (generic)";
21
26
  case PREFIX(prefix_unknown): return "Unknown frame descriptor";
22
27
  case PREFIX(version_unsupported): return "Version not supported";
23
- case PREFIX(parameter_unknown): return "Unknown parameter type";
24
28
  case PREFIX(frameParameter_unsupported): return "Unsupported frame parameter";
25
- case PREFIX(frameParameter_unsupportedBy32bits): return "Frame parameter unsupported in 32-bits mode";
26
29
  case PREFIX(frameParameter_windowTooLarge): return "Frame requires too much memory for decoding";
27
- case PREFIX(compressionParameter_unsupported): return "Compression parameter is out of bound";
30
+ case PREFIX(corruption_detected): return "Corrupted block detected";
31
+ case PREFIX(checksum_wrong): return "Restored data doesn't match checksum";
32
+ case PREFIX(parameter_unsupported): return "Unsupported parameter";
33
+ case PREFIX(parameter_outOfBound): return "Parameter is out of bound";
28
34
  case PREFIX(init_missing): return "Context should be init first";
29
35
  case PREFIX(memory_allocation): return "Allocation error : not enough memory";
36
+ case PREFIX(workSpace_tooSmall): return "workSpace buffer is not large enough";
30
37
  case PREFIX(stage_wrong): return "Operation not authorized at current processing stage";
31
- case PREFIX(dstSize_tooSmall): return "Destination buffer is too small";
32
- case PREFIX(srcSize_wrong): return "Src size incorrect";
33
- case PREFIX(corruption_detected): return "Corrupted block detected";
34
- case PREFIX(checksum_wrong): return "Restored data doesn't match checksum";
35
38
  case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported";
36
39
  case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large";
37
40
  case PREFIX(maxSymbolValue_tooSmall): return "Specified maxSymbolValue is too small";
38
41
  case PREFIX(dictionary_corrupted): return "Dictionary is corrupted";
39
42
  case PREFIX(dictionary_wrong): return "Dictionary mismatch";
43
+ case PREFIX(dictionaryCreation_failed): return "Cannot create Dictionary from provided samples";
44
+ case PREFIX(dstSize_tooSmall): return "Destination buffer is too small";
45
+ case PREFIX(srcSize_wrong): return "Src size is incorrect";
46
+ case PREFIX(dstBuffer_null): return "Operation on NULL destination buffer";
47
+ /* following error codes are not stable and may be removed or changed in a future version */
48
+ case PREFIX(frameIndex_tooLarge): return "Frame index is too large";
49
+ case PREFIX(seekableIO): return "An I/O error occurred when reading/seeking";
50
+ case PREFIX(dstBuffer_wrong): return "Destination buffer is wrong";
51
+ case PREFIX(srcBuffer_wrong): return "Source buffer is wrong";
40
52
  case PREFIX(maxCode):
41
53
  default: return notErrorCode;
42
54
  }
55
+ #endif
43
56
  }
@@ -1,10 +1,11 @@
1
- /**
2
- * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
1
+ /*
2
+ * Copyright (c) 2016-2020, 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. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
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
+ * You may select, at your option, one of the above-listed licenses.
8
9
  */
9
10
 
10
11
  /* Note : this module is expected to remain private, do not expose it */
@@ -20,7 +21,7 @@ extern "C" {
20
21
  /* ****************************************
21
22
  * Dependencies
22
23
  ******************************************/
23
- #include <stddef.h> /* size_t */
24
+ #include "zstd_deps.h" /* size_t */
24
25
  #include "zstd_errors.h" /* enum list */
25
26
 
26
27
 
@@ -48,15 +49,18 @@ typedef ZSTD_ErrorCode ERR_enum;
48
49
  /*-****************************************
49
50
  * Error codes handling
50
51
  ******************************************/
51
- #ifdef ERROR
52
- # undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */
53
- #endif
54
- #define ERROR(name) ((size_t)-PREFIX(name))
52
+ #undef ERROR /* already defined on Visual Studio */
53
+ #define ERROR(name) ZSTD_ERROR(name)
54
+ #define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
55
55
 
56
56
  ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
57
57
 
58
58
  ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); }
59
59
 
60
+ /* check and forward error code */
61
+ #define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e
62
+ #define CHECK_F(f) { CHECK_V_F(_var_err__, f); }
63
+
60
64
 
61
65
  /*-****************************************
62
66
  * Error Strings
@@ -1,48 +1,56 @@
1
1
  /* ******************************************************************
2
- FSE : Finite State Entropy codec
3
- Public Prototypes declaration
4
- Copyright (C) 2013-2016, 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
2
+ * FSE : Finite State Entropy codec
3
+ * Public Prototypes declaration
4
+ * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
5
+ *
6
+ * You can contact the author at :
7
+ * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
8
+ *
9
+ * This source code is licensed under both the BSD-style license (found in the
10
+ * LICENSE file in the root directory of this source tree) and the GPLv2 (found
11
+ * in the COPYING file in the root directory of this source tree).
12
+ * You may select, at your option, one of the above-listed licenses.
33
13
  ****************************************************************** */
34
- #ifndef FSE_H
35
- #define FSE_H
36
14
 
37
15
  #if defined (__cplusplus)
38
16
  extern "C" {
39
17
  #endif
40
18
 
19
+ #ifndef FSE_H
20
+ #define FSE_H
21
+
41
22
 
42
23
  /*-*****************************************
43
24
  * Dependencies
44
25
  ******************************************/
45
- #include <stddef.h> /* size_t, ptrdiff_t */
26
+ #include "zstd_deps.h" /* size_t, ptrdiff_t */
27
+
28
+
29
+ /*-*****************************************
30
+ * FSE_PUBLIC_API : control library symbols visibility
31
+ ******************************************/
32
+ #if defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) && defined(__GNUC__) && (__GNUC__ >= 4)
33
+ # define FSE_PUBLIC_API __attribute__ ((visibility ("default")))
34
+ #elif defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) /* Visual expected */
35
+ # define FSE_PUBLIC_API __declspec(dllexport)
36
+ #elif defined(FSE_DLL_IMPORT) && (FSE_DLL_IMPORT==1)
37
+ # define FSE_PUBLIC_API __declspec(dllimport) /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
38
+ #else
39
+ # define FSE_PUBLIC_API
40
+ #endif
41
+
42
+ /*------ Version ------*/
43
+ #define FSE_VERSION_MAJOR 0
44
+ #define FSE_VERSION_MINOR 9
45
+ #define FSE_VERSION_RELEASE 0
46
+
47
+ #define FSE_LIB_VERSION FSE_VERSION_MAJOR.FSE_VERSION_MINOR.FSE_VERSION_RELEASE
48
+ #define FSE_QUOTE(str) #str
49
+ #define FSE_EXPAND_AND_QUOTE(str) FSE_QUOTE(str)
50
+ #define FSE_VERSION_STRING FSE_EXPAND_AND_QUOTE(FSE_LIB_VERSION)
51
+
52
+ #define FSE_VERSION_NUMBER (FSE_VERSION_MAJOR *100*100 + FSE_VERSION_MINOR *100 + FSE_VERSION_RELEASE)
53
+ FSE_PUBLIC_API unsigned FSE_versionNumber(void); /**< library version number; to be used when checking dll version */
46
54
 
47
55
 
48
56
  /*-****************************************
@@ -56,8 +64,8 @@ extern "C" {
56
64
  if return == 1, srcData is a single byte symbol * srcSize times. Use RLE compression instead.
57
65
  if FSE_isError(return), compression failed (more details using FSE_getErrorName())
58
66
  */
59
- size_t FSE_compress(void* dst, size_t dstCapacity,
60
- const void* src, size_t srcSize);
67
+ FSE_PUBLIC_API size_t FSE_compress(void* dst, size_t dstCapacity,
68
+ const void* src, size_t srcSize);
61
69
 
62
70
  /*! FSE_decompress():
63
71
  Decompress FSE data from buffer 'cSrc', of size 'cSrcSize',
@@ -69,18 +77,18 @@ size_t FSE_compress(void* dst, size_t dstCapacity,
69
77
  Why ? : making this distinction requires a header.
70
78
  Header management is intentionally delegated to the user layer, which can better manage special cases.
71
79
  */
72
- size_t FSE_decompress(void* dst, size_t dstCapacity,
73
- const void* cSrc, size_t cSrcSize);
80
+ FSE_PUBLIC_API size_t FSE_decompress(void* dst, size_t dstCapacity,
81
+ const void* cSrc, size_t cSrcSize);
74
82
 
75
83
 
76
84
  /*-*****************************************
77
85
  * Tool functions
78
86
  ******************************************/
79
- size_t FSE_compressBound(size_t size); /* maximum compressed size */
87
+ FSE_PUBLIC_API size_t FSE_compressBound(size_t size); /* maximum compressed size */
80
88
 
81
89
  /* Error Management */
82
- unsigned FSE_isError(size_t code); /* tells if a return value is an error code */
83
- const char* FSE_getErrorName(size_t code); /* provides error code string (useful for debugging) */
90
+ FSE_PUBLIC_API unsigned FSE_isError(size_t code); /* tells if a return value is an error code */
91
+ FSE_PUBLIC_API const char* FSE_getErrorName(size_t code); /* provides error code string (useful for debugging) */
84
92
 
85
93
 
86
94
  /*-*****************************************
@@ -94,7 +102,7 @@ const char* FSE_getErrorName(size_t code); /* provides error code string (usef
94
102
  if return == 1, srcData is a single byte symbol * srcSize times. Use RLE compression.
95
103
  if FSE_isError(return), it's an error code.
96
104
  */
97
- size_t FSE_compress2 (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog);
105
+ FSE_PUBLIC_API size_t FSE_compress2 (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog);
98
106
 
99
107
 
100
108
  /*-*****************************************
@@ -102,7 +110,7 @@ size_t FSE_compress2 (void* dst, size_t dstSize, const void* src, size_t srcSize
102
110
  ******************************************/
103
111
  /*!
104
112
  FSE_compress() does the following:
105
- 1. count symbol occurrence from source[] into table count[]
113
+ 1. count symbol occurrence from source[] into table count[] (see hist.h)
106
114
  2. normalize counters so that sum(count[]) == Power_of_2 (2^tableLog)
107
115
  3. save normalized counters to memory buffer using writeNCount()
108
116
  4. build encoding table 'CTable' from normalized counters
@@ -120,57 +128,56 @@ or to save and provide normalized distribution using external method.
120
128
 
121
129
  /* *** COMPRESSION *** */
122
130
 
123
- /*! FSE_count():
124
- Provides the precise count of each byte within a table 'count'.
125
- 'count' is a table of unsigned int, of minimum size (*maxSymbolValuePtr+1).
126
- *maxSymbolValuePtr will be updated if detected smaller than initial value.
127
- @return : the count of the most frequent symbol (which is not identified).
128
- if return == srcSize, there is only one symbol.
129
- Can also return an error code, which can be tested with FSE_isError(). */
130
- size_t FSE_count(unsigned* count, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize);
131
-
132
131
  /*! FSE_optimalTableLog():
133
132
  dynamically downsize 'tableLog' when conditions are met.
134
133
  It saves CPU time, by using smaller tables, while preserving or even improving compression ratio.
135
134
  @return : recommended tableLog (necessarily <= 'maxTableLog') */
136
- unsigned FSE_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue);
135
+ FSE_PUBLIC_API unsigned FSE_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue);
137
136
 
138
137
  /*! FSE_normalizeCount():
139
138
  normalize counts so that sum(count[]) == Power_of_2 (2^tableLog)
140
139
  'normalizedCounter' is a table of short, of minimum size (maxSymbolValue+1).
140
+ useLowProbCount is a boolean parameter which trades off compressed size for
141
+ faster header decoding. When it is set to 1, the compressed data will be slightly
142
+ smaller. And when it is set to 0, FSE_readNCount() and FSE_buildDTable() will be
143
+ faster. If you are compressing a small amount of data (< 2 KB) then useLowProbCount=0
144
+ is a good default, since header deserialization makes a big speed difference.
145
+ Otherwise, useLowProbCount=1 is a good default, since the speed difference is small.
141
146
  @return : tableLog,
142
147
  or an errorCode, which can be tested using FSE_isError() */
143
- size_t FSE_normalizeCount(short* normalizedCounter, unsigned tableLog, const unsigned* count, size_t srcSize, unsigned maxSymbolValue);
148
+ FSE_PUBLIC_API size_t FSE_normalizeCount(short* normalizedCounter, unsigned tableLog,
149
+ const unsigned* count, size_t srcSize, unsigned maxSymbolValue, unsigned useLowProbCount);
144
150
 
145
151
  /*! FSE_NCountWriteBound():
146
152
  Provides the maximum possible size of an FSE normalized table, given 'maxSymbolValue' and 'tableLog'.
147
153
  Typically useful for allocation purpose. */
148
- size_t FSE_NCountWriteBound(unsigned maxSymbolValue, unsigned tableLog);
154
+ FSE_PUBLIC_API size_t FSE_NCountWriteBound(unsigned maxSymbolValue, unsigned tableLog);
149
155
 
150
156
  /*! FSE_writeNCount():
151
157
  Compactly save 'normalizedCounter' into 'buffer'.
152
158
  @return : size of the compressed table,
153
159
  or an errorCode, which can be tested using FSE_isError(). */
154
- size_t FSE_writeNCount (void* buffer, size_t bufferSize, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog);
155
-
160
+ FSE_PUBLIC_API size_t FSE_writeNCount (void* buffer, size_t bufferSize,
161
+ const short* normalizedCounter,
162
+ unsigned maxSymbolValue, unsigned tableLog);
156
163
 
157
164
  /*! Constructor and Destructor of FSE_CTable.
158
165
  Note that FSE_CTable size depends on 'tableLog' and 'maxSymbolValue' */
159
166
  typedef unsigned FSE_CTable; /* don't allocate that. It's only meant to be more restrictive than void* */
160
- FSE_CTable* FSE_createCTable (unsigned tableLog, unsigned maxSymbolValue);
161
- void FSE_freeCTable (FSE_CTable* ct);
167
+ FSE_PUBLIC_API FSE_CTable* FSE_createCTable (unsigned maxSymbolValue, unsigned tableLog);
168
+ FSE_PUBLIC_API void FSE_freeCTable (FSE_CTable* ct);
162
169
 
163
170
  /*! FSE_buildCTable():
164
171
  Builds `ct`, which must be already allocated, using FSE_createCTable().
165
172
  @return : 0, or an errorCode, which can be tested using FSE_isError() */
166
- size_t FSE_buildCTable(FSE_CTable* ct, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog);
173
+ FSE_PUBLIC_API size_t FSE_buildCTable(FSE_CTable* ct, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog);
167
174
 
168
175
  /*! FSE_compress_usingCTable():
169
176
  Compress `src` using `ct` into `dst` which must be already allocated.
170
177
  @return : size of compressed data (<= `dstCapacity`),
171
178
  or 0 if compressed data could not fit into `dst`,
172
179
  or an errorCode, which can be tested using FSE_isError() */
173
- size_t FSE_compress_usingCTable (void* dst, size_t dstCapacity, const void* src, size_t srcSize, const FSE_CTable* ct);
180
+ FSE_PUBLIC_API size_t FSE_compress_usingCTable (void* dst, size_t dstCapacity, const void* src, size_t srcSize, const FSE_CTable* ct);
174
181
 
175
182
  /*!
176
183
  Tutorial :
@@ -223,25 +230,34 @@ If there is an error, the function will return an ErrorCode (which can be tested
223
230
  @return : size read from 'rBuffer',
224
231
  or an errorCode, which can be tested using FSE_isError().
225
232
  maxSymbolValuePtr[0] and tableLogPtr[0] will also be updated with their respective values */
226
- size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSymbolValuePtr, unsigned* tableLogPtr, const void* rBuffer, size_t rBuffSize);
233
+ FSE_PUBLIC_API size_t FSE_readNCount (short* normalizedCounter,
234
+ unsigned* maxSymbolValuePtr, unsigned* tableLogPtr,
235
+ const void* rBuffer, size_t rBuffSize);
236
+
237
+ /*! FSE_readNCount_bmi2():
238
+ * Same as FSE_readNCount() but pass bmi2=1 when your CPU supports BMI2 and 0 otherwise.
239
+ */
240
+ FSE_PUBLIC_API size_t FSE_readNCount_bmi2(short* normalizedCounter,
241
+ unsigned* maxSymbolValuePtr, unsigned* tableLogPtr,
242
+ const void* rBuffer, size_t rBuffSize, int bmi2);
227
243
 
228
244
  /*! Constructor and Destructor of FSE_DTable.
229
245
  Note that its size depends on 'tableLog' */
230
246
  typedef unsigned FSE_DTable; /* don't allocate that. It's just a way to be more restrictive than void* */
231
- FSE_DTable* FSE_createDTable(unsigned tableLog);
232
- void FSE_freeDTable(FSE_DTable* dt);
247
+ FSE_PUBLIC_API FSE_DTable* FSE_createDTable(unsigned tableLog);
248
+ FSE_PUBLIC_API void FSE_freeDTable(FSE_DTable* dt);
233
249
 
234
250
  /*! FSE_buildDTable():
235
251
  Builds 'dt', which must be already allocated, using FSE_createDTable().
236
252
  return : 0, or an errorCode, which can be tested using FSE_isError() */
237
- size_t FSE_buildDTable (FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog);
253
+ FSE_PUBLIC_API size_t FSE_buildDTable (FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog);
238
254
 
239
255
  /*! FSE_decompress_usingDTable():
240
256
  Decompress compressed source `cSrc` of size `cSrcSize` using `dt`
241
257
  into `dst` which must be already allocated.
242
258
  @return : size of regenerated data (necessarily <= `dstCapacity`),
243
259
  or an errorCode, which can be tested using FSE_isError() */
244
- size_t FSE_decompress_usingDTable(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, const FSE_DTable* dt);
260
+ FSE_PUBLIC_API size_t FSE_decompress_usingDTable(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, const FSE_DTable* dt);
245
261
 
246
262
  /*!
247
263
  Tutorial :
@@ -271,8 +287,10 @@ FSE_decompress_usingDTable() result will tell how many bytes were regenerated (<
271
287
  If there is an error, the function will return an error code, which can be tested using FSE_isError(). (ex: dst buffer too small)
272
288
  */
273
289
 
290
+ #endif /* FSE_H */
274
291
 
275
- #ifdef FSE_STATIC_LINKING_ONLY
292
+ #if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY)
293
+ #define FSE_H_FSE_STATIC_LINKING_ONLY
276
294
 
277
295
  /* *** Dependency *** */
278
296
  #include "bitstream.h"
@@ -283,48 +301,78 @@ If there is an error, the function will return an error code, which can be teste
283
301
  *******************************************/
284
302
  /* FSE buffer bounds */
285
303
  #define FSE_NCOUNTBOUND 512
286
- #define FSE_BLOCKBOUND(size) (size + (size>>7))
304
+ #define FSE_BLOCKBOUND(size) ((size) + ((size)>>7) + 4 /* fse states */ + sizeof(size_t) /* bitContainer */)
287
305
  #define FSE_COMPRESSBOUND(size) (FSE_NCOUNTBOUND + FSE_BLOCKBOUND(size)) /* Macro version, useful for static allocation */
288
306
 
289
- /* It is possible to statically allocate FSE CTable/DTable as a table of unsigned using below macros */
290
- #define FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) (1 + (1<<(maxTableLog-1)) + ((maxSymbolValue+1)*2))
291
- #define FSE_DTABLE_SIZE_U32(maxTableLog) (1 + (1<<maxTableLog))
307
+ /* It is possible to statically allocate FSE CTable/DTable as a table of FSE_CTable/FSE_DTable using below macros */
308
+ #define FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) (1 + (1<<((maxTableLog)-1)) + (((maxSymbolValue)+1)*2))
309
+ #define FSE_DTABLE_SIZE_U32(maxTableLog) (1 + (1<<(maxTableLog)))
310
+
311
+ /* or use the size to malloc() space directly. Pay attention to alignment restrictions though */
312
+ #define FSE_CTABLE_SIZE(maxTableLog, maxSymbolValue) (FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(FSE_CTable))
313
+ #define FSE_DTABLE_SIZE(maxTableLog) (FSE_DTABLE_SIZE_U32(maxTableLog) * sizeof(FSE_DTable))
292
314
 
293
315
 
294
316
  /* *****************************************
295
- * FSE advanced API
296
- *******************************************/
297
- size_t FSE_countFast(unsigned* count, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize);
298
- /**< same as FSE_count(), but blindly trusts that all byte values within src are <= *maxSymbolValuePtr */
317
+ * FSE advanced API
318
+ ***************************************** */
299
319
 
300
320
  unsigned FSE_optimalTableLog_internal(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue, unsigned minus);
301
321
  /**< same as FSE_optimalTableLog(), which used `minus==2` */
302
322
 
323
+ /* FSE_compress_wksp() :
324
+ * Same as FSE_compress2(), but using an externally allocated scratch buffer (`workSpace`).
325
+ * FSE_COMPRESS_WKSP_SIZE_U32() provides the minimum size required for `workSpace` as a table of FSE_CTable.
326
+ */
327
+ #define FSE_COMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) ( FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) + ((maxTableLog > 12) ? (1 << (maxTableLog - 2)) : 1024) )
328
+ size_t FSE_compress_wksp (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
329
+
303
330
  size_t FSE_buildCTable_raw (FSE_CTable* ct, unsigned nbBits);
304
- /**< build a fake FSE_CTable, designed to not compress an input, where each symbol uses nbBits */
331
+ /**< build a fake FSE_CTable, designed for a flat distribution, where each symbol uses nbBits */
305
332
 
306
333
  size_t FSE_buildCTable_rle (FSE_CTable* ct, unsigned char symbolValue);
307
334
  /**< build a fake FSE_CTable, designed to compress always the same symbolValue */
308
335
 
336
+ /* FSE_buildCTable_wksp() :
337
+ * Same as FSE_buildCTable(), but using an externally allocated scratch buffer (`workSpace`).
338
+ * `wkspSize` must be >= `FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog)`.
339
+ */
340
+ #define FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) (sizeof(unsigned) * (maxSymbolValue + 2) + (1ull << tableLog))
341
+ size_t FSE_buildCTable_wksp(FSE_CTable* ct, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
342
+
343
+ #define FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) (sizeof(short) * (maxSymbolValue + 1) + (1ULL << maxTableLog) + 8)
344
+ #define FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) ((FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) + sizeof(unsigned) - 1) / sizeof(unsigned))
345
+ FSE_PUBLIC_API size_t FSE_buildDTable_wksp(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
346
+ /**< Same as FSE_buildDTable(), using an externally allocated `workspace` produced with `FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxSymbolValue)` */
347
+
309
348
  size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits);
310
- /**< build a fake FSE_DTable, designed to read an uncompressed bitstream where each symbol uses nbBits */
349
+ /**< build a fake FSE_DTable, designed to read a flat distribution where each symbol uses nbBits */
311
350
 
312
351
  size_t FSE_buildDTable_rle (FSE_DTable* dt, unsigned char symbolValue);
313
352
  /**< build a fake FSE_DTable, designed to always generate the same symbolValue */
314
353
 
354
+ #define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue))
355
+ #define FSE_DECOMPRESS_WKSP_SIZE(maxTableLog, maxSymbolValue) (FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(unsigned))
356
+ size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize);
357
+ /**< same as FSE_decompress(), using an externally allocated `workSpace` produced with `FSE_DECOMPRESS_WKSP_SIZE_U32(maxLog, maxSymbolValue)` */
358
+
359
+ size_t FSE_decompress_wksp_bmi2(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize, int bmi2);
360
+ /**< Same as FSE_decompress_wksp() but with dynamic BMI2 support. Pass 1 if your CPU supports BMI2 or 0 if it doesn't. */
361
+
362
+ typedef enum {
363
+ FSE_repeat_none, /**< Cannot use the previous table */
364
+ FSE_repeat_check, /**< Can use the previous table but it must be checked */
365
+ FSE_repeat_valid /**< Can use the previous table and it is assumed to be valid */
366
+ } FSE_repeat;
315
367
 
316
368
  /* *****************************************
317
369
  * FSE symbol compression API
318
370
  *******************************************/
319
371
  /*!
320
372
  This API consists of small unitary functions, which highly benefit from being inlined.
321
- You will want to enable link-time-optimization to ensure these functions are properly inlined in your binary.
322
- Visual seems to do it automatically.
323
- For gcc or clang, you'll need to add -flto flag at compilation and linking stages.
324
- If none of these solutions is applicable, include "fse.c" directly.
373
+ Hence their body are included in next section.
325
374
  */
326
- typedef struct
327
- {
375
+ typedef struct {
328
376
  ptrdiff_t value;
329
377
  const void* stateTable;
330
378
  const void* symbolTT;
@@ -384,8 +432,7 @@ If there is an error, it returns an errorCode (which can be tested using FSE_isE
384
432
  /* *****************************************
385
433
  * FSE symbol decompression API
386
434
  *******************************************/
387
- typedef struct
388
- {
435
+ typedef struct {
389
436
  size_t state;
390
437
  const void* table; /* precise table may vary, depending on U16 */
391
438
  } FSE_DState_t;
@@ -469,7 +516,7 @@ MEM_STATIC void FSE_initCState(FSE_CState_t* statePtr, const FSE_CTable* ct)
469
516
  const U32 tableLog = MEM_read16(ptr);
470
517
  statePtr->value = (ptrdiff_t)1<<tableLog;
471
518
  statePtr->stateTable = u16ptr+2;
472
- statePtr->symbolTT = ((const U32*)ct + 1 + (tableLog ? (1<<(tableLog-1)) : 1));
519
+ statePtr->symbolTT = ct + 1 + (tableLog ? (1<<(tableLog-1)) : 1);
473
520
  statePtr->stateLog = tableLog;
474
521
  }
475
522
 
@@ -488,11 +535,11 @@ MEM_STATIC void FSE_initCState2(FSE_CState_t* statePtr, const FSE_CTable* ct, U3
488
535
  }
489
536
  }
490
537
 
491
- MEM_STATIC void FSE_encodeSymbol(BIT_CStream_t* bitC, FSE_CState_t* statePtr, U32 symbol)
538
+ MEM_STATIC void FSE_encodeSymbol(BIT_CStream_t* bitC, FSE_CState_t* statePtr, unsigned symbol)
492
539
  {
493
- const FSE_symbolCompressionTransform symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol];
540
+ FSE_symbolCompressionTransform const symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol];
494
541
  const U16* const stateTable = (const U16*)(statePtr->stateTable);
495
- U32 nbBitsOut = (U32)((statePtr->value + symbolTT.deltaNbBits) >> 16);
542
+ U32 const nbBitsOut = (U32)((statePtr->value + symbolTT.deltaNbBits) >> 16);
496
543
  BIT_addBits(bitC, statePtr->value, nbBitsOut);
497
544
  statePtr->value = stateTable[ (statePtr->value >> nbBitsOut) + symbolTT.deltaFindState];
498
545
  }
@@ -504,6 +551,39 @@ MEM_STATIC void FSE_flushCState(BIT_CStream_t* bitC, const FSE_CState_t* statePt
504
551
  }
505
552
 
506
553
 
554
+ /* FSE_getMaxNbBits() :
555
+ * Approximate maximum cost of a symbol, in bits.
556
+ * Fractional get rounded up (i.e : a symbol with a normalized frequency of 3 gives the same result as a frequency of 2)
557
+ * note 1 : assume symbolValue is valid (<= maxSymbolValue)
558
+ * note 2 : if freq[symbolValue]==0, @return a fake cost of tableLog+1 bits */
559
+ MEM_STATIC U32 FSE_getMaxNbBits(const void* symbolTTPtr, U32 symbolValue)
560
+ {
561
+ const FSE_symbolCompressionTransform* symbolTT = (const FSE_symbolCompressionTransform*) symbolTTPtr;
562
+ return (symbolTT[symbolValue].deltaNbBits + ((1<<16)-1)) >> 16;
563
+ }
564
+
565
+ /* FSE_bitCost() :
566
+ * Approximate symbol cost, as fractional value, using fixed-point format (accuracyLog fractional bits)
567
+ * note 1 : assume symbolValue is valid (<= maxSymbolValue)
568
+ * note 2 : if freq[symbolValue]==0, @return a fake cost of tableLog+1 bits */
569
+ MEM_STATIC U32 FSE_bitCost(const void* symbolTTPtr, U32 tableLog, U32 symbolValue, U32 accuracyLog)
570
+ {
571
+ const FSE_symbolCompressionTransform* symbolTT = (const FSE_symbolCompressionTransform*) symbolTTPtr;
572
+ U32 const minNbBits = symbolTT[symbolValue].deltaNbBits >> 16;
573
+ U32 const threshold = (minNbBits+1) << 16;
574
+ assert(tableLog < 16);
575
+ assert(accuracyLog < 31-tableLog); /* ensure enough room for renormalization double shift */
576
+ { U32 const tableSize = 1 << tableLog;
577
+ U32 const deltaFromThreshold = threshold - (symbolTT[symbolValue].deltaNbBits + tableSize);
578
+ U32 const normalizedDeltaFromThreshold = (deltaFromThreshold << accuracyLog) >> tableLog; /* linear interpolation (very approximate) */
579
+ U32 const bitMultiplier = 1 << accuracyLog;
580
+ assert(symbolTT[symbolValue].deltaNbBits + tableSize <= threshold);
581
+ assert(normalizedDeltaFromThreshold <= bitMultiplier);
582
+ return (minNbBits+1)*bitMultiplier - normalizedDeltaFromThreshold;
583
+ }
584
+ }
585
+
586
+
507
587
  /* ====== Decompression ====== */
508
588
 
509
589
  typedef struct {
@@ -588,6 +668,9 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr)
588
668
  #ifndef FSE_DEFAULT_MEMORY_USAGE
589
669
  # define FSE_DEFAULT_MEMORY_USAGE 13
590
670
  #endif
671
+ #if (FSE_DEFAULT_MEMORY_USAGE > FSE_MAX_MEMORY_USAGE)
672
+ # error "FSE_DEFAULT_MEMORY_USAGE must be <= FSE_MAX_MEMORY_USAGE"
673
+ #endif
591
674
 
592
675
  /*!FSE_MAX_SYMBOL_VALUE :
593
676
  * Maximum symbol value authorized.
@@ -621,7 +704,7 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr)
621
704
  # error "FSE_MAX_TABLELOG > FSE_TABLELOG_ABSOLUTE_MAX is not supported"
622
705
  #endif
623
706
 
624
- #define FSE_TABLESTEP(tableSize) ((tableSize>>1) + (tableSize>>3) + 3)
707
+ #define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
625
708
 
626
709
 
627
710
  #endif /* FSE_STATIC_LINKING_ONLY */
@@ -630,5 +713,3 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr)
630
713
  #if defined (__cplusplus)
631
714
  }
632
715
  #endif
633
-
634
- #endif /* FSE_H */