zstd-ruby 1.4.5.0 → 1.5.5.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 (115) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/README.md +78 -5
  4. data/Rakefile +8 -2
  5. data/ext/zstdruby/common.h +15 -0
  6. data/ext/zstdruby/extconf.rb +3 -2
  7. data/ext/zstdruby/libzstd/common/allocations.h +55 -0
  8. data/ext/zstdruby/libzstd/common/bits.h +200 -0
  9. data/ext/zstdruby/libzstd/common/bitstream.h +45 -62
  10. data/ext/zstdruby/libzstd/common/compiler.h +205 -22
  11. data/ext/zstdruby/libzstd/common/cpu.h +1 -3
  12. data/ext/zstdruby/libzstd/common/debug.c +1 -1
  13. data/ext/zstdruby/libzstd/common/debug.h +12 -19
  14. data/ext/zstdruby/libzstd/common/entropy_common.c +172 -48
  15. data/ext/zstdruby/libzstd/common/error_private.c +10 -2
  16. data/ext/zstdruby/libzstd/common/error_private.h +82 -3
  17. data/ext/zstdruby/libzstd/common/fse.h +37 -86
  18. data/ext/zstdruby/libzstd/common/fse_decompress.c +117 -92
  19. data/ext/zstdruby/libzstd/common/huf.h +99 -166
  20. data/ext/zstdruby/libzstd/common/mem.h +124 -142
  21. data/ext/zstdruby/libzstd/common/pool.c +54 -27
  22. data/ext/zstdruby/libzstd/common/pool.h +10 -4
  23. data/ext/zstdruby/libzstd/common/portability_macros.h +156 -0
  24. data/ext/zstdruby/libzstd/common/threading.c +74 -19
  25. data/ext/zstdruby/libzstd/common/threading.h +5 -10
  26. data/ext/zstdruby/libzstd/common/xxhash.c +7 -847
  27. data/ext/zstdruby/libzstd/common/xxhash.h +5568 -167
  28. data/ext/zstdruby/libzstd/common/zstd_common.c +2 -37
  29. data/ext/zstdruby/libzstd/common/zstd_deps.h +111 -0
  30. data/ext/zstdruby/libzstd/common/zstd_internal.h +132 -187
  31. data/ext/zstdruby/libzstd/common/zstd_trace.h +163 -0
  32. data/ext/zstdruby/libzstd/compress/clevels.h +134 -0
  33. data/ext/zstdruby/libzstd/compress/fse_compress.c +83 -157
  34. data/ext/zstdruby/libzstd/compress/hist.c +27 -29
  35. data/ext/zstdruby/libzstd/compress/hist.h +2 -2
  36. data/ext/zstdruby/libzstd/compress/huf_compress.c +916 -279
  37. data/ext/zstdruby/libzstd/compress/zstd_compress.c +3773 -1019
  38. data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +610 -203
  39. data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +119 -42
  40. data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +16 -6
  41. data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +42 -19
  42. data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +1 -1
  43. data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +49 -317
  44. data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +1 -1
  45. data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +320 -103
  46. data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +388 -151
  47. data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +3 -2
  48. data/ext/zstdruby/libzstd/compress/zstd_fast.c +729 -265
  49. data/ext/zstdruby/libzstd/compress/zstd_fast.h +3 -2
  50. data/ext/zstdruby/libzstd/compress/zstd_lazy.c +1270 -251
  51. data/ext/zstdruby/libzstd/compress/zstd_lazy.h +61 -1
  52. data/ext/zstdruby/libzstd/compress/zstd_ldm.c +324 -219
  53. data/ext/zstdruby/libzstd/compress/zstd_ldm.h +9 -2
  54. data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +106 -0
  55. data/ext/zstdruby/libzstd/compress/zstd_opt.c +481 -209
  56. data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
  57. data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +181 -457
  58. data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +34 -113
  59. data/ext/zstdruby/libzstd/decompress/huf_decompress.c +1199 -565
  60. data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +576 -0
  61. data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +12 -12
  62. data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +2 -2
  63. data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +627 -157
  64. data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +1086 -326
  65. data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +19 -5
  66. data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +62 -13
  67. data/ext/zstdruby/libzstd/dictBuilder/cover.c +73 -52
  68. data/ext/zstdruby/libzstd/dictBuilder/cover.h +7 -6
  69. data/ext/zstdruby/libzstd/dictBuilder/divsufsort.c +1 -1
  70. data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +44 -35
  71. data/ext/zstdruby/libzstd/dictBuilder/zdict.c +103 -111
  72. data/ext/zstdruby/libzstd/{dictBuilder/zdict.h → zdict.h} +203 -34
  73. data/ext/zstdruby/libzstd/zstd.h +1217 -287
  74. data/ext/zstdruby/libzstd/{common/zstd_errors.h → zstd_errors.h} +28 -8
  75. data/ext/zstdruby/main.c +20 -0
  76. data/ext/zstdruby/skippable_frame.c +63 -0
  77. data/ext/zstdruby/streaming_compress.c +177 -0
  78. data/ext/zstdruby/streaming_compress.h +5 -0
  79. data/ext/zstdruby/streaming_decompress.c +123 -0
  80. data/ext/zstdruby/zstdruby.c +114 -32
  81. data/lib/zstd-ruby/version.rb +1 -1
  82. data/lib/zstd-ruby.rb +0 -1
  83. data/zstd-ruby.gemspec +1 -1
  84. metadata +19 -36
  85. data/.travis.yml +0 -14
  86. data/ext/zstdruby/libzstd/.gitignore +0 -3
  87. data/ext/zstdruby/libzstd/BUCK +0 -234
  88. data/ext/zstdruby/libzstd/Makefile +0 -354
  89. data/ext/zstdruby/libzstd/README.md +0 -179
  90. data/ext/zstdruby/libzstd/deprecated/zbuff.h +0 -214
  91. data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +0 -26
  92. data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +0 -147
  93. data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +0 -75
  94. data/ext/zstdruby/libzstd/dll/example/Makefile +0 -48
  95. data/ext/zstdruby/libzstd/dll/example/README.md +0 -69
  96. data/ext/zstdruby/libzstd/dll/example/build_package.bat +0 -20
  97. data/ext/zstdruby/libzstd/dll/example/fullbench-dll.sln +0 -25
  98. data/ext/zstdruby/libzstd/dll/example/fullbench-dll.vcxproj +0 -181
  99. data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +0 -415
  100. data/ext/zstdruby/libzstd/legacy/zstd_v01.c +0 -2158
  101. data/ext/zstdruby/libzstd/legacy/zstd_v01.h +0 -94
  102. data/ext/zstdruby/libzstd/legacy/zstd_v02.c +0 -3518
  103. data/ext/zstdruby/libzstd/legacy/zstd_v02.h +0 -93
  104. data/ext/zstdruby/libzstd/legacy/zstd_v03.c +0 -3160
  105. data/ext/zstdruby/libzstd/legacy/zstd_v03.h +0 -93
  106. data/ext/zstdruby/libzstd/legacy/zstd_v04.c +0 -3647
  107. data/ext/zstdruby/libzstd/legacy/zstd_v04.h +0 -142
  108. data/ext/zstdruby/libzstd/legacy/zstd_v05.c +0 -4050
  109. data/ext/zstdruby/libzstd/legacy/zstd_v05.h +0 -162
  110. data/ext/zstdruby/libzstd/legacy/zstd_v06.c +0 -4154
  111. data/ext/zstdruby/libzstd/legacy/zstd_v06.h +0 -172
  112. data/ext/zstdruby/libzstd/legacy/zstd_v07.c +0 -4541
  113. data/ext/zstdruby/libzstd/legacy/zstd_v07.h +0 -187
  114. data/ext/zstdruby/libzstd/libzstd.pc.in +0 -15
  115. data/ext/zstdruby/zstdruby.h +0 -6
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -11,6 +11,8 @@
11
11
  #ifndef ZSTD_COMPILER_H
