zstd-ruby 1.4.9.0 → 1.5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/README.md +1 -1
  4. data/ext/zstdruby/libzstd/BUCK +5 -7
  5. data/ext/zstdruby/libzstd/Makefile +42 -13
  6. data/ext/zstdruby/libzstd/README.md +8 -4
  7. data/ext/zstdruby/libzstd/common/bitstream.h +1 -1
  8. data/ext/zstdruby/libzstd/common/compiler.h +1 -1
  9. data/ext/zstdruby/libzstd/common/cpu.h +1 -1
  10. data/ext/zstdruby/libzstd/common/debug.c +1 -1
  11. data/ext/zstdruby/libzstd/common/debug.h +1 -1
  12. data/ext/zstdruby/libzstd/common/entropy_common.c +1 -1
  13. data/ext/zstdruby/libzstd/common/error_private.c +1 -1
  14. data/ext/zstdruby/libzstd/common/error_private.h +3 -3
  15. data/ext/zstdruby/libzstd/common/fse.h +2 -2
  16. data/ext/zstdruby/libzstd/common/fse_decompress.c +25 -15
  17. data/ext/zstdruby/libzstd/common/huf.h +3 -2
  18. data/ext/zstdruby/libzstd/common/mem.h +3 -5
  19. data/ext/zstdruby/libzstd/common/pool.c +1 -1
  20. data/ext/zstdruby/libzstd/common/pool.h +1 -1
  21. data/ext/zstdruby/libzstd/common/xxhash.c +2 -4
  22. data/ext/zstdruby/libzstd/common/xxhash.h +1 -1
  23. data/ext/zstdruby/libzstd/common/zstd_common.c +1 -1
  24. data/ext/zstdruby/libzstd/common/zstd_deps.h +1 -1
  25. data/ext/zstdruby/libzstd/common/zstd_internal.h +21 -9
  26. data/ext/zstdruby/libzstd/common/zstd_trace.h +7 -5
  27. data/ext/zstdruby/libzstd/compress/fse_compress.c +1 -1
  28. data/ext/zstdruby/libzstd/compress/hist.c +1 -1
  29. data/ext/zstdruby/libzstd/compress/hist.h +1 -1
  30. data/ext/zstdruby/libzstd/compress/huf_compress.c +51 -28
  31. data/ext/zstdruby/libzstd/compress/zstd_compress.c +1373 -275
  32. data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +164 -21
  33. data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +2 -2
  34. data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +1 -1
  35. data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +14 -6
  36. data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +1 -1
  37. data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +5 -282
  38. data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +1 -1
  39. data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +147 -46
  40. data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +3 -3
  41. data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +1 -1
  42. data/ext/zstdruby/libzstd/compress/zstd_fast.c +4 -4
  43. data/ext/zstdruby/libzstd/compress/zstd_fast.h +1 -1
  44. data/ext/zstdruby/libzstd/compress/zstd_lazy.c +914 -142
  45. data/ext/zstdruby/libzstd/compress/zstd_lazy.h +39 -1
  46. data/ext/zstdruby/libzstd/compress/zstd_ldm.c +51 -15
  47. data/ext/zstdruby/libzstd/compress/zstd_ldm.h +2 -1
  48. data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +1 -1
  49. data/ext/zstdruby/libzstd/compress/zstd_opt.c +1 -1
  50. data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
  51. data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +15 -6
  52. data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +5 -5
  53. data/ext/zstdruby/libzstd/decompress/huf_decompress.c +44 -43
  54. data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +1 -1
  55. data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +1 -1
  56. data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +3 -4
  57. data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +44 -36
  58. data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +1 -1
  59. data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +1 -2
  60. data/ext/zstdruby/libzstd/deprecated/zbuff.h +1 -1
  61. data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +1 -1
  62. data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +1 -1
  63. data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +1 -1
  64. data/ext/zstdruby/libzstd/dictBuilder/cover.c +7 -6
  65. data/ext/zstdruby/libzstd/dictBuilder/cover.h +6 -5
  66. data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +7 -6
  67. data/ext/zstdruby/libzstd/dictBuilder/zdict.c +8 -7
  68. data/ext/zstdruby/libzstd/dll/example/Makefile +1 -1
  69. data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +1 -1
  70. data/ext/zstdruby/libzstd/legacy/zstd_v01.c +1 -1
  71. data/ext/zstdruby/libzstd/legacy/zstd_v01.h +1 -1
  72. data/ext/zstdruby/libzstd/legacy/zstd_v02.c +1 -1
  73. data/ext/zstdruby/libzstd/legacy/zstd_v02.h +1 -1
  74. data/ext/zstdruby/libzstd/legacy/zstd_v03.c +1 -1
  75. data/ext/zstdruby/libzstd/legacy/zstd_v03.h +1 -1
  76. data/ext/zstdruby/libzstd/legacy/zstd_v04.c +1 -1
  77. data/ext/zstdruby/libzstd/legacy/zstd_v04.h +1 -1
  78. data/ext/zstdruby/libzstd/legacy/zstd_v05.c +1 -1
  79. data/ext/zstdruby/libzstd/legacy/zstd_v05.h +1 -1
  80. data/ext/zstdruby/libzstd/legacy/zstd_v06.c +1 -1
  81. data/ext/zstdruby/libzstd/legacy/zstd_v06.h +1 -1
  82. data/ext/zstdruby/libzstd/legacy/zstd_v07.c +1 -1
  83. data/ext/zstdruby/libzstd/legacy/zstd_v07.h +1 -1
  84. data/ext/zstdruby/libzstd/{dictBuilder/zdict.h → zdict.h} +148 -2
  85. data/ext/zstdruby/libzstd/zstd.h +165 -83
  86. data/ext/zstdruby/libzstd/{common/zstd_errors.h → zstd_errors.h} +1 -1
  87. data/lib/zstd-ruby/version.rb +1 -1
  88. metadata +5 -5
  89. data/ext/zstdruby/libzstd/common/zstd_trace.c +0 -42
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -58,7 +58,6 @@
58
58
  #include "../common/zstd_deps.h" /* ZSTD_memcpy, ZSTD_memmove, ZSTD_memset */
