zstd-ruby 1.5.0.0 → 1.5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -2
  3. data/README.md +1 -1
  4. data/ext/zstdruby/extconf.rb +1 -0
  5. data/ext/zstdruby/libzstd/Makefile +50 -175
  6. data/ext/zstdruby/libzstd/README.md +7 -1
  7. data/ext/zstdruby/libzstd/common/bitstream.h +24 -9
  8. data/ext/zstdruby/libzstd/common/compiler.h +89 -43
  9. data/ext/zstdruby/libzstd/common/entropy_common.c +11 -5
  10. data/ext/zstdruby/libzstd/common/error_private.h +79 -0
  11. data/ext/zstdruby/libzstd/common/fse.h +2 -1
  12. data/ext/zstdruby/libzstd/common/fse_decompress.c +1 -1
  13. data/ext/zstdruby/libzstd/common/huf.h +24 -22
  14. data/ext/zstdruby/libzstd/common/mem.h +18 -0
  15. data/ext/zstdruby/libzstd/common/portability_macros.h +131 -0
  16. data/ext/zstdruby/libzstd/common/xxhash.c +5 -805
  17. data/ext/zstdruby/libzstd/common/xxhash.h +5568 -167
  18. data/ext/zstdruby/libzstd/common/zstd_internal.h +92 -88
  19. data/ext/zstdruby/libzstd/common/zstd_trace.h +12 -3
  20. data/ext/zstdruby/libzstd/compress/clevels.h +134 -0
  21. data/ext/zstdruby/libzstd/compress/fse_compress.c +63 -27
  22. data/ext/zstdruby/libzstd/compress/huf_compress.c +537 -104
  23. data/ext/zstdruby/libzstd/compress/zstd_compress.c +194 -278
  24. data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +102 -44
  25. data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +4 -3
  26. data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +3 -1
  27. data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +5 -4
  28. data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +3 -2
  29. data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +3 -3
  30. data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +289 -114
  31. data/ext/zstdruby/libzstd/compress/zstd_fast.c +302 -123
  32. data/ext/zstdruby/libzstd/compress/zstd_lazy.c +418 -502
  33. data/ext/zstdruby/libzstd/compress/zstd_ldm.c +4 -4
  34. data/ext/zstdruby/libzstd/compress/zstd_ldm.h +1 -1
  35. data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +4 -1
  36. data/ext/zstdruby/libzstd/compress/zstd_opt.c +186 -108
  37. data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +59 -29
  38. data/ext/zstdruby/libzstd/decompress/huf_decompress.c +727 -189
  39. data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +571 -0
  40. data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +85 -22
  41. data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +744 -220
  42. data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +8 -2
  43. data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +34 -3
  44. data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +23 -3
  45. data/ext/zstdruby/libzstd/dictBuilder/cover.c +9 -2
  46. data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +11 -4
  47. data/ext/zstdruby/libzstd/dictBuilder/zdict.c +99 -28
  48. data/ext/zstdruby/libzstd/legacy/zstd_v01.c +2 -6
  49. data/ext/zstdruby/libzstd/legacy/zstd_v02.c +3 -7
  50. data/ext/zstdruby/libzstd/legacy/zstd_v03.c +3 -7
  51. data/ext/zstdruby/libzstd/legacy/zstd_v04.c +3 -7
  52. data/ext/zstdruby/libzstd/legacy/zstd_v05.c +3 -7
  53. data/ext/zstdruby/libzstd/legacy/zstd_v06.c +3 -7
  54. data/ext/zstdruby/libzstd/legacy/zstd_v07.c +3 -7
  55. data/ext/zstdruby/libzstd/libzstd.mk +185 -0
  56. data/ext/zstdruby/libzstd/libzstd.pc.in +1 -0
  57. data/ext/zstdruby/libzstd/modulemap/module.modulemap +4 -0
  58. data/ext/zstdruby/libzstd/zdict.h +4 -4
  59. data/ext/zstdruby/libzstd/zstd.h +179 -136
  60. data/ext/zstdruby/zstdruby.c +2 -2
  61. data/lib/zstd-ruby/version.rb +1 -1
  62. metadata +8 -3