12
12
  #define ZSTD_COMPILER_H
13
13
 
14
+ #include "portability_macros.h"
15
+
14
16
  /*-*******************************************************
15
17
  * Compiler specifics
16
18
  *********************************************************/
@@ -38,6 +40,17 @@
38
40
 
39
41
  #endif
40
42
 
43
+ /**
44
+ On MSVC qsort requires that functions passed into it use the __cdecl calling conversion(CC).
45
+ This explicitly marks such functions as __cdecl so that the code will still compile
46
+ if a CC other than __cdecl has been made the default.
47
+ */
48
+ #if defined(_MSC_VER)
49
+ # define WIN_CDECL __cdecl
50
+ #else
51
+ # define WIN_CDECL
52
+ #endif
53
+
41
54
  /**
42
55
  * FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant
43
56
  * parameters. They must be inlined for the compiler to eliminate the constant
@@ -79,30 +92,19 @@
79
92
  # endif
80
93
  #endif
81
94
 
95
+
82
96
  /* target attribute */
83
- #ifndef __has_attribute
84
- #define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
85
- #endif
86
97
  #if defined(__GNUC__) || defined(__ICCARM__)
87
98
  # define TARGET_ATTRIBUTE(target) __attribute__((__target__(target)))
88
99
  #else
89
100
  # define TARGET_ATTRIBUTE(target)