59
59
  #include "../common/cpu.h" /* bmi2 */
60
60
  #include "../common/mem.h" /* low level memory routines */
61
- #include "../common/zstd_trace.h"
62
61
  #define FSE_STATIC_LINKING_ONLY
63
62
  #include "../common/fse.h"
64
63
  #define HUF_STATIC_LINKING_ONLY
@@ -789,7 +788,7 @@ static size_t ZSTD_setRleBlock(void* dst, size_t dstCapacity,
789
788
  static void ZSTD_DCtx_trace_end(ZSTD_DCtx const* dctx, U64 uncompressedSize, U64 compressedSize, unsigned streaming)
790
789
  {
791
790
  #if ZSTD_TRACE
792
- if (dctx->traceCtx) {
791
+ if (dctx->traceCtx && ZSTD_trace_decompress_end != NULL) {
793
792
  ZSTD_Trace trace;
794
793
  ZSTD_memset(&trace, 0, sizeof(trace));
795
794
  trace.version = ZSTD_VERSION_NUMBER;
@@ -1384,7 +1383,7 @@ size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx)
1384
1383
  {
1385
1384
  assert(dctx != NULL);
1386
1385
  #if ZSTD_TRACE
1387
- dctx->traceCtx = ZSTD_trace_decompress_begin(dctx);
1386
+ dctx->traceCtx = (ZSTD_trace_decompress_begin != NULL) ? ZSTD_trace_decompress_begin(dctx) : 0;
1388
1387
  #endif
1389
1388
  dctx->expected = ZSTD_startingInputLength(dctx->format); /* dctx->format must be properly set */
1390
1389
  dctx->stage = ZSTDds_getFrameHeaderSize;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -658,7 +658,6 @@ typedef struct {
658
658
  size_t litLength;
659
659
  size_t matchLength;
660
660
  size_t offset;
661
- const BYTE* match;
662
661
  } seq_t;
663
662
 
664
663
  typedef struct {
@@ -672,9 +671,6 @@ typedef struct {
672
671
  ZSTD_fseState stateOffb;
673
672
  ZSTD_fseState stateML;
674
673
  size_t prevOffset[ZSTD_REP_NUM];
675
- const BYTE* prefixStart;
676
- const BYTE* dictEnd;
677
- size_t pos;
678
674
  } seqState_t;
679
675
 
680
676
  /*! ZSTD_overlapCopy8() :
@@ -936,10 +932,9 @@ ZSTD_updateFseStateWithDInfo(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD, ZSTD
936
932
  : 0)
937
933
 
938
934
  typedef enum { ZSTD_lo_isRegularOffset, ZSTD_lo_isLongOffset=1 } ZSTD_longOffset_e;
939
- typedef enum { ZSTD_p_noPrefetch=0, ZSTD_p_prefetch=1 } ZSTD_prefetch_e;
940
935
 
941
936
  FORCE_INLINE_TEMPLATE seq_t
942
- ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets, const ZSTD_prefetch_e prefetch)
937
+ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
943
938
  {
944
939
  seq_t seq;
945
940
  ZSTD_seqSymbol const llDInfo = seqState->stateLL.table[seqState->stateLL.state];
@@ -1014,14 +1009,6 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets, c
1014
1009
  DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u",
1015
1010
  (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset);
1016
1011
 
1017
- if (prefetch == ZSTD_p_prefetch) {
1018
- size_t const pos = seqState->pos + seq.litLength;
1019
- const BYTE* const matchBase = (seq.offset > pos) ? seqState->dictEnd : seqState->prefixStart;
1020
- seq.match = matchBase + pos - seq.offset; /* note : this operation can overflow when seq.offset is really too large, which can only happen when input is corrupted.
1021
- * No consequence though : no memory access will occur, offset is only used for prefetching */
1022
- seqState->pos = pos + seq.matchLength;
1023
- }
1024
-
1025
1012
  /* ANS state update
1026
1013
  * gcc-9.0.0 does 2.5% worse with ZSTD_updateFseStateWithDInfo().
1027
1014
  * clang-9.2.0 does 7% worse with ZSTD_updateFseState().
@@ -1122,7 +1109,6 @@ ZSTD_decompressSequences_body( ZSTD_DCtx* dctx,
1122
1109
  /* Regen sequences */
1123
1110
  if (nbSeq) {
1124
1111
  seqState_t seqState;
1125
- size_t error = 0;
1126
1112
  dctx->fseEntropy = 1;
1127
1113
  { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
1128
1114
  RETURN_ERROR_IF(
@@ -1156,13 +1142,14 @@ ZSTD_decompressSequences_body( ZSTD_DCtx* dctx,
1156
1142
  * If you see most cycles served out of the DSB you've hit the good case.
1157
1143
  * If it is pretty even then you may be in an okay case.
1158
1144
  *
1159
- * I've been able to reproduce this issue on the following CPUs:
1145
+ * This issue has been reproduced on the following CPUs:
1160
1146
  * - Kabylake: Macbook Pro (15-inch, 2019) 2.4 GHz Intel Core i9
1161
1147
  * Use Instruments->Counters to get DSB/MITE cycles.
1162
1148
  * I never got performance swings, but I was able to
1163
1149
  * go from the good case of mostly DSB to half of the
1164
1150
  * cycles served from MITE.
1165
1151
  * - Coffeelake: Intel i9-9900k
1152
+ * - Coffeelake: Intel i7-9700k
1166
1153
  *
1167
1154
  * I haven't been able to reproduce the instability or DSB misses on any
1168
1155
  * of the following CPUS:
@@ -1175,33 +1162,35 @@ ZSTD_decompressSequences_body( ZSTD_DCtx* dctx,
1175
1162
  *
1176
1163
  * https://gist.github.com/terrelln/9889fc06a423fd5ca6e99351564473f4
1177
1164
  */
1165
+ __asm__(".p2align 6");
1166
+ __asm__("nop");
1178
1167
  __asm__(".p2align 5");
1179
1168
  __asm__("nop");
1169
+ # if __GNUC__ >= 9
1170
+ /* better for gcc-9 and gcc-10, worse for clang and gcc-8 */
1171
+ __asm__(".p2align 3");
1172
+ # else
1180
1173
  __asm__(".p2align 4");
1174
+ # endif
1181
1175
  #endif
1182
1176
  for ( ; ; ) {
1183
- seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, ZSTD_p_noPrefetch);
1177
+ seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset);
1184
1178
  size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litEnd, prefixStart, vBase, dictEnd);
1185
1179
  #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
1186
1180
  assert(!ZSTD_isError(oneSeqSize));
1187
1181
  if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
1188
1182
  #endif
1183
+ if (UNLIKELY(ZSTD_isError(oneSeqSize)))
1184
+ return oneSeqSize;
1189
1185
  DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
1190
- BIT_reloadDStream(&(seqState.DStream));
1191
1186
  op += oneSeqSize;
1192
- /* gcc and clang both don't like early returns in this loop.
1193
- * Instead break and check for an error at the end of the loop.
1194
- */
1195
- if (UNLIKELY(ZSTD_isError(oneSeqSize))) {
1196
- error = oneSeqSize;
1187
+ if (UNLIKELY(!--nbSeq))
1197
1188
  break;
1198
- }
1199
- if (UNLIKELY(!--nbSeq)) break;
1189
+ BIT_reloadDStream(&(seqState.DStream));
1200
1190
  }
1201
1191
 
1202
1192
  /* check if reached exact end */
1203
1193
  DEBUGLOG(5, "ZSTD_decompressSequences_body: after decode loop, remaining nbSeq : %i", nbSeq);
1204
- if (ZSTD_isError(error)) return error;
1205
1194
  RETURN_ERROR_IF(nbSeq, corruption_detected, "");
1206
1195
  RETURN_ERROR_IF(BIT_reloadDStream(&seqState.DStream) < BIT_DStream_completed, corruption_detected, "");
1207
1196
  /* save reps for next block */
@@ -1232,6 +1221,24 @@ ZSTD_decompressSequences_default(ZSTD_DCtx* dctx,
1232
1221
  #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG */
1233
1222
 
1234
1223
  #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
1224
+
1225
+ FORCE_INLINE_TEMPLATE size_t
1226
+ ZSTD_prefetchMatch(size_t prefetchPos, seq_t const sequence,
1227
+ const BYTE* const prefixStart, const BYTE* const dictEnd)
1228
+ {
1229
+ prefetchPos += sequence.litLength;
1230
+ { const BYTE* const matchBase = (sequence.offset > prefetchPos) ? dictEnd : prefixStart;
1231
+ const BYTE* const match = matchBase + prefetchPos - sequence.offset; /* note : this operation can overflow when seq.offset is really too large, which can only happen when input is corrupted.
1232
+ * No consequence though : memory address is only used for prefetching, not for dereferencing */
1233
+ PREFETCH_L1(match); PREFETCH_L1(match+CACHELINE_SIZE); /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */
1234
+ }
1235
+ return prefetchPos + sequence.matchLength;
1236
+ }
1237
+
1238
+ /* This decoding function employs prefetching
1239
+ * to reduce latency impact of cache misses.
1240
+ * It's generally employed when block contains a significant portion of long-distance matches
1241
+ * or when coupled with a "cold" dictionary */
1235
1242
  FORCE_INLINE_TEMPLATE size_t
1236
1243
  ZSTD_decompressSequencesLong_body(
1237
1244
  ZSTD_DCtx* dctx,
@@ -1254,18 +1261,17 @@ ZSTD_decompressSequencesLong_body(
1254
1261
 
1255
1262
  /* Regen sequences */
1256
1263
  if (nbSeq) {
1257
- #define STORED_SEQS 4
1264
+ #define STORED_SEQS 8
1258
1265
  #define STORED_SEQS_MASK (STORED_SEQS-1)
1259
- #define ADVANCED_SEQS 4
1266
+ #define ADVANCED_SEQS STORED_SEQS
1260
1267
  seq_t sequences[STORED_SEQS];
1261
1268
  int const seqAdvance = MIN(nbSeq, ADVANCED_SEQS);
1262
1269
  seqState_t seqState;
1263
1270
  int seqNb;
1271
+ size_t prefetchPos = (size_t)(op-prefixStart); /* track position relative to prefixStart */
1272
+
1264
1273
  dctx->fseEntropy = 1;
1265
1274
  { int i; for (i=0; i<ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
1266
- seqState.prefixStart = prefixStart;
1267
- seqState.pos = (size_t)(op-prefixStart);
1268
- seqState.dictEnd = dictEnd;
1269
1275
  assert(dst != NULL);
1270
1276
  assert(iend >= ip);
1271
1277
  RETURN_ERROR_IF(
@@ -1277,21 +1283,23 @@ ZSTD_decompressSequencesLong_body(
1277
1283
 
1278
1284
  /* prepare in advance */
1279
1285
  for (seqNb=0; (BIT_reloadDStream(&seqState.DStream) <= BIT_DStream_completed) && (seqNb<seqAdvance); seqNb++) {
1280
- sequences[seqNb] = ZSTD_decodeSequence(&seqState, isLongOffset, ZSTD_p_prefetch);
1281
- PREFETCH_L1(sequences[seqNb].match); PREFETCH_L1(sequences[seqNb].match + sequences[seqNb].matchLength - 1); /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */
1286
+ seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset);
1287
+ prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
1288
+ sequences[seqNb] = sequence;
1282
1289
  }
1283
1290
  RETURN_ERROR_IF(seqNb<seqAdvance, corruption_detected, "");
1284
1291
 
1285
1292
  /* decode and decompress */
1286
1293
  for ( ; (BIT_reloadDStream(&(seqState.DStream)) <= BIT_DStream_completed) && (seqNb<nbSeq) ; seqNb++) {
1287
- seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, ZSTD_p_prefetch);
1294
+ seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset);
1288
1295
  size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb-ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litEnd, prefixStart, dictStart, dictEnd);
1289
1296
  #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
1290
1297
  assert(!ZSTD_isError(oneSeqSize));
1291
1298
  if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb-ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart);
1292
1299
  #endif
1293
1300
  if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
1294
- PREFETCH_L1(sequence.match); PREFETCH_L1(sequence.match + sequence.matchLength - 1); /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */
1301
+
1302
+ prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
1295
1303
  sequences[seqNb & STORED_SEQS_MASK] = sequence;
1296
1304
  op += oneSeqSize;
1297
1305
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -21,7 +21,6 @@
21
21
  *********************************************************/
22
22
  #include "../common/mem.h" /* BYTE, U16, U32 */
23
23
  #include "../common/zstd_internal.h" /* ZSTD_seqSymbol */
24
- #include "../common/zstd_trace.h" /* ZSTD_TraceCtx */
25
24
 
26
25
 
27
26
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -26,15 +26,16 @@
26
26
  #include <string.h> /* memset */
27
27
  #include <time.h> /* clock */
28
28
 
29
+ #ifndef ZDICT_STATIC_LINKING_ONLY
30
+ # define ZDICT_STATIC_LINKING_ONLY
31
+ #endif
32
+
29
33
  #include "../common/mem.h" /* read */
30
34
  #include "../common/pool.h"
31
35
  #include "../common/threading.h"
32
- #include "cover.h"
33
36
  #include "../common/zstd_internal.h" /* includes zstd.h */
34
- #ifndef ZDICT_STATIC_LINKING_ONLY
35
- #define ZDICT_STATIC_LINKING_ONLY
36
- #endif
37
- #include "zdict.h"
37
+ #include "../zdict.h"
38
+ #include "cover.h"
38
39
 
39
40
  /*-*************************************
40
41
  * Constants
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2017-2021, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -8,6 +8,10 @@
8
8
  * You may select, at your option, one of the above-listed licenses.
9
9
  */
10
10
 
11
+ #ifndef ZDICT_STATIC_LINKING_ONLY
12
+ # define ZDICT_STATIC_LINKING_ONLY
13
+ #endif
14
+
11
15
  #include <stdio.h> /* fprintf */
12
16
  #include <stdlib.h> /* malloc, free, qsort */
13
17
  #include <string.h> /* memset */
@@ -16,10 +20,7 @@
16
20
  #include "../common/pool.h"
17
21
  #include "../common/threading.h"
18
22
  #include "../common/zstd_internal.h" /* includes zstd.h */
19
- #ifndef ZDICT_STATIC_LINKING_ONLY
20
- #define ZDICT_STATIC_LINKING_ONLY
21
- #endif
22
- #include "zdict.h"
23
+ #include "../zdict.h"
23
24
 
24
25
  /**
25
26
  * COVER_best_t is used for two purposes:
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2018-2021, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -16,16 +16,17 @@
16
16
  #include <string.h> /* memset */
17
17
  #include <time.h> /* clock */
18
18
 
19
+ #ifndef ZDICT_STATIC_LINKING_ONLY
20
+ # define ZDICT_STATIC_LINKING_ONLY
21
+ #endif
22
+
19
23
  #include "../common/mem.h" /* read */
20
24
  #include "../common/pool.h"
21
25
  #include "../common/threading.h"
22
- #include "cover.h"
23
26
  #include "../common/zstd_internal.h" /* includes zstd.h */
24
27
  #include "../compress/zstd_compress_internal.h" /* ZSTD_hash*() */
25
- #ifndef ZDICT_STATIC_LINKING_ONLY
26
- #define ZDICT_STATIC_LINKING_ONLY
27
- #endif
28
- #include "zdict.h"
28
+ #include "../zdict.h"
29
+ #include "cover.h"
29
30
 
30
31
 
31
32
  /*-*************************************
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -41,18 +41,19 @@
41
41
  #include <stdio.h> /* fprintf, fopen, ftello64 */
42
42
  #include <time.h> /* clock */
43
43
 
44
+ #ifndef ZDICT_STATIC_LINKING_ONLY
45
+ # define ZDICT_STATIC_LINKING_ONLY
46
+ #endif
47
+ #define HUF_STATIC_LINKING_ONLY
48
+
44
49
  #include "../common/mem.h" /* read */
45
50
  #include "../common/fse.h" /* FSE_normalizeCount, FSE_writeNCount */
46
- #define HUF_STATIC_LINKING_ONLY
47
51
  #include "../common/huf.h" /* HUF_buildCTable, HUF_writeCTable */
48
52
  #include "../common/zstd_internal.h" /* includes zstd.h */
49
53
  #include "../common/xxhash.h" /* XXH64 */
50
- #include "divsufsort.h"
51
- #ifndef ZDICT_STATIC_LINKING_ONLY
52
- # define ZDICT_STATIC_LINKING_ONLY
53
- #endif
54
- #include "zdict.h"
55
54
  #include "../compress/zstd_compress_internal.h" /* ZSTD_loadCEntropy() */
55
+ #include "../zdict.h"
56
+ #include "divsufsort.h"
56
57
 
57
58
 
58
59
  /*-*************************************
@@ -1,5 +1,5 @@
1
1
  # ################################################################
2
- # Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ # Copyright (c) Yann Collet, Facebook, Inc.
3
3
  # All rights reserved.
4
4
  #
5
5
  # This source code is licensed under both the BSD-style license (found in the
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Yann Collet, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the