@@ -0,0 +1,185 @@
1
+ # ################################################################
2
+ # Copyright (c) Yann Collet, Facebook, Inc.
3
+ # All rights reserved.
4
+ #
5
+ # This source code is licensed under both the BSD-style license (found in the
6
+ # LICENSE file in the root directory of this source tree) and the GPLv2 (found
7
+ # in the COPYING file in the root directory of this source tree).
8
+ # You may select, at your option, one of the above-listed licenses.
9
+ # ################################################################
10
+
11
+ ##################################################################
12
+ # Input Variables
13
+ ##################################################################
14
+
15
+ # Zstd lib directory
16
+ LIBZSTD ?= ./
17
+
18
+ # Legacy support
19
+ ZSTD_LEGACY_SUPPORT ?= 5
20
+ ZSTD_LEGACY_MULTITHREADED_API ?= 0
21
+
22
+ # Build size optimizations
23
+ HUF_FORCE_DECOMPRESS_X1 ?= 0
24
+ HUF_FORCE_DECOMPRESS_X2 ?= 0
25
+ ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 0
26
+ ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG ?= 0
27
+ ZSTD_NO_INLINE ?= 0
28
+ ZSTD_STRIP_ERROR_STRINGS ?= 0
29
+
30
+ # Assembly support
31
+ ZSTD_NO_ASM ?= 0
32
+
33
+ ##################################################################
34
+ # libzstd helpers
35
+ ##################################################################
36
+
37
+ # Make 4.3 doesn't support '\#' anymore (https://lwn.net/Articles/810071/)
38
+ NUM_SYMBOL := \#
39
+
40
+ # define silent mode as default (verbose mode with V=1 or VERBOSE=1)
41
+ $(V)$(VERBOSE).SILENT:
42
+
43
+ # When cross-compiling from linux to windows,
44
+ # one might need to specify TARGET_SYSTEM as "Windows."
45
+ # Building from Fedora fails without it.
46
+ # (but Ubuntu and Debian don't need to set anything)
47
+ TARGET_SYSTEM ?= $(OS)
48
+
49
+ # Version numbers
50
+ LIBVER_SRC := $(LIBZSTD)/zstd.h
51
+ LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
52
+ LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
53
+ LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)`
54
+ LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
55
+ LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT))
56
+ LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
57
+ LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
58
+ LIBVER := $(shell echo $(LIBVER_SCRIPT))
59
+ CCVER := $(shell $(CC) --version)
60
+ ZSTD_VERSION?= $(LIBVER)
61
+
62
+ # ZSTD_LIB_MINIFY is a helper variable that
63
+ # configures a bunch of other variables to space-optimized defaults.
64
+ ZSTD_LIB_MINIFY ?= 0
65
+ ifneq ($(ZSTD_LIB_MINIFY), 0)
66
+ HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0)
67
+ ZSTD_LEGACY_SUPPORT ?= 0
68
+ ZSTD_LIB_DEPRECATED ?= 0
69
+ HUF_FORCE_DECOMPRESS_X1 ?= 1
70
+ ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 1
71
+ ZSTD_NO_INLINE ?= 1
72
+ ZSTD_STRIP_ERROR_STRINGS ?= 1
73
+ ifneq ($(HAVE_CC_OZ), 0)
74
+ # Some compilers (clang) support an even more space-optimized setting.
75
+ CFLAGS += -Oz
76
+ else
77
+ CFLAGS += -Os
78
+ endif
79
+ CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \
80
+ -DDYNAMIC_BMI2=0 -DNDEBUG
81
+ else
82
+ CFLAGS += -O3
83
+ endif
84
+
85
+ DEBUGLEVEL ?= 0
86
+ CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL)
87
+ ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed
88
+ CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting
89
+ endif
90
+ DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
91
+ -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
92
+ -Wstrict-prototypes -Wundef -Wpointer-arith \
93
+ -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
94
+ -Wredundant-decls -Wmissing-prototypes -Wc++-compat
95
+ CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
96
+ LDFLAGS += $(MOREFLAGS)
97
+ FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
98
+
99
+ HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
100
+ GREP_OPTIONS ?=
101
+ ifeq ($HAVE_COLORNEVER, 1)
102
+ GREP_OPTIONS += --color=never
103
+ endif
104
+ GREP = grep $(GREP_OPTIONS)
105
+ SED_ERE_OPT ?= -E
106
+
107
+ ZSTD_COMMON_FILES := $(sort $(wildcard $(LIBZSTD)/common/*.c))
108
+ ZSTD_COMPRESS_FILES := $(sort $(wildcard $(LIBZSTD)/compress/*.c))
109
+ ZSTD_DECOMPRESS_FILES := $(sort $(wildcard $(LIBZSTD)/decompress/*.c))
110
+ ZSTD_DICTBUILDER_FILES := $(sort $(wildcard $(LIBZSTD)/dictBuilder/*.c))
111
+ ZSTD_DEPRECATED_FILES := $(sort $(wildcard $(LIBZSTD)/deprecated/*.c))
112
+ ZSTD_LEGACY_FILES :=
113
+
114
+ ZSTD_DECOMPRESS_AMD64_ASM_FILES := $(sort $(wildcard $(LIBZSTD)/decompress/*_amd64.S))
115
+
116
+ ifneq ($(ZSTD_NO_ASM), 0)
117
+ CPPFLAGS += -DZSTD_DISABLE_ASM
118
+ else
119
+ # Unconditionally add the ASM files they are disabled by
120
+ # macros in the .S file.
121
+ ZSTD_DECOMPRESS_FILES += $(ZSTD_DECOMPRESS_AMD64_ASM_FILES)
122
+ endif
123
+
124
+ ifneq ($(HUF_FORCE_DECOMPRESS_X1), 0)
125
+ CFLAGS += -DHUF_FORCE_DECOMPRESS_X1
126
+ endif
127
+
128
+ ifneq ($(HUF_FORCE_DECOMPRESS_X2), 0)
129
+ CFLAGS += -DHUF_FORCE_DECOMPRESS_X2
130
+ endif
131
+
132
+ ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT), 0)
133
+ CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
134
+ endif
135
+
136
+ ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG), 0)
137
+ CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
138
+ endif
139
+
140
+ ifneq ($(ZSTD_NO_INLINE), 0)
141
+ CFLAGS += -DZSTD_NO_INLINE
142
+ endif
143
+
144
+ ifneq ($(ZSTD_STRIP_ERROR_STRINGS), 0)
145
+ CFLAGS += -DZSTD_STRIP_ERROR_STRINGS
146
+ endif
147
+
148
+ ifneq ($(ZSTD_LEGACY_MULTITHREADED_API), 0)
149
+ CFLAGS += -DZSTD_LEGACY_MULTITHREADED_API
150
+ endif
151
+
152
+ ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
153
+ ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
154
+ ZSTD_LEGACY_FILES += $(shell ls $(LIBZSTD)/legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
155
+ endif
156
+ endif
157
+ CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT)
158
+
159
+ UNAME := $(shell uname)
160
+
161
+ ifndef BUILD_DIR
162
+ ifeq ($(UNAME), Darwin)
163
+ ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0)
164
+ HASH ?= md5
165
+ endif
166
+ else ifeq ($(UNAME), FreeBSD)
167
+ HASH ?= gmd5sum
168
+ else ifeq ($(UNAME), NetBSD)
169
+ HASH ?= md5 -n
170
+ else ifeq ($(UNAME), OpenBSD)
171
+ HASH ?= md5
172
+ endif
173
+ HASH ?= md5sum
174
+
175
+ HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " " )
176
+ HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0)
177
+ ifeq ($(HAVE_HASH),0)
178
+ $(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags)
179
+ BUILD_DIR := obj/generic_noconf
180
+ endif
181
+ endif # BUILD_DIR
182
+
183
+ ZSTD_SUBDIR := $(LIBZSTD)/common $(LIBZSTD)/compress $(LIBZSTD)/decompress $(LIBZSTD)/dictBuilder $(LIBZSTD)/legacy $(LIBZSTD)/deprecated
184
+ vpath %.c $(ZSTD_SUBDIR)
185
+ vpath %.S $(ZSTD_SUBDIR)
@@ -12,4 +12,5 @@ Description: fast lossless compression algorithm library
12
12
  URL: http://www.zstd.net/
13
13
  Version: @VERSION@
14
14
  Libs: -L${libdir} -lzstd
15
+ Libs.private: @LIBS_PRIVATE@
15
16
  Cflags: -I${includedir}
@@ -0,0 +1,4 @@
1
+ module libzstd [extern_c] {
2
+ header "../zstd.h"
3
+ export *
4
+ }
@@ -46,7 +46,7 @@ extern "C" {
46
46
  *
47
47
  * Zstd can use dictionaries to improve compression ratio of small data.
48
48
  * Traditionally small files don't compress well because there is very little
49
- * repetion in a single sample, since it is small. But, if you are compressing
49
+ * repetition in a single sample, since it is small. But, if you are compressing
50
50
  * many similar files, like a bunch of JSON records that share the same
51
51
  * structure, you can train a dictionary on ahead of time on some samples of
52
52
  * these files. Then, zstd can use the dictionary to find repetitions that are
@@ -132,7 +132,7 @@ extern "C" {
132
132
  *
133
133
  * # Benchmark levels 1-3 without a dictionary
134
134
  * zstd -b1e3 -r /path/to/my/files
135
- * # Benchmark levels 1-3 with a dictioanry
135
+ * # Benchmark levels 1-3 with a dictionary
136
136
  * zstd -b1e3 -r /path/to/my/files -D /path/to/my/dictionary
137
137
  *
138
138
  * When should I retrain a dictionary?
@@ -237,7 +237,6 @@ typedef struct {
237
237
  * is presumed that the most profitable content is at the end of the dictionary,
238
238
  * since that is the cheapest to reference.
239
239
  *
240
- * `dictContentSize` must be >= ZDICT_CONTENTSIZE_MIN bytes.
241
240
  * `maxDictSize` must be >= max(dictContentSize, ZSTD_DICTSIZE_MIN).
242
241
  *
243
242
  * @return: size of dictionary stored into `dstDictBuffer` (<= `maxDictSize`),
@@ -272,8 +271,9 @@ ZDICTLIB_API const char* ZDICT_getErrorName(size_t errorCode);
272
271
  * Use them only in association with static linking.
273
272
  * ==================================================================================== */
274
273
 
275
- #define ZDICT_CONTENTSIZE_MIN 128
276
274
  #define ZDICT_DICTSIZE_MIN 256
275
+ /* Deprecated: Remove in v1.6.0 */
276
+ #define ZDICT_CONTENTSIZE_MIN 128
277
277
 
278
278
  /*! ZDICT_cover_params_t:
279
279
  * k and d are the only required parameters.