zstd-ruby 1.1.3.0 → 1.1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/ext/zstdruby/libzstd/Makefile +9 -6
  4. data/ext/zstdruby/libzstd/common/bitstream.h +3 -0
  5. data/ext/zstdruby/libzstd/common/entropy_common.c +13 -19
  6. data/ext/zstdruby/libzstd/common/fse.h +48 -22
  7. data/ext/zstdruby/libzstd/common/fse_decompress.c +0 -1
  8. data/ext/zstdruby/libzstd/common/huf.h +27 -5
  9. data/ext/zstdruby/libzstd/common/mem.h +14 -12
  10. data/ext/zstdruby/libzstd/common/threading.c +5 -4
  11. data/ext/zstdruby/libzstd/common/threading.h +1 -1
  12. data/ext/zstdruby/libzstd/common/xxhash.c +3 -1
  13. data/ext/zstdruby/libzstd/common/xxhash.h +11 -15
  14. data/ext/zstdruby/libzstd/common/zstd_common.c +1 -1
  15. data/ext/zstdruby/libzstd/common/zstd_internal.h +4 -0
  16. data/ext/zstdruby/libzstd/compress/fse_compress.c +16 -9
  17. data/ext/zstdruby/libzstd/compress/huf_compress.c +103 -28
  18. data/ext/zstdruby/libzstd/compress/zstd_compress.c +90 -37
  19. data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
  20. data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +7 -8
  21. data/ext/zstdruby/libzstd/decompress/huf_decompress.c +20 -17
  22. data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +429 -120
  23. data/ext/zstdruby/libzstd/deprecated/zbuff.h +3 -1
  24. data/ext/zstdruby/libzstd/dictBuilder/cover.c +16 -8
  25. data/ext/zstdruby/libzstd/dictBuilder/zdict.h +1 -1
  26. data/ext/zstdruby/libzstd/dll/example/build_package.bat +1 -0
  27. data/ext/zstdruby/libzstd/dll/libzstd.def +2 -0
  28. data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +122 -7
  29. data/ext/zstdruby/libzstd/legacy/zstd_v01.c +31 -0
  30. data/ext/zstdruby/libzstd/legacy/zstd_v01.h +8 -0
  31. data/ext/zstdruby/libzstd/legacy/zstd_v02.c +37 -0
  32. data/ext/zstdruby/libzstd/legacy/zstd_v02.h +8 -0
  33. data/ext/zstdruby/libzstd/legacy/zstd_v03.c +37 -0
  34. data/ext/zstdruby/libzstd/legacy/zstd_v03.h +8 -0
  35. data/ext/zstdruby/libzstd/legacy/zstd_v04.c +33 -0
  36. data/ext/zstdruby/libzstd/legacy/zstd_v04.h +8 -0
  37. data/ext/zstdruby/libzstd/legacy/zstd_v05.c +29 -0
  38. data/ext/zstdruby/libzstd/legacy/zstd_v05.h +7 -0
  39. data/ext/zstdruby/libzstd/legacy/zstd_v06.c +32 -1
  40. data/ext/zstdruby/libzstd/legacy/zstd_v06.h +7 -0
  41. data/ext/zstdruby/libzstd/legacy/zstd_v07.c +44 -6
  42. data/ext/zstdruby/libzstd/legacy/zstd_v07.h +8 -0
  43. data/ext/zstdruby/libzstd/zstd.h +87 -13
  44. data/lib/zstd-ruby/version.rb +1 -1
  45. metadata +2 -2
@@ -35,16 +35,19 @@
35
35
  /* **************************************************************
36
36
  * Compiler specifics
37
37
  ****************************************************************/
38
- #if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
39
- /* inline is defined */
40
- #elif defined(_MSC_VER) || defined(__GNUC__)
41
- # define inline __inline
42
- #else
43
- # define inline /* disable inline */
44
- #endif
45
-
46
38
  #ifdef _MSC_VER /* Visual Studio */
39
+ # define FORCE_INLINE static __forceinline
47
40
  # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
41
+ #else
42
+ # if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
43
+ # ifdef __GNUC__
44
+ # define FORCE_INLINE static inline __attribute__((always_inline))
45
+ # else
46
+ # define FORCE_INLINE static inline
47
+ # endif
48
+ # else
49
+ # define FORCE_INLINE static
50
+ # endif /* __STDC_VERSION__ */
48
51
  #endif