90
101
  #endif
91
102
 
92
- /* Enable runtime BMI2 dispatch based on the CPU.
93
- * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default.
103
+ /* Target attribute for BMI2 dynamic dispatch.
104
+ * Enable lzcnt, bmi, and bmi2.
105
+ * We test for bmi1 & bmi2. lzcnt is included in bmi1.
94
106
  */
95
- #ifndef DYNAMIC_BMI2
96
- #if ((defined(__clang__) && __has_attribute(__target__)) \
97
- || (defined(__GNUC__) \
98
- && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \
99
- && (defined(__x86_64__) || defined(_M_X86)) \
100
- && !defined(__BMI2__)
101
- # define DYNAMIC_BMI2 1
102
- #else
103
- # define DYNAMIC_BMI2 0
104
- #endif
105
- #endif
107
+ #define BMI2_TARGET_ATTRIBUTE TARGET_ATTRIBUTE("lzcnt,bmi,bmi2")
106
108
 
107
109
  /* prefetch
108
110
  * can be disabled, by declaring NO_PREFETCH build macro */
@@ -114,12 +116,12 @@
114
116
  # include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */
115
117
  # define PREFETCH_L1(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0)
116
118
  # define PREFETCH_L2(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T1)
117
- # elif defined(__aarch64__)
118
- # define PREFETCH_L1(ptr) __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(ptr)))
119
- # define PREFETCH_L2(ptr) __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(ptr)))
120
119
  # elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) )
121
120
  # define PREFETCH_L1(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
122
121
  # define PREFETCH_L2(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
122
+ # elif defined(__aarch64__)
123
+ # define PREFETCH_L1(ptr) __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(ptr)))
124
+ # define PREFETCH_L2(ptr) __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(ptr)))
123
125
  # else
124
126
  # define PREFETCH_L1(ptr) (void)(ptr) /* disabled */
125
127
  # define PREFETCH_L2(ptr) (void)(ptr) /* disabled */
@@ -138,8 +140,9 @@
138
140
  }
139
141
 
140
142
  /* vectorization
141
- * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax */
142
- #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__)
143
+ * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax,
144
+ * and some compilers, like Intel ICC and MCST LCC, do not support it at all. */
145
+ #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && !defined(__LCC__)
143
146
  # if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5)
144
147
  # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
145
148
  # else
@@ -162,6 +165,12 @@
162
165
  #define UNLIKELY(x) (x)
163
166
  #endif
164
167
 
168
+ #if __has_builtin(__builtin_unreachable) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)))
169
+ # define ZSTD_UNREACHABLE { assert(0), __builtin_unreachable(); }
170
+ #else
171
+ # define ZSTD_UNREACHABLE { assert(0); }
172
+ #endif
173
+
165
174
  /* disable warnings */
166
175
  #ifdef _MSC_VER /* Visual Studio */
