zstd-ruby 1.4.4.0 → 1.4.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/zstdruby/libzstd/Makefile +123 -58
- data/ext/zstdruby/libzstd/README.md +34 -14
- data/ext/zstdruby/libzstd/common/bitstream.h +31 -37
- data/ext/zstdruby/libzstd/common/compiler.h +19 -3
- data/ext/zstdruby/libzstd/common/cpu.h +1 -1
- data/ext/zstdruby/libzstd/common/debug.c +11 -31
- data/ext/zstdruby/libzstd/common/debug.h +11 -31
- data/ext/zstdruby/libzstd/common/entropy_common.c +13 -33
- data/ext/zstdruby/libzstd/common/error_private.c +2 -1
- data/ext/zstdruby/libzstd/common/error_private.h +6 -2
- data/ext/zstdruby/libzstd/common/fse.h +11 -31
- data/ext/zstdruby/libzstd/common/fse_decompress.c +12 -37
- data/ext/zstdruby/libzstd/common/huf.h +15 -33
- data/ext/zstdruby/libzstd/common/mem.h +1 -1
- data/ext/zstdruby/libzstd/common/pool.c +1 -1
- data/ext/zstdruby/libzstd/common/pool.h +2 -2
- data/ext/zstdruby/libzstd/common/threading.c +4 -3
- data/ext/zstdruby/libzstd/common/threading.h +4 -3
- data/ext/zstdruby/libzstd/common/xxhash.c +15 -33
- data/ext/zstdruby/libzstd/common/xxhash.h +11 -31
- data/ext/zstdruby/libzstd/common/zstd_common.c +1 -1
- data/ext/zstdruby/libzstd/common/zstd_errors.h +2 -1
- data/ext/zstdruby/libzstd/common/zstd_internal.h +112 -15
- data/ext/zstdruby/libzstd/compress/fse_compress.c +17 -40
- data/ext/zstdruby/libzstd/compress/hist.c +15 -35
- data/ext/zstdruby/libzstd/compress/hist.h +12 -32
- data/ext/zstdruby/libzstd/compress/huf_compress.c +92 -92
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +450 -275
- data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +136 -14
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +10 -6
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +24 -20
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +10 -3
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +845 -0
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +32 -0
- data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +3 -13
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +11 -8
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +2 -2
- data/ext/zstdruby/libzstd/compress/zstd_fast.c +36 -24
- data/ext/zstdruby/libzstd/compress/zstd_fast.h +2 -2
- data/ext/zstdruby/libzstd/compress/zstd_lazy.c +34 -11
- data/ext/zstdruby/libzstd/compress/zstd_lazy.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_ldm.c +27 -5
- data/ext/zstdruby/libzstd/compress/zstd_ldm.h +7 -2
- data/ext/zstdruby/libzstd/compress/zstd_opt.c +38 -84
- data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +48 -21
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +2 -2
- data/ext/zstdruby/libzstd/decompress/huf_decompress.c +76 -62
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +12 -8
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +2 -2
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +264 -148
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +312 -203
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +3 -3
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +18 -4
- data/ext/zstdruby/libzstd/deprecated/zbuff.h +3 -3
- data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +2 -2
- data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +5 -5
- data/ext/zstdruby/libzstd/dictBuilder/cover.h +14 -4
- data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +14 -4
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +33 -9
- data/ext/zstdruby/libzstd/dictBuilder/zdict.h +51 -28
- data/ext/zstdruby/libzstd/dll/example/Makefile +2 -1
- data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v01.c +18 -12
- data/ext/zstdruby/libzstd/legacy/zstd_v01.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v02.c +10 -6
- data/ext/zstdruby/libzstd/legacy/zstd_v02.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v03.c +10 -6
- data/ext/zstdruby/libzstd/legacy/zstd_v03.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v04.c +13 -7
- data/ext/zstdruby/libzstd/legacy/zstd_v04.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v05.c +17 -13
- data/ext/zstdruby/libzstd/legacy/zstd_v05.h +2 -2
- data/ext/zstdruby/libzstd/legacy/zstd_v06.c +17 -13
- data/ext/zstdruby/libzstd/legacy/zstd_v06.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v07.c +22 -14
- data/ext/zstdruby/libzstd/legacy/zstd_v07.h +1 -1
- data/ext/zstdruby/libzstd/libzstd.pc.in +2 -2
- data/ext/zstdruby/libzstd/zstd.h +62 -21
- data/lib/zstd-ruby/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3fb9daf94529e91f7b648c1d29d5d562463553adb5d4ac420121bac1804fbeab
|
|
4
|
+
data.tar.gz: bdcebd2d2709f7b1c1736343846bf78c8b528237a78e45d3e7fd7c1473275ed4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e615781ba60a8525498fc5329917762411cfc4edf465ce9be06dbee5d9f08ff4bcf119142e2d61e5285f5efb94accc28d50f356d1f91cbf7d34d4531fb341f4
|
|
7
|
+
data.tar.gz: 87fa77e13997a63109ba65e6cf38ad429192ca62991bb600a27660762fc1381c4dfd3ea9e5561b3a17774b3e3967483a095481259bcd653aa72469c823aa929f
|
data/README.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
# ################################################################
|
|
2
|
-
# Copyright (c) 2015-
|
|
2
|
+
# Copyright (c) 2015-2020, 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
|
|
6
6
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
7
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
|
|
|
11
|
+
Q = $(if $(filter 1,$(V) $(VERBOSE)),,@)
|
|
12
|
+
|
|
13
|
+
# When cross-compiling from linux to windows, you might
|
|
14
|
+
# need to specify this as "Windows." Fedora build fails
|
|
15
|
+
# without it.
|
|
16
|
+
#
|
|
17
|
+
# Note: mingw-w64 build from linux to windows does not
|
|
18
|
+
# fail on other tested distros (ubuntu, debian) even
|
|
19
|
+
# without manually specifying the TARGET_SYSTEM.
|
|
20
|
+
TARGET_SYSTEM ?= $(OS)
|
|
21
|
+
|
|
10
22
|
# Version numbers
|
|
11
23
|
LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
|
|
12
24
|
LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
|
|
@@ -19,11 +31,10 @@ LIBVER := $(shell echo $(LIBVER_SCRIPT))
|
|
|
19
31
|
VERSION?= $(LIBVER)
|
|
20
32
|
CCVER := $(shell $(CC) --version)
|
|
21
33
|
|
|
22
|
-
CPPFLAGS+= -
|
|
23
|
-
ifeq ($(
|
|
34
|
+
CPPFLAGS+= -DXXH_NAMESPACE=ZSTD_
|
|
35
|
+
ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed
|
|
24
36
|
CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting
|
|
25
37
|
endif
|
|
26
|
-
CFLAGS ?= -O3
|
|
27
38
|
DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
|
28
39
|
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
|
29
40
|
-Wstrict-prototypes -Wundef -Wpointer-arith \
|
|
@@ -50,18 +61,46 @@ ifeq ($(findstring GCC,$(CCVER)),GCC)
|
|
|
50
61
|
decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize
|
|
51
62
|
endif
|
|
52
63
|
|
|
53
|
-
|
|
64
|
+
# This is a helper variable that configures a bunch of other variables to new,
|
|
65
|
+
# space-optimized defaults.
|
|
66
|
+
ZSTD_LIB_MINIFY ?= 0
|
|
67
|
+
ifneq ($(ZSTD_LIB_MINIFY), 0)
|
|
68
|
+
HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0)
|
|
69
|
+
ZSTD_LEGACY_SUPPORT ?= 0
|
|
70
|
+
ZSTD_LIB_DEPRECATED ?= 0
|
|
71
|
+
HUF_FORCE_DECOMPRESS_X1 ?= 1
|
|
72
|
+
ZSTD_FORCE_DECOMPRESS_SHORT ?= 1
|
|
73
|
+
ZSTD_NO_INLINE ?= 1
|
|
74
|
+
ZSTD_STRIP_ERROR_STRINGS ?= 1
|
|
75
|
+
ifneq ($(HAVE_CC_OZ), 0)
|
|
76
|
+
# Some compilers (clang) support an even more space-optimized setting.
|
|
77
|
+
CFLAGS += -Oz
|
|
78
|
+
else
|
|
79
|
+
CFLAGS += -Os
|
|
80
|
+
endif
|
|
81
|
+
CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \
|
|
82
|
+
-DDYNAMIC_BMI2=0 -DNDEBUG
|
|
83
|
+
else
|
|
84
|
+
CFLAGS += -O3
|
|
85
|
+
endif
|
|
86
|
+
|
|
87
|
+
# Modules
|
|
54
88
|
ZSTD_LIB_COMPRESSION ?= 1
|
|
55
89
|
ZSTD_LIB_DECOMPRESSION ?= 1
|
|
56
90
|
ZSTD_LIB_DICTBUILDER ?= 1
|
|
57
91
|
ZSTD_LIB_DEPRECATED ?= 1
|
|
92
|
+
|
|
93
|
+
# Legacy support
|
|
94
|
+
ZSTD_LEGACY_SUPPORT ?= 5
|
|
95
|
+
ZSTD_LEGACY_MULTITHREADED_API ?= 0
|
|
96
|
+
|
|
97
|
+
# Build size optimizations
|
|
58
98
|
HUF_FORCE_DECOMPRESS_X1 ?= 0
|
|
59
99
|
HUF_FORCE_DECOMPRESS_X2 ?= 0
|
|
60
100
|
ZSTD_FORCE_DECOMPRESS_SHORT ?= 0
|
|
61
101
|
ZSTD_FORCE_DECOMPRESS_LONG ?= 0
|
|
62
102
|
ZSTD_NO_INLINE ?= 0
|
|
63
103
|
ZSTD_STRIP_ERROR_STRINGS ?= 0
|
|
64
|
-
ZSTD_LEGACY_MULTITHREADED_API ?= 0
|
|
65
104
|
|
|
66
105
|
ifeq ($(ZSTD_LIB_COMPRESSION), 0)
|
|
67
106
|
ZSTD_LIB_DICTBUILDER = 0
|
|
@@ -121,7 +160,6 @@ ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
|
|
121
160
|
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
|
122
161
|
ZSTD_FILES += $(shell ls legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
|
|
123
162
|
endif
|
|
124
|
-
CPPFLAGS += -I./legacy
|
|
125
163
|
endif
|
|
126
164
|
CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT)
|
|
127
165
|
|
|
@@ -142,26 +180,26 @@ else
|
|
|
142
180
|
endif
|
|
143
181
|
|
|
144
182
|
|
|
145
|
-
.PHONY: default all clean install uninstall
|
|
183
|
+
.PHONY: default lib-all all clean install uninstall
|
|
146
184
|
|
|
147
185
|
default: lib-release
|
|
148
186
|
|
|
187
|
+
# alias
|
|
188
|
+
lib-all: all
|
|
189
|
+
|
|
149
190
|
all: lib
|
|
150
191
|
|
|
151
192
|
libzstd.a: ARFLAGS = rcs
|
|
152
193
|
libzstd.a: $(ZSTD_OBJ)
|
|
153
194
|
@echo compiling static library
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
libzstd.a-mt: CPPFLAGS += -DZSTD_MULTITHREAD
|
|
157
|
-
libzstd.a-mt: libzstd.a
|
|
195
|
+
$(Q)$(AR) $(ARFLAGS) $@ $^
|
|
158
196
|
|
|
159
|
-
ifneq (,$(filter Windows%,$(
|
|
197
|
+
ifneq (,$(filter Windows%,$(TARGET_SYSTEM)))
|
|
160
198
|
|
|
161
199
|
LIBZSTD = dll\libzstd.dll
|
|
162
200
|
$(LIBZSTD): $(ZSTD_FILES)
|
|
163
201
|
@echo compiling dynamic library $(LIBVER)
|
|
164
|
-
$(CC) $(FLAGS) -DZSTD_DLL_EXPORT=1 -Wl,--out-implib,dll\libzstd.
|
|
202
|
+
$(CC) $(FLAGS) -DZSTD_DLL_EXPORT=1 -Wl,--out-implib,dll\libzstd.dll.a -shared $^ -o $@
|
|
165
203
|
|
|
166
204
|
else
|
|
167
205
|
|
|
@@ -169,27 +207,30 @@ LIBZSTD = libzstd.$(SHARED_EXT_VER)
|
|
|
169
207
|
$(LIBZSTD): LDFLAGS += -shared -fPIC -fvisibility=hidden
|
|
170
208
|
$(LIBZSTD): $(ZSTD_FILES)
|
|
171
209
|
@echo compiling dynamic library $(LIBVER)
|
|
172
|
-
|
|
210
|
+
$(Q)$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@
|
|
173
211
|
@echo creating versioned links
|
|
174
|
-
|
|
175
|
-
|
|
212
|
+
$(Q)ln -sf $@ libzstd.$(SHARED_EXT_MAJOR)
|
|
213
|
+
$(Q)ln -sf $@ libzstd.$(SHARED_EXT)
|
|
176
214
|
|
|
177
215
|
endif
|
|
178
216
|
|
|
179
|
-
|
|
217
|
+
.PHONY: libzstd
|
|
180
218
|
libzstd : $(LIBZSTD)
|
|
181
219
|
|
|
182
|
-
|
|
183
|
-
|
|
220
|
+
.PHONY: lib
|
|
221
|
+
lib : libzstd.a libzstd
|
|
184
222
|
|
|
185
|
-
|
|
223
|
+
.PHONY: lib-mt
|
|
224
|
+
%-mt : CPPFLAGS += -DZSTD_MULTITHREAD
|
|
225
|
+
%-mt : LDFLAGS += -pthread
|
|
226
|
+
%-mt : %
|
|
227
|
+
@echo multi-threading build completed
|
|
186
228
|
|
|
187
|
-
|
|
188
|
-
|
|
229
|
+
.PHONY: lib-release
|
|
230
|
+
%-release : DEBUGFLAGS :=
|
|
231
|
+
%-release : %
|
|
232
|
+
@echo release build completed
|
|
189
233
|
|
|
190
|
-
lib-release lib-release-mt: DEBUGFLAGS :=
|
|
191
|
-
lib-release: lib
|
|
192
|
-
lib-release-mt: lib-mt
|
|
193
234
|
|
|
194
235
|
# Special case : building library in single-thread mode _and_ without zstdmt_compress.c
|
|
195
236
|
ZSTDMT_FILES = compress/zstdmt_compress.c
|
|
@@ -198,20 +239,22 @@ libzstd-nomt: LDFLAGS += -shared -fPIC -fvisibility=hidden
|
|
|
198
239
|
libzstd-nomt: $(ZSTD_NOMT_FILES)
|
|
199
240
|
@echo compiling single-thread dynamic library $(LIBVER)
|
|
200
241
|
@echo files : $(ZSTD_NOMT_FILES)
|
|
201
|
-
|
|
242
|
+
$(Q)$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@
|
|
202
243
|
|
|
203
244
|
clean:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
245
|
+
$(Q)$(RM) -r *.dSYM # macOS-specific
|
|
246
|
+
$(Q)$(RM) core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc
|
|
247
|
+
$(Q)$(RM) dll/libzstd.dll dll/libzstd.lib libzstd-nomt*
|
|
248
|
+
$(Q)$(RM) common/*.o compress/*.o decompress/*.o dictBuilder/*.o legacy/*.o deprecated/*.o
|
|
208
249
|
@echo Cleaning library completed
|
|
209
250
|
|
|
210
251
|
#-----------------------------------------------------------------------------
|
|
211
|
-
# make install is validated only for
|
|
252
|
+
# make install is validated only for below listed environments
|
|
212
253
|
#-----------------------------------------------------------------------------
|
|
213
254
|
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku))
|
|
214
255
|
|
|
256
|
+
all: libzstd.pc
|
|
257
|
+
|
|
215
258
|
DESTDIR ?=
|
|
216
259
|
# directory variables : GNU conventions prefer lowercase
|
|
217
260
|
# see https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
|
|
@@ -219,11 +262,31 @@ DESTDIR ?=
|
|
|
219
262
|
prefix ?= /usr/local
|
|
220
263
|
PREFIX ?= $(prefix)
|
|
221
264
|
exec_prefix ?= $(PREFIX)
|
|
222
|
-
|
|
265
|
+
EXEC_PREFIX ?= $(exec_prefix)
|
|
266
|
+
libdir ?= $(EXEC_PREFIX)/lib
|
|
223
267
|
LIBDIR ?= $(libdir)
|
|
224
268
|
includedir ?= $(PREFIX)/include
|
|
225
269
|
INCLUDEDIR ?= $(includedir)
|
|
226
270
|
|
|
271
|
+
PCLIBDIR ?= $(shell echo "$(LIBDIR)" | sed -n -E -e "s@^$(EXEC_PREFIX)(/|$$)@@p")
|
|
272
|
+
PCINCDIR ?= $(shell echo "$(INCLUDEDIR)" | sed -n -E -e "s@^$(PREFIX)(/|$$)@@p")
|
|
273
|
+
|
|
274
|
+
ifeq (,$(PCLIBDIR))
|
|
275
|
+
# Additional prefix check is required, since the empty string is technically a
|
|
276
|
+
# valid PCLIBDIR
|
|
277
|
+
ifeq (,$(shell echo "$(LIBDIR)" | sed -n -E -e "\\@^$(EXEC_PREFIX)(/|$$)@ p"))
|
|
278
|
+
$(error configured libdir ($(LIBDIR)) is outside of prefix ($(PREFIX)), can't generate pkg-config file)
|
|
279
|
+
endif
|
|
280
|
+
endif
|
|
281
|
+
|
|
282
|
+
ifeq (,$(PCINCDIR))
|
|
283
|
+
# Additional prefix check is required, since the empty string is technically a
|
|
284
|
+
# valid PCINCDIR
|
|
285
|
+
ifeq (,$(shell echo "$(INCLUDEDIR)" | sed -n -E -e "\\@^$(PREFIX)(/|$$)@ p"))
|
|
286
|
+
$(error configured includedir ($(INCLUDEDIR)) is outside of exec_prefix ($(EXEC_PREFIX)), can't generate pkg-config file)
|
|
287
|
+
endif
|
|
288
|
+
endif
|
|
289
|
+
|
|
227
290
|
ifneq (,$(filter $(shell uname),FreeBSD NetBSD DragonFly))
|
|
228
291
|
PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig
|
|
229
292
|
else
|
|
@@ -243,47 +306,49 @@ INSTALL_DATA ?= $(INSTALL) -m 644
|
|
|
243
306
|
libzstd.pc:
|
|
244
307
|
libzstd.pc: libzstd.pc.in
|
|
245
308
|
@echo creating pkgconfig
|
|
246
|
-
@sed -e 's|@PREFIX@|$(PREFIX)|' \
|
|
247
|
-
|
|
248
|
-
|
|
309
|
+
$(Q)@sed -E -e 's|@PREFIX@|$(PREFIX)|' \
|
|
310
|
+
-e 's|@LIBDIR@|$(PCLIBDIR)|' \
|
|
311
|
+
-e 's|@INCLUDEDIR@|$(PCINCDIR)|' \
|
|
312
|
+
-e 's|@VERSION@|$(VERSION)|' \
|
|
313
|
+
$< >$@
|
|
249
314
|
|
|
250
315
|
install: install-pc install-static install-shared install-includes
|
|
251
316
|
@echo zstd static and shared library installed
|
|
252
317
|
|
|
253
318
|
install-pc: libzstd.pc
|
|
254
|
-
|
|
255
|
-
|
|
319
|
+
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/
|
|
320
|
+
$(Q)$(INSTALL_DATA) libzstd.pc $(DESTDIR)$(PKGCONFIGDIR)/
|
|
256
321
|
|
|
257
322
|
install-static: libzstd.a
|
|
258
323
|
@echo Installing static library
|
|
259
|
-
|
|
260
|
-
|
|
324
|
+
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
|
|
325
|
+
$(Q)$(INSTALL_DATA) libzstd.a $(DESTDIR)$(LIBDIR)
|
|
261
326
|
|
|
262
327
|
install-shared: libzstd
|
|
263
328
|
@echo Installing shared library
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
329
|
+
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
|
|
330
|
+
$(Q)$(INSTALL_PROGRAM) $(LIBZSTD) $(DESTDIR)$(LIBDIR)
|
|
331
|
+
$(Q)ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
|
|
332
|
+
$(Q)ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
|
|
268
333
|
|
|
269
334
|
install-includes:
|
|
270
335
|
@echo Installing includes
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
336
|
+
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/
|
|
337
|
+
$(Q)$(INSTALL_DATA) zstd.h $(DESTDIR)$(INCLUDEDIR)
|
|
338
|
+
$(Q)$(INSTALL_DATA) common/zstd_errors.h $(DESTDIR)$(INCLUDEDIR)
|
|
339
|
+
$(Q)$(INSTALL_DATA) deprecated/zbuff.h $(DESTDIR)$(INCLUDEDIR) # prototypes generate deprecation warnings
|
|
340
|
+
$(Q)$(INSTALL_DATA) dictBuilder/zdict.h $(DESTDIR)$(INCLUDEDIR)
|
|
276
341
|
|
|
277
342
|
uninstall:
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
343
|
+
$(Q)$(RM) $(DESTDIR)$(LIBDIR)/libzstd.a
|
|
344
|
+
$(Q)$(RM) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
|
|
345
|
+
$(Q)$(RM) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
|
|
346
|
+
$(Q)$(RM) $(DESTDIR)$(LIBDIR)/$(LIBZSTD)
|
|
347
|
+
$(Q)$(RM) $(DESTDIR)$(PKGCONFIGDIR)/libzstd.pc
|
|
348
|
+
$(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/zstd.h
|
|
349
|
+
$(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/zstd_errors.h
|
|
350
|
+
$(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/zbuff.h # Deprecated streaming functions
|
|
351
|
+
$(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/zdict.h
|
|
287
352
|
@echo zstd libraries successfully uninstalled
|
|
288
353
|
|
|
289
354
|
endif
|
|
@@ -85,28 +85,48 @@ The file structure is designed to make this selection manually achievable for an
|
|
|
85
85
|
|
|
86
86
|
- While invoking `make libzstd`, it's possible to define build macros
|
|
87
87
|
`ZSTD_LIB_COMPRESSION, ZSTD_LIB_DECOMPRESSION`, `ZSTD_LIB_DICTBUILDER`,
|
|
88
|
-
and `ZSTD_LIB_DEPRECATED` as `0` to forgo compilation of the
|
|
89
|
-
This will also disable compilation of all
|
|
90
|
-
(eg. `ZSTD_LIB_COMPRESSION=0` will also disable
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
88
|
+
and `ZSTD_LIB_DEPRECATED` as `0` to forgo compilation of the
|
|
89
|
+
corresponding features. This will also disable compilation of all
|
|
90
|
+
dependencies (eg. `ZSTD_LIB_COMPRESSION=0` will also disable
|
|
91
|
+
dictBuilder).
|
|
92
|
+
|
|
93
|
+
- There are a number of options that can help minimize the binary size of
|
|
94
|
+
`libzstd`.
|
|
95
|
+
|
|
96
|
+
The first step is to select the components needed (using the above-described
|
|
97
|
+
`ZSTD_LIB_COMPRESSION` etc.).
|
|
98
|
+
|
|
99
|
+
The next step is to set `ZSTD_LIB_MINIFY` to `1` when invoking `make`. This
|
|
100
|
+
disables various optional components and changes the compilation flags to
|
|
101
|
+
prioritize space-saving.
|
|
102
|
+
|
|
103
|
+
Detailed options: Zstandard's code and build environment is set up by default
|
|
104
|
+
to optimize above all else for performance. In pursuit of this goal, Zstandard
|
|
105
|
+
makes significant trade-offs in code size. For example, Zstandard often has
|
|
106
|
+
more than one implementation of a particular component, with each
|
|
107
|
+
implementation optimized for different scenarios. For example, the Huffman
|
|
108
|
+
decoder has complementary implementations that decode the stream one symbol at
|
|
109
|
+
a time or two symbols at a time. Zstd normally includes both (and dispatches
|
|
110
|
+
between them at runtime), but by defining `HUF_FORCE_DECOMPRESS_X1` or
|
|
111
|
+
`HUF_FORCE_DECOMPRESS_X2`, you can force the use of one or the other, avoiding
|
|
100
112
|
compilation of the other. Similarly, `ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT`
|
|
101
113
|
and `ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG` force the compilation and use of
|
|
102
114
|
only one or the other of two decompression implementations. The smallest
|
|
103
115
|
binary is achieved by using `HUF_FORCE_DECOMPRESS_X1` and
|
|
104
|
-
`ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
|
|
116
|
+
`ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT` (implied by `ZSTD_LIB_MINIFY`).
|
|
105
117
|
|
|
106
118
|
For squeezing the last ounce of size out, you can also define
|
|
107
119
|
`ZSTD_NO_INLINE`, which disables inlining, and `ZSTD_STRIP_ERROR_STRINGS`,
|
|
108
120
|
which removes the error messages that are otherwise returned by
|
|
109
|
-
`ZSTD_getErrorName
|
|
121
|
+
`ZSTD_getErrorName` (implied by `ZSTD_LIB_MINIFY`).
|
|
122
|
+
|
|
123
|
+
Finally, when integrating into your application, make sure you're doing link-
|
|
124
|
+
time optimation and unused symbol garbage collection (via some combination of,
|
|
125
|
+
e.g., `-flto`, `-ffat-lto-objects`, `-fuse-linker-plugin`,
|
|
126
|
+
`-ffunction-sections`, `-fdata-sections`, `-fmerge-all-constants`,
|
|
127
|
+
`-Wl,--gc-sections`, `-Wl,-z,norelro`, and an archiver that understands
|
|
128
|
+
the compiler's intermediate representation, e.g., `AR=gcc-ar`). Consult your
|
|
129
|
+
compiler's documentation.
|
|
110
130
|
|
|
111
131
|
- While invoking `make libzstd`, the build macro `ZSTD_LEGACY_MULTITHREADED_API=1`
|
|
112
132
|
will expose the deprecated `ZSTDMT` API exposed by `zstdmt_compress.h` in
|
|
@@ -1,35 +1,15 @@
|
|
|
1
1
|
/* ******************************************************************
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
* bitstream
|
|
3
|
+
* Part of FSE library
|
|
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
14
|
#ifndef BITSTREAM_H_MODULE
|
|
35
15
|
#define BITSTREAM_H_MODULE
|
|
@@ -48,6 +28,7 @@ extern "C" {
|
|
|
48
28
|
* Dependencies
|
|
49
29
|
******************************************/
|
|
50
30
|
#include "mem.h" /* unaligned access routines */
|
|
31
|
+
#include "compiler.h" /* UNLIKELY() */
|
|
51
32
|
#include "debug.h" /* assert(), DEBUGLOG(), RAWLOG() */
|
|
52
33
|
#include "error_private.h" /* error codes and messages */
|
|
53
34
|
|
|
@@ -161,8 +142,7 @@ MEM_STATIC unsigned BIT_highbit32 (U32 val)
|
|
|
161
142
|
{
|
|
162
143
|
# if defined(_MSC_VER) /* Visual */
|
|
163
144
|
unsigned long r=0;
|
|
164
|
-
_BitScanReverse ( &r, val );
|
|
165
|
-
return (unsigned) r;
|
|
145
|
+
return _BitScanReverse ( &r, val ) ? (unsigned)r : 0;
|
|
166
146
|
# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
|
|
167
147
|
return __builtin_clz (val) ^ 31;
|
|
168
148
|
# elif defined(__ICCARM__) /* IAR Intrinsic */
|
|
@@ -411,6 +391,23 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits)
|
|
|
411
391
|
return value;
|
|
412
392
|
}
|
|
413
393
|
|
|
394
|
+
/*! BIT_reloadDStreamFast() :
|
|
395
|
+
* Similar to BIT_reloadDStream(), but with two differences:
|
|
396
|
+
* 1. bitsConsumed <= sizeof(bitD->bitContainer)*8 must hold!
|
|
397
|
+
* 2. Returns BIT_DStream_overflow when bitD->ptr < bitD->limitPtr, at this
|
|
398
|
+
* point you must use BIT_reloadDStream() to reload.
|
|
399
|
+
*/
|
|
400
|
+
MEM_STATIC BIT_DStream_status BIT_reloadDStreamFast(BIT_DStream_t* bitD)
|
|
401
|
+
{
|
|
402
|
+
if (UNLIKELY(bitD->ptr < bitD->limitPtr))
|
|
403
|
+
return BIT_DStream_overflow;
|
|
404
|
+
assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
|
|
405
|
+
bitD->ptr -= bitD->bitsConsumed >> 3;
|
|
406
|
+
bitD->bitsConsumed &= 7;
|
|
407
|
+
bitD->bitContainer = MEM_readLEST(bitD->ptr);
|
|
408
|
+
return BIT_DStream_unfinished;
|
|
409
|
+
}
|
|
410
|
+
|
|
414
411
|
/*! BIT_reloadDStream() :
|
|
415
412
|
* Refill `bitD` from buffer previously set in BIT_initDStream() .
|
|
416
413
|
* This function is safe, it guarantees it will not read beyond src buffer.
|
|
@@ -422,10 +419,7 @@ MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD)
|
|
|
422
419
|
return BIT_DStream_overflow;
|
|
423
420
|
|
|
424
421
|
if (bitD->ptr >= bitD->limitPtr) {
|
|
425
|
-
|
|
426
|
-
bitD->bitsConsumed &= 7;
|
|
427
|
-
bitD->bitContainer = MEM_readLEST(bitD->ptr);
|
|
428
|
-
return BIT_DStream_unfinished;
|
|
422
|
+
return BIT_reloadDStreamFast(bitD);
|
|
429
423
|
}
|
|
430
424
|
if (bitD->ptr == bitD->start) {
|
|
431
425
|
if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
|