49
52
 
50
53
 
@@ -102,16 +105,16 @@ size_t HUF_readDTableX2 (HUF_DTable* DTable, const void* src, size_t srcSize)
102
105
 
103
106
  /* Table header */
104
107
  { DTableDesc dtd = HUF_getDTableDesc(DTable);
105
- if (tableLog > (U32)(dtd.maxTableLog+1)) return ERROR(tableLog_tooLarge); /* DTable too small, huffman tree cannot fit in */
108
+ if (tableLog > (U32)(dtd.maxTableLog+1)) return ERROR(tableLog_tooLarge); /* DTable too small, Huffman tree cannot fit in */
106
109
  dtd.tableType = 0;
107
110
  dtd.tableLog = (BYTE)tableLog;
108
111
  memcpy(DTable, &dtd, sizeof(dtd));
109
112
  }
110
113
 
111
- /* Prepare ranks */
114
+ /* Calculate starting value for each rank */
112
115
  { U32 n, nextRankStart = 0;
113
116
  for (n=1; n<tableLog+1; n++) {
114
- U32 current = nextRankStart;
117
+ U32 const current = nextRankStart;
115
118
  nextRankStart += (rankVal[n] << (n-1));
116
119
  rankVal[n] = current;
117
120
  } }
@@ -121,11 +124,11 @@ size_t HUF_readDTableX2 (HUF_DTable* DTable, const void* src, size_t srcSize)
121
124
  for (n=0; n<nbSymbols; n++) {
122
125
  U32 const w = huffWeight[n];
123
126
  U32 const length = (1 << w) >> 1;
124
- U32 i;
127
+ U32 u;
125
128
  HUF_DEltX2 D;
126
129
  D.byte = (BYTE)n; D.nbBits = (BYTE)(tableLog + 1 - w);
127
- for (i = rankVal[w]; i < rankVal[w] + length; i++)
128
- dt[i] = D;
130
+ for (u = rankVal[w]; u < rankVal[w] + length; u++)
131
+ dt[u] = D;
129
132
  rankVal[w] += length;
130
133
  } }
131
134
 
@@ -152,7 +155,7 @@ static BYTE HUF_decodeSymbolX2(BIT_DStream_t* Dstream, const HUF_DEltX2* dt, con
152
155
  if (MEM_64bits()) \
153
156
  HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
154
157
 
155
- static inline size_t HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, const HUF_DEltX2* const dt, const U32 dtLog)
158
+ FORCE_INLINE size_t HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, const HUF_DEltX2* const dt, const U32 dtLog)
156
159
  {
157
160
  BYTE* const pStart = p;
158
161
 
@@ -459,7 +462,7 @@ size_t HUF_readDTableX4 (HUF_DTable* DTable, const void* src, size_t srcSize)
459
462
  void* dtPtr = DTable+1; /* force compiler to avoid strict-aliasing */
460
463
  HUF_DEltX4* const dt = (HUF_DEltX4*)dtPtr;
461
464
 
462
- HUF_STATIC_ASSERT(sizeof(HUF_DEltX4) == sizeof(HUF_DTable)); /* if compilation fails here, assertion is false */
465
+ HUF_STATIC_ASSERT(sizeof(HUF_DEltX4) == sizeof(HUF_DTable)); /* if compiler fails here, assertion is wrong */
463
466
  if (maxTableLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge);
464
467
  /* memset(weightList, 0, sizeof(weightList)); */ /* is not necessary, even though some analyzer complain ... */
465
468
 
@@ -559,7 +562,7 @@ static U32 HUF_decodeLastSymbolX4(void* op, BIT_DStream_t* DStream, const HUF_DE
559
562
  if (MEM_64bits()) \
560
563
  ptr += HUF_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
561
564
 
562
- static inline size_t HUF_decodeStreamX4(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, const HUF_DEltX4* const dt, const U32 dtLog)
565
+ FORCE_INLINE size_t HUF_decodeStreamX4(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, const HUF_DEltX4* const dt, const U32 dtLog)
563
566
  {
564
567
  BYTE* const pStart = p;
565
568