167
176
  # include <intrin.h> /* For Visual 2005 */
@@ -172,4 +181,178 @@
172
181
  # pragma warning(disable : 4324) /* disable: C4324: padded structure */
173
182
  #endif
174
183
 
184
+ /*Like DYNAMIC_BMI2 but for compile time determination of BMI2 support*/
185
+ #ifndef STATIC_BMI2
186
+ # if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86))
187
+ # ifdef __AVX2__ //MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2
188
+ # define STATIC_BMI2 1
189
+ # endif
190
+ # elif defined(__BMI2__) && defined(__x86_64__) && defined(__GNUC__)
191
+ # define STATIC_BMI2 1
192
+ # endif
193
+ #endif
194
+
195
+ #ifndef STATIC_BMI2
196
+ #define STATIC_BMI2 0
197
+ #endif
198
+
199
+ /* compile time determination of SIMD support */
200
+ #if !defined(ZSTD_NO_INTRINSICS)
201
+ # if defined(__SSE2__) || defined(_M_AMD64) || (defined (_M_IX86) && defined(_M_IX86_FP) && (_M_IX86_FP >= 2))
202
+ # define ZSTD_ARCH_X86_SSE2
203
+ # endif
204
+ # if defined(__ARM_NEON) || defined(_M_ARM64)
205
+ # define ZSTD_ARCH_ARM_NEON
206
+ # endif
207
+ #
208
+ # if defined(ZSTD_ARCH_X86_SSE2)
209
+ # include <emmintrin.h>
210
+ # elif defined(ZSTD_ARCH_ARM_NEON)
211
+ # include <arm_neon.h>
212
+ # endif
213
+ #endif
214
+
215
+ /* C-language Attributes are added in C23. */
216
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201710L) && defined(__has_c_attribute)
217
+ # define ZSTD_HAS_C_ATTRIBUTE(x) __has_c_attribute(x)
218
+ #else
219
+ # define ZSTD_HAS_C_ATTRIBUTE(x) 0
220
+ #endif
221
+
222
+ /* Only use C++ attributes in C++. Some compilers report support for C++
223
+ * attributes when compiling with C.
224
+ */
225
+ #if defined(__cplusplus) && defined(__has_cpp_attribute)
226
+ # define ZSTD_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
227
+ #else
228
+ # define ZSTD_HAS_CPP_ATTRIBUTE(x) 0
229
+ #endif
230
+
231
+ /* Define ZSTD_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute.
232
+ * - C23: https://en.cppreference.com/w/c/language/attributes/fallthrough
233
+ * - CPP17: https://en.cppreference.com/w/cpp/language/attributes/fallthrough
234
+ * - Else: __attribute__((__fallthrough__))
235
+ */
236
+ #ifndef ZSTD_FALLTHROUGH
237
+ # if ZSTD_HAS_C_ATTRIBUTE(fallthrough)
238
+ # define ZSTD_FALLTHROUGH [[fallthrough]]
239
+ # elif ZSTD_HAS_CPP_ATTRIBUTE(fallthrough)
240
+ # define ZSTD_FALLTHROUGH [[fallthrough]]
241
+ # elif __has_attribute(__fallthrough__)
242
+ /* Leading semicolon is to satisfy gcc-11 with -pedantic. Without the semicolon
243
+ * gcc complains about: a label can only be part of a statement and a declaration is not a statement.
244
+ */
245
+ # define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
246
+ # else
247
+ # define ZSTD_FALLTHROUGH
248
+ # endif
249
+ #endif
250
+
251
+ /*-**************************************************************
252
+ * Alignment check
253
+ *****************************************************************/
254
+
255
+ /* this test was initially positioned in mem.h,
256
+ * but this file is removed (or replaced) for linux kernel
257
+ * so it's now hosted in compiler.h,
258
+ * which remains valid for both user & kernel spaces.
259
+ */
260
+
261
+ #ifndef ZSTD_ALIGNOF
262
+ # if defined(__GNUC__) || defined(_MSC_VER)
263
+ /* covers gcc, clang & MSVC */
264
+ /* note : this section must come first, before C11,
265
+ * due to a limitation in the kernel source generator */
266
+ # define ZSTD_ALIGNOF(T) __alignof(T)
267
+
268
+ # elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
269
+ /* C11 support */
270
+ # include <stdalign.h>
271
+ # define ZSTD_ALIGNOF(T) alignof(T)
272
+
273
+ # else
274
+ /* No known support for alignof() - imperfect backup */
275
+ # define ZSTD_ALIGNOF(T) (sizeof(void*) < sizeof(T) ? sizeof(void*) : sizeof(T))
276
+
277
+ # endif
278
+ #endif /* ZSTD_ALIGNOF */
279
+
280
+ /*-**************************************************************
281
+ * Sanitizer
282
+ *****************************************************************/
283
+
284
+ /* Issue #3240 reports an ASAN failure on an llvm-mingw build. Out of an
285
+ * abundance of caution, disable our custom poisoning on mingw. */
286
+ #ifdef __MINGW32__
287
+ #ifndef ZSTD_ASAN_DONT_POISON_WORKSPACE
288
+ #define ZSTD_ASAN_DONT_POISON_WORKSPACE 1
289
+ #endif
290
+ #ifndef ZSTD_MSAN_DONT_POISON_WORKSPACE
291
+ #define ZSTD_MSAN_DONT_POISON_WORKSPACE 1
292
+ #endif
293
+ #endif
294
+
295
+ #if ZSTD_MEMORY_SANITIZER && !defined(ZSTD_MSAN_DONT_POISON_WORKSPACE)
296
+ /* Not all platforms that support msan provide sanitizers/msan_interface.h.
297
+ * We therefore declare the functions we need ourselves, rather than trying to
298
+ * include the header file... */
299
+ #include <stddef.h> /* size_t */
300
+ #define ZSTD_DEPS_NEED_STDINT
301
+ #include "zstd_deps.h" /* intptr_t */
302
+
303
+ /* Make memory region fully initialized (without changing its contents). */
304
+ void __msan_unpoison(const volatile void *a, size_t size);
305
+
306
+ /* Make memory region fully uninitialized (without changing its contents).
307
+ This is a legacy interface that does not update origin information. Use
308
+ __msan_allocated_memory() instead. */
309
+ void __msan_poison(const volatile void *a, size_t size);
310
+
311
+ /* Returns the offset of the first (at least partially) poisoned byte in the
312
+ memory range, or -1 if the whole range is good. */
313
+ intptr_t __msan_test_shadow(const volatile void *x, size_t size);
314
+
315
+ /* Print shadow and origin for the memory range to stderr in a human-readable
316
+ format. */
317
+ void __msan_print_shadow(const volatile void *x, size_t size);
318
+ #endif
319
+
320
+ #if ZSTD_ADDRESS_SANITIZER && !defined(ZSTD_ASAN_DONT_POISON_WORKSPACE)
321
+ /* Not all platforms that support asan provide sanitizers/asan_interface.h.
322
+ * We therefore declare the functions we need ourselves, rather than trying to
323
+ * include the header file... */
324
+ #include <stddef.h> /* size_t */
325
+
326
+ /**
327
+ * Marks a memory region (<c>[addr, addr+size)</c>) as unaddressable.
328
+ *
329
+ * This memory must be previously allocated by your program. Instrumented
330
+ * code is forbidden from accessing addresses in this region until it is
331
+ * unpoisoned. This function is not guaranteed to poison the entire region -
332
+ * it could poison only a subregion of <c>[addr, addr+size)</c> due to ASan
333
+ * alignment restrictions.
334
+ *
335
+ * \note This function is not thread-safe because no two threads can poison or
336
+ * unpoison memory in the same memory region simultaneously.
337
+ *
338
+ * \param addr Start of memory region.
339
+ * \param size Size of memory region. */
340
+ void __asan_poison_memory_region(void const volatile *addr, size_t size);
341
+
342
+ /**
343
+ * Marks a memory region (<c>[addr, addr+size)</c>) as addressable.
344
+ *
345
+ * This memory must be previously allocated by your program. Accessing
346
+ * addresses in this region is allowed until this region is poisoned again.
347
+ * This function could unpoison a super-region of <c>[addr, addr+size)</c> due
348
+ * to ASan alignment restrictions.
349
+ *
350
+ * \note This function is not thread-safe because no two threads can
351
+ * poison or unpoison memory in the same memory region simultaneously.
352
+ *
353
+ * \param addr Start of memory region.
354
+ * \param size Size of memory region. */
355
+ void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
356
+ #endif
357
+
175
358
  #endif /* ZSTD_COMPILER_H */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2018-2020, Facebook, Inc.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under both the BSD-style license (found in the
@@ -16,8 +16,6 @@
16
16
  * https://github.com/facebook/folly/blob/master/folly/CpuId.h
17
17
  */
18
18
 
19
- #include <string.h>
20
-
21
19
  #include "mem.h"
22
20
 
23
21
  #ifdef _MSC_VER
@@ -1,7 +1,7 @@
1
1
  /* ******************************************************************
2
2
  * debug
3
3
  * Part of FSE library
4
- * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
4
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
6
6
  * You can contact the author at :
7
7
  * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
@@ -1,7 +1,7 @@
1
1
  /* ******************************************************************
2
2
  * debug
3
3
  * Part of FSE library
4
- * Copyright (c) 2013-2020, Yann Collet, Facebook, Inc.
4
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
6
6
  * You can contact the author at :
7
7
  * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
@@ -51,15 +51,6 @@ extern "C" {
51
51
  #endif
52
52
 
53
53
 
54
- /* DEBUGFILE can be defined externally,
55
- * typically through compiler command line.
56
- * note : currently useless.
57
- * Value must be stderr or stdout */
58
- #ifndef DEBUGFILE
59
- # define DEBUGFILE stderr
60
- #endif
61
-
62
-
63
54
  /* recommended values for DEBUGLEVEL :
64
55
  * 0 : release mode, no debug, all run-time checks disabled
65
56
  * 1 : enables assert() only, no display
@@ -76,7 +67,8 @@ extern "C" {
76
67
  */
77
68
 
78
69
  #if (DEBUGLEVEL>=1)
79
- # include <assert.h>
70
+ # define ZSTD_DEPS_NEED_ASSERT
71
+ # include "zstd_deps.h"
80
72
  #else
81
73
  # ifndef assert /* assert may be already defined, due to prior #include <assert.h> */
82
74
  # define assert(condition) ((void)0) /* disable assert (default) */
@@ -84,7 +76,8 @@ extern "C" {
84
76
  #endif
85
77
 
86
78
  #if (DEBUGLEVEL>=2)
87
- # include <stdio.h>
79
+ # define ZSTD_DEPS_NEED_IO
80
+ # include "zstd_deps.h"
88
81
  extern int g_debuglevel; /* the variable is only declared,
89
82
  it actually lives in debug.c,
90
83
  and is shared by the whole process.
@@ -92,14 +85,14 @@ extern int g_debuglevel; /* the variable is only declared,
92
85
  It's useful when enabling very verbose levels
93
86
  on selective conditions (such as position in src) */
94
87
 
95
- # define RAWLOG(l, ...) { \
96
- if (l<=g_debuglevel) { \
97
- fprintf(stderr, __VA_ARGS__); \
88
+ # define RAWLOG(l, ...) { \
89
+ if (l<=g_debuglevel) { \
90
+ ZSTD_DEBUG_PRINT(__VA_ARGS__); \
98
91
  } }
99
- # define DEBUGLOG(l, ...) { \
100
- if (l<=g_debuglevel) { \
101
- fprintf(stderr, __FILE__ ": " __VA_ARGS__); \
102
- fprintf(stderr, " \n"); \
92
+ # define DEBUGLOG(l, ...) { \
93
+ if (l<=g_debuglevel) { \
94
+ ZSTD_DEBUG_PRINT(__FILE__ ": " __VA_ARGS__); \
95
+ ZSTD_DEBUG_PRINT(" \n"); \
103
96
  } }
104
97
  #else
105
98
  # define RAWLOG(l, ...) {} /* disabled */