zstdlib 0.3.0-x64-mingw32 → 0.8.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +30 -1
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/ext/zstdlib/extconf.rb +3 -3
- data/ext/zstdlib/ruby/zlib-2.7/zstdlib.c +4895 -0
- data/ext/zstdlib/ruby/zlib-3.0/zstdlib.c +4994 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/bitstream.h +59 -51
- data/ext/zstdlib/zstd-1.5.0/lib/common/compiler.h +289 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/cpu.h +1 -3
- data/ext/zstdlib/zstd-1.5.0/lib/common/debug.c +24 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/debug.h +22 -49
- data/ext/zstdlib/zstd-1.5.0/lib/common/entropy_common.c +362 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/error_private.c +3 -1
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/error_private.h +8 -4
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/fse.h +50 -42
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/fse_decompress.c +149 -55
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/huf.h +43 -39
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/mem.h +69 -25
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/pool.c +30 -20
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/pool.h +3 -3
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/threading.c +51 -4
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/threading.h +36 -4
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/xxhash.c +40 -92
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/xxhash.h +12 -32
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/common/zstd_common.c +10 -10
- data/ext/zstdlib/zstd-1.5.0/lib/common/zstd_deps.h +111 -0
- data/ext/zstdlib/zstd-1.5.0/lib/common/zstd_internal.h +490 -0
- data/ext/zstdlib/zstd-1.5.0/lib/common/zstd_trace.h +154 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/fse_compress.c +47 -63
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/hist.c +41 -63
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/hist.h +13 -33
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/huf_compress.c +332 -193
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress.c +6393 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_compress_internal.h +522 -86
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_compress_literals.c +25 -16
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_compress_literals.h +2 -2
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_compress_sequences.c +50 -24
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_compress_sequences.h +11 -4
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_superblock.c +572 -0
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_superblock.h +32 -0
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstd_cwksp.h +662 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_double_fast.c +43 -41
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_double_fast.h +2 -2
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_fast.c +85 -80
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_fast.h +2 -2
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstd_lazy.c +2184 -0
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstd_lazy.h +125 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_ldm.c +333 -208
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_ldm.h +15 -3
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstd_ldm_geartab.h +103 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_opt.c +228 -129
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstd_opt.h +1 -1
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/compress/zstdmt_compress.c +151 -440
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstdmt_compress.h +110 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/decompress/huf_decompress.c +395 -276
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/decompress/zstd_ddict.c +20 -16
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/decompress/zstd_ddict.h +3 -3
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/decompress/zstd_decompress.c +628 -231
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/decompress/zstd_decompress_block.c +606 -380
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/decompress/zstd_decompress_block.h +8 -5
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/decompress/zstd_decompress_internal.h +39 -9
- data/ext/zstdlib/zstd-1.5.0/lib/zdict.h +452 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/lib/zstd.h +740 -153
- data/ext/zstdlib/{zstd-1.4.2/lib/common → zstd-1.5.0/lib}/zstd_errors.h +3 -1
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/zlibWrapper/gzclose.c +1 -1
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/zlibWrapper/gzcompatibility.h +1 -1
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/zlibWrapper/gzguts.h +0 -0
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/zlibWrapper/gzlib.c +9 -9
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/zlibWrapper/gzread.c +16 -8
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/zlibWrapper/gzwrite.c +8 -8
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/zlibWrapper/zstd_zlibwrapper.c +131 -45
- data/ext/zstdlib/{zstd-1.4.2 → zstd-1.5.0}/zlibWrapper/zstd_zlibwrapper.h +1 -1
- data/lib/2.2/zstdlib.so +0 -0
- data/lib/2.3/zstdlib.so +0 -0
- data/lib/2.4/zstdlib.so +0 -0
- data/lib/2.5/zstdlib.so +0 -0
- data/lib/2.6/zstdlib.so +0 -0
- data/lib/2.7/zstdlib.so +0 -0
- metadata +76 -67
- data/ext/zstdlib/zstd-1.4.2/lib/common/compiler.h +0 -147
- data/ext/zstdlib/zstd-1.4.2/lib/common/debug.c +0 -44
- data/ext/zstdlib/zstd-1.4.2/lib/common/entropy_common.c +0 -236
- data/ext/zstdlib/zstd-1.4.2/lib/common/zstd_internal.h +0 -371
- data/ext/zstdlib/zstd-1.4.2/lib/compress/zstd_compress.c +0 -3904
- data/ext/zstdlib/zstd-1.4.2/lib/compress/zstd_lazy.c +0 -1111
- data/ext/zstdlib/zstd-1.4.2/lib/compress/zstd_lazy.h +0 -67
- data/ext/zstdlib/zstd-1.4.2/lib/compress/zstdmt_compress.h +0 -192
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c) 2016-
|
2
|
+
* Copyright (c) 2016-2021, Przemyslaw Skibinski, 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
|
data/lib/2.2/zstdlib.so
CHANGED
Binary file
|
data/lib/2.3/zstdlib.so
CHANGED
Binary file
|
data/lib/2.4/zstdlib.so
CHANGED
Binary file
|
data/lib/2.5/zstdlib.so
CHANGED
Binary file
|
data/lib/2.6/zstdlib.so
CHANGED
Binary file
|
data/lib/2.7/zstdlib.so
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zstdlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Oleg A. Khlybov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 1.0.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 1.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: test-unit
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,6 +98,8 @@ files:
|
|
98
98
|
- ext/zstdlib/ruby/zlib-2.4/zstdlib.c
|
99
99
|
- ext/zstdlib/ruby/zlib-2.5/zstdlib.c
|
100
100
|
- ext/zstdlib/ruby/zlib-2.6/zstdlib.c
|
101
|
+
- ext/zstdlib/ruby/zlib-2.7/zstdlib.c
|
102
|
+
- ext/zstdlib/ruby/zlib-3.0/zstdlib.c
|
101
103
|
- ext/zstdlib/zlib-1.2.11/adler32.c
|
102
104
|
- ext/zstdlib/zlib-1.2.11/compress.c
|
103
105
|
- ext/zstdlib/zlib-1.2.11/crc32.c
|
@@ -127,74 +129,82 @@ files:
|
|
127
129
|
- ext/zstdlib/zlib.mk
|
128
130
|
- ext/zstdlib/zlibwrapper.mk
|
129
131
|
- ext/zstdlib/zlibwrapper/zlibwrapper.c
|
130
|
-
- ext/zstdlib/zstd-1.
|
131
|
-
- ext/zstdlib/zstd-1.
|
132
|
-
- ext/zstdlib/zstd-1.
|
133
|
-
- ext/zstdlib/zstd-1.
|
134
|
-
- ext/zstdlib/zstd-1.
|
135
|
-
- ext/zstdlib/zstd-1.
|
136
|
-
- ext/zstdlib/zstd-1.
|
137
|
-
- ext/zstdlib/zstd-1.
|
138
|
-
- ext/zstdlib/zstd-1.
|
139
|
-
- ext/zstdlib/zstd-1.
|
140
|
-
- ext/zstdlib/zstd-1.
|
141
|
-
- ext/zstdlib/zstd-1.
|
142
|
-
- ext/zstdlib/zstd-1.
|
143
|
-
- ext/zstdlib/zstd-1.
|
144
|
-
- ext/zstdlib/zstd-1.
|
145
|
-
- ext/zstdlib/zstd-1.
|
146
|
-
- ext/zstdlib/zstd-1.
|
147
|
-
- ext/zstdlib/zstd-1.
|
148
|
-
- ext/zstdlib/zstd-1.
|
149
|
-
- ext/zstdlib/zstd-1.
|
150
|
-
- ext/zstdlib/zstd-1.
|
151
|
-
- ext/zstdlib/zstd-1.
|
152
|
-
- ext/zstdlib/zstd-1.
|
153
|
-
- ext/zstdlib/zstd-1.
|
154
|
-
- ext/zstdlib/zstd-1.
|
155
|
-
- ext/zstdlib/zstd-1.
|
156
|
-
- ext/zstdlib/zstd-1.
|
157
|
-
- ext/zstdlib/zstd-1.
|
158
|
-
- ext/zstdlib/zstd-1.
|
159
|
-
- ext/zstdlib/zstd-1.
|
160
|
-
- ext/zstdlib/zstd-1.
|
161
|
-
- ext/zstdlib/zstd-1.
|
162
|
-
- ext/zstdlib/zstd-1.
|
163
|
-
- ext/zstdlib/zstd-1.
|
164
|
-
- ext/zstdlib/zstd-1.
|
165
|
-
- ext/zstdlib/zstd-1.
|
166
|
-
- ext/zstdlib/zstd-1.
|
167
|
-
- ext/zstdlib/zstd-1.
|
168
|
-
- ext/zstdlib/zstd-1.
|
169
|
-
- ext/zstdlib/zstd-1.
|
170
|
-
- ext/zstdlib/zstd-1.
|
171
|
-
- ext/zstdlib/zstd-1.
|
172
|
-
- ext/zstdlib/zstd-1.
|
173
|
-
- ext/zstdlib/zstd-1.
|
174
|
-
- ext/zstdlib/zstd-1.
|
175
|
-
- ext/zstdlib/zstd-1.
|
176
|
-
- ext/zstdlib/zstd-1.
|
177
|
-
- ext/zstdlib/zstd-1.
|
178
|
-
- ext/zstdlib/zstd-1.
|
179
|
-
- ext/zstdlib/zstd-1.
|
180
|
-
- ext/zstdlib/zstd-1.
|
181
|
-
- ext/zstdlib/zstd-1.
|
182
|
-
- ext/zstdlib/zstd-1.
|
183
|
-
- ext/zstdlib/zstd-1.
|
184
|
-
- ext/zstdlib/zstd-1.
|
185
|
-
- ext/zstdlib/zstd-1.
|
186
|
-
- ext/zstdlib/zstd-1.
|
187
|
-
- ext/zstdlib/zstd-1.
|
188
|
-
- ext/zstdlib/zstd-1.
|
132
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/bitstream.h
|
133
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/compiler.h
|
134
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/cpu.h
|
135
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/debug.c
|
136
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/debug.h
|
137
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/entropy_common.c
|
138
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/error_private.c
|
139
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/error_private.h
|
140
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/fse.h
|
141
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/fse_decompress.c
|
142
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/huf.h
|
143
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/mem.h
|
144
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/pool.c
|
145
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/pool.h
|
146
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/threading.c
|
147
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/threading.h
|
148
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/xxhash.c
|
149
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/xxhash.h
|
150
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/zstd_common.c
|
151
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/zstd_deps.h
|
152
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/zstd_internal.h
|
153
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/zstd_trace.h
|
154
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/fse_compress.c
|
155
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/hist.c
|
156
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/hist.h
|
157
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/huf_compress.c
|
158
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress.c
|
159
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_internal.h
|
160
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_literals.c
|
161
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_literals.h
|
162
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_sequences.c
|
163
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_sequences.h
|
164
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_superblock.c
|
165
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_superblock.h
|
166
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_cwksp.h
|
167
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_double_fast.c
|
168
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_double_fast.h
|
169
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_fast.c
|
170
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_fast.h
|
171
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_lazy.c
|
172
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_lazy.h
|
173
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_ldm.c
|
174
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_ldm.h
|
175
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_ldm_geartab.h
|
176
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_opt.c
|
177
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_opt.h
|
178
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstdmt_compress.c
|
179
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstdmt_compress.h
|
180
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/huf_decompress.c
|
181
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_ddict.c
|
182
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_ddict.h
|
183
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_decompress.c
|
184
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_decompress_block.c
|
185
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_decompress_block.h
|
186
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_decompress_internal.h
|
187
|
+
- ext/zstdlib/zstd-1.5.0/lib/zdict.h
|
188
|
+
- ext/zstdlib/zstd-1.5.0/lib/zstd.h
|
189
|
+
- ext/zstdlib/zstd-1.5.0/lib/zstd_errors.h
|
190
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzclose.c
|
191
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzcompatibility.h
|
192
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzguts.h
|
193
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzlib.c
|
194
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzread.c
|
195
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzwrite.c
|
196
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/zstd_zlibwrapper.c
|
197
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/zstd_zlibwrapper.h
|
189
198
|
- ext/zstdlib/zstd.mk
|
190
199
|
- lib/2.2/zstdlib.so
|
191
200
|
- lib/2.3/zstdlib.so
|
192
201
|
- lib/2.4/zstdlib.so
|
193
202
|
- lib/2.5/zstdlib.so
|
194
203
|
- lib/2.6/zstdlib.so
|
204
|
+
- lib/2.7/zstdlib.so
|
195
205
|
- lib/zstdlib.rb
|
196
206
|
- test/zstdlib_test.rb
|
197
|
-
homepage: https://
|
207
|
+
homepage: https://github.com/okhlybov/zstdlib
|
198
208
|
licenses:
|
199
209
|
- BSD-3-Clause
|
200
210
|
metadata: {}
|
@@ -209,15 +219,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
219
|
version: '2.2'
|
210
220
|
- - "<"
|
211
221
|
- !ruby/object:Gem::Version
|
212
|
-
version: 2.
|
222
|
+
version: 2.8.dev
|
213
223
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
224
|
requirements:
|
215
225
|
- - ">="
|
216
226
|
- !ruby/object:Gem::Version
|
217
227
|
version: '0'
|
218
228
|
requirements: []
|
219
|
-
|
220
|
-
rubygems_version: 2.7.9
|
229
|
+
rubygems_version: 3.1.2
|
221
230
|
signing_key:
|
222
231
|
specification_version: 4
|
223
232
|
summary: Ruby interface for the Zstd data compression library
|
@@ -1,147 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2016-present, 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
|
-
#ifndef ZSTD_COMPILER_H
|
12
|
-
#define ZSTD_COMPILER_H
|
13
|
-
|
14
|
-
/*-*******************************************************
|
15
|
-
* Compiler specifics
|
16
|
-
*********************************************************/
|
17
|
-
/* force inlining */
|
18
|
-
|
19
|
-
#if !defined(ZSTD_NO_INLINE)
|
20
|
-
#if defined (__GNUC__) || defined(__cplusplus) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
|
21
|
-
# define INLINE_KEYWORD inline
|
22
|
-
#else
|
23
|
-
# define INLINE_KEYWORD
|
24
|
-
#endif
|
25
|
-
|
26
|
-
#if defined(__GNUC__)
|
27
|
-
# define FORCE_INLINE_ATTR __attribute__((always_inline))
|
28
|
-
#elif defined(_MSC_VER)
|
29
|
-
# define FORCE_INLINE_ATTR __forceinline
|
30
|
-
#else
|
31
|
-
# define FORCE_INLINE_ATTR
|
32
|
-
#endif
|
33
|
-
|
34
|
-
#else
|
35
|
-
|
36
|
-
#define INLINE_KEYWORD
|
37
|
-
#define FORCE_INLINE_ATTR
|
38
|
-
|
39
|
-
#endif
|
40
|
-
|
41
|
-
/**
|
42
|
-
* FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant
|
43
|
-
* parameters. They must be inlined for the compiler to eliminate the constant
|
44
|
-
* branches.
|
45
|
-
*/
|
46
|
-
#define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR
|
47
|
-
/**
|
48
|
-
* HINT_INLINE is used to help the compiler generate better code. It is *not*
|
49
|
-
* used for "templates", so it can be tweaked based on the compilers
|
50
|
-
* performance.
|
51
|
-
*
|
52
|
-
* gcc-4.8 and gcc-4.9 have been shown to benefit from leaving off the
|
53
|
-
* always_inline attribute.
|
54
|
-
*
|
55
|
-
* clang up to 5.0.0 (trunk) benefit tremendously from the always_inline
|
56
|
-
* attribute.
|
57
|
-
*/
|
58
|
-
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 && __GNUC__ < 5
|
59
|
-
# define HINT_INLINE static INLINE_KEYWORD
|
60
|
-
#else
|
61
|
-
# define HINT_INLINE static INLINE_KEYWORD FORCE_INLINE_ATTR
|
62
|
-
#endif
|
63
|
-
|
64
|
-
/* force no inlining */
|
65
|
-
#ifdef _MSC_VER
|
66
|
-
# define FORCE_NOINLINE static __declspec(noinline)
|
67
|
-
#else
|
68
|
-
# ifdef __GNUC__
|
69
|
-
# define FORCE_NOINLINE static __attribute__((__noinline__))
|
70
|
-
# else
|
71
|
-
# define FORCE_NOINLINE static
|
72
|
-
# endif
|
73
|
-
#endif
|
74
|
-
|
75
|
-
/* target attribute */
|
76
|
-
#ifndef __has_attribute
|
77
|
-
#define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
|
78
|
-
#endif
|
79
|
-
#if defined(__GNUC__)
|
80
|
-
# define TARGET_ATTRIBUTE(target) __attribute__((__target__(target)))
|
81
|
-
#else
|
82
|
-
# define TARGET_ATTRIBUTE(target)
|
83
|
-
#endif
|
84
|
-
|
85
|
-
/* Enable runtime BMI2 dispatch based on the CPU.
|
86
|
-
* Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default.
|
87
|
-
*/
|
88
|
-
#ifndef DYNAMIC_BMI2
|
89
|
-
#if ((defined(__clang__) && __has_attribute(__target__)) \
|
90
|
-
|| (defined(__GNUC__) \
|
91
|
-
&& (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \
|
92
|
-
&& (defined(__x86_64__) || defined(_M_X86)) \
|
93
|
-
&& !defined(__BMI2__)
|
94
|
-
# define DYNAMIC_BMI2 1
|
95
|
-
#else
|
96
|
-
# define DYNAMIC_BMI2 0
|
97
|
-
#endif
|
98
|
-
#endif
|
99
|
-
|
100
|
-
/* prefetch
|
101
|
-
* can be disabled, by declaring NO_PREFETCH build macro */
|
102
|
-
#if defined(NO_PREFETCH)
|
103
|
-
# define PREFETCH_L1(ptr) (void)(ptr) /* disabled */
|
104
|
-
# define PREFETCH_L2(ptr) (void)(ptr) /* disabled */
|
105
|
-
#else
|
106
|
-
# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */
|
107
|
-
# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */
|
108
|
-
# define PREFETCH_L1(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0)
|
109
|
-
# define PREFETCH_L2(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T1)
|
110
|
-
# elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) )
|
111
|
-
# define PREFETCH_L1(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
|
112
|
-
# define PREFETCH_L2(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
|
113
|
-
# else
|
114
|
-
# define PREFETCH_L1(ptr) (void)(ptr) /* disabled */
|
115
|
-
# define PREFETCH_L2(ptr) (void)(ptr) /* disabled */
|
116
|
-
# endif
|
117
|
-
#endif /* NO_PREFETCH */
|
118
|
-
|
119
|
-
#define CACHELINE_SIZE 64
|
120
|
-
|
121
|
-
#define PREFETCH_AREA(p, s) { \
|
122
|
-
const char* const _ptr = (const char*)(p); \
|
123
|
-
size_t const _size = (size_t)(s); \
|
124
|
-
size_t _pos; \
|
125
|
-
for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
|
126
|
-
PREFETCH_L2(_ptr + _pos); \
|
127
|
-
} \
|
128
|
-
}
|
129
|
-
|
130
|
-
/* vectorization */
|
131
|
-
#if !defined(__clang__) && defined(__GNUC__)
|
132
|
-
# define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
|
133
|
-
#else
|
134
|
-
# define DONT_VECTORIZE
|
135
|
-
#endif
|
136
|
-
|
137
|
-
/* disable warnings */
|
138
|
-
#ifdef _MSC_VER /* Visual Studio */
|
139
|
-
# include <intrin.h> /* For Visual 2005 */
|
140
|
-
# pragma warning(disable : 4100) /* disable: C4100: unreferenced formal parameter */
|
141
|
-
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
|
142
|
-
# pragma warning(disable : 4204) /* disable: C4204: non-constant aggregate initializer */
|
143
|
-
# pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */
|
144
|
-
# pragma warning(disable : 4324) /* disable: C4324: padded structure */
|
145
|
-
#endif
|
146
|
-
|
147
|
-
#endif /* ZSTD_COMPILER_H */
|
@@ -1,44 +0,0 @@
|
|
1
|
-
/* ******************************************************************
|
2
|
-
debug
|
3
|
-
Part of FSE library
|
4
|
-
Copyright (C) 2013-present, Yann Collet.
|
5
|
-
|
6
|
-
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
7
|
-
|
8
|
-
Redistribution and use in source and binary forms, with or without
|
9
|
-
modification, are permitted provided that the following conditions are
|
10
|
-
met:
|
11
|
-
|
12
|
-
* Redistributions of source code must retain the above copyright
|
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
|
33
|
-
****************************************************************** */
|
34
|
-
|
35
|
-
|
36
|
-
/*
|
37
|
-
* This module only hosts one global variable
|
38
|
-
* which can be used to dynamically influence the verbosity of traces,
|
39
|
-
* such as DEBUGLOG and RAWLOG
|
40
|
-
*/
|
41
|
-
|
42
|
-
#include "debug.h"
|
43
|
-
|
44
|
-
int g_debuglevel = DEBUGLEVEL;
|
@@ -1,236 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Common functions of New Generation Entropy library
|
3
|
-
Copyright (C) 2016, Yann Collet.
|
4
|
-
|
5
|
-
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
6
|
-
|
7
|
-
Redistribution and use in source and binary forms, with or without
|
8
|
-
modification, are permitted provided that the following conditions are
|
9
|
-
met:
|
10
|
-
|
11
|
-
* Redistributions of source code must retain the above copyright
|
12
|
-
notice, this list of conditions and the following disclaimer.
|
13
|
-
* Redistributions in binary form must reproduce the above
|
14
|
-
copyright notice, this list of conditions and the following disclaimer
|
15
|
-
in the documentation and/or other materials provided with the
|
16
|
-
distribution.
|
17
|
-
|
18
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
-
|
30
|
-
You can contact the author at :
|
31
|
-
- FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
32
|
-
- Public forum : https://groups.google.com/forum/#!forum/lz4c
|
33
|
-
*************************************************************************** */
|
34
|
-
|
35
|
-
/* *************************************
|
36
|
-
* Dependencies
|
37
|
-
***************************************/
|
38
|
-
#include "mem.h"
|
39
|
-
#include "error_private.h" /* ERR_*, ERROR */
|
40
|
-
#define FSE_STATIC_LINKING_ONLY /* FSE_MIN_TABLELOG */
|
41
|
-
#include "fse.h"
|
42
|
-
#define HUF_STATIC_LINKING_ONLY /* HUF_TABLELOG_ABSOLUTEMAX */
|
43
|
-
#include "huf.h"
|
44
|
-
|
45
|
-
|
46
|
-
/*=== Version ===*/
|
47
|
-
unsigned FSE_versionNumber(void) { return FSE_VERSION_NUMBER; }
|
48
|
-
|
49
|
-
|
50
|
-
/*=== Error Management ===*/
|
51
|
-
unsigned FSE_isError(size_t code) { return ERR_isError(code); }
|
52
|
-
const char* FSE_getErrorName(size_t code) { return ERR_getErrorName(code); }
|
53
|
-
|
54
|
-
unsigned HUF_isError(size_t code) { return ERR_isError(code); }
|
55
|
-
const char* HUF_getErrorName(size_t code) { return ERR_getErrorName(code); }
|
56
|
-
|
57
|
-
|
58
|
-
/*-**************************************************************
|
59
|
-
* FSE NCount encoding-decoding
|
60
|
-
****************************************************************/
|
61
|
-
size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
|
62
|
-
const void* headerBuffer, size_t hbSize)
|
63
|
-
{
|
64
|
-
const BYTE* const istart = (const BYTE*) headerBuffer;
|
65
|
-
const BYTE* const iend = istart + hbSize;
|
66
|
-
const BYTE* ip = istart;
|
67
|
-
int nbBits;
|
68
|
-
int remaining;
|
69
|
-
int threshold;
|
70
|
-
U32 bitStream;
|
71
|
-
int bitCount;
|
72
|
-
unsigned charnum = 0;
|
73
|
-
int previous0 = 0;
|
74
|
-
|
75
|
-
if (hbSize < 4) {
|
76
|
-
/* This function only works when hbSize >= 4 */
|
77
|
-
char buffer[4];
|
78
|
-
memset(buffer, 0, sizeof(buffer));
|
79
|
-
memcpy(buffer, headerBuffer, hbSize);
|
80
|
-
{ size_t const countSize = FSE_readNCount(normalizedCounter, maxSVPtr, tableLogPtr,
|
81
|
-
buffer, sizeof(buffer));
|
82
|
-
if (FSE_isError(countSize)) return countSize;
|
83
|
-
if (countSize > hbSize) return ERROR(corruption_detected);
|
84
|
-
return countSize;
|
85
|
-
} }
|
86
|
-
assert(hbSize >= 4);
|
87
|
-
|
88
|
-
/* init */
|
89
|
-
memset(normalizedCounter, 0, (*maxSVPtr+1) * sizeof(normalizedCounter[0])); /* all symbols not present in NCount have a frequency of 0 */
|
90
|
-
bitStream = MEM_readLE32(ip);
|
91
|
-
nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
|
92
|
-
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
|
93
|
-
bitStream >>= 4;
|
94
|
-
bitCount = 4;
|
95
|
-
*tableLogPtr = nbBits;
|
96
|
-
remaining = (1<<nbBits)+1;
|
97
|
-
threshold = 1<<nbBits;
|
98
|
-
nbBits++;
|
99
|
-
|
100
|
-
while ((remaining>1) & (charnum<=*maxSVPtr)) {
|
101
|
-
if (previous0) {
|
102
|
-
unsigned n0 = charnum;
|
103
|
-
while ((bitStream & 0xFFFF) == 0xFFFF) {
|
104
|
-
n0 += 24;
|
105
|
-
if (ip < iend-5) {
|
106
|
-
ip += 2;
|
107
|
-
bitStream = MEM_readLE32(ip) >> bitCount;
|
108
|
-
} else {
|
109
|
-
bitStream >>= 16;
|
110
|
-
bitCount += 16;
|
111
|
-
} }
|
112
|
-
while ((bitStream & 3) == 3) {
|
113
|
-
n0 += 3;
|
114
|
-
bitStream >>= 2;
|
115
|
-
bitCount += 2;
|
116
|
-
}
|
117
|
-
n0 += bitStream & 3;
|
118
|
-
bitCount += 2;
|
119
|
-
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
|
120
|
-
while (charnum < n0) normalizedCounter[charnum++] = 0;
|
121
|
-
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
|
122
|
-
assert((bitCount >> 3) <= 3); /* For first condition to work */
|
123
|
-
ip += bitCount>>3;
|
124
|
-
bitCount &= 7;
|
125
|
-
bitStream = MEM_readLE32(ip) >> bitCount;
|
126
|
-
} else {
|
127
|
-
bitStream >>= 2;
|
128
|
-
} }
|
129
|
-
{ int const max = (2*threshold-1) - remaining;
|
130
|
-
int count;
|
131
|
-
|
132
|
-
if ((bitStream & (threshold-1)) < (U32)max) {
|
133
|
-
count = bitStream & (threshold-1);
|
134
|
-
bitCount += nbBits-1;
|
135
|
-
} else {
|
136
|
-
count = bitStream & (2*threshold-1);
|
137
|
-
if (count >= threshold) count -= max;
|
138
|
-
bitCount += nbBits;
|
139
|
-
}
|
140
|
-
|
141
|
-
count--; /* extra accuracy */
|
142
|
-
remaining -= count < 0 ? -count : count; /* -1 means +1 */
|
143
|
-
normalizedCounter[charnum++] = (short)count;
|
144
|
-
previous0 = !count;
|
145
|
-
while (remaining < threshold) {
|
146
|
-
nbBits--;
|
147
|
-
threshold >>= 1;
|
148
|
-
}
|
149
|
-
|
150
|
-
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
|
151
|
-
ip += bitCount>>3;
|
152
|
-
bitCount &= 7;
|
153
|
-
} else {
|
154
|
-
bitCount -= (int)(8 * (iend - 4 - ip));
|
155
|
-
ip = iend - 4;
|
156
|
-
}
|
157
|
-
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
|
158
|
-
} } /* while ((remaining>1) & (charnum<=*maxSVPtr)) */
|
159
|
-
if (remaining != 1) return ERROR(corruption_detected);
|
160
|
-
if (bitCount > 32) return ERROR(corruption_detected);
|
161
|
-
*maxSVPtr = charnum-1;
|
162
|
-
|
163
|
-
ip += (bitCount+7)>>3;
|
164
|
-
return ip-istart;
|
165
|
-
}
|
166
|
-
|
167
|
-
|
168
|
-
/*! HUF_readStats() :
|
169
|
-
Read compact Huffman tree, saved by HUF_writeCTable().
|
170
|
-
`huffWeight` is destination buffer.
|
171
|
-
`rankStats` is assumed to be a table of at least HUF_TABLELOG_MAX U32.
|
172
|
-
@return : size read from `src` , or an error Code .
|
173
|
-
Note : Needed by HUF_readCTable() and HUF_readDTableX?() .
|
174
|
-
*/
|
175
|
-
size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats,
|
176
|
-
U32* nbSymbolsPtr, U32* tableLogPtr,
|
177
|
-
const void* src, size_t srcSize)
|
178
|
-
{
|
179
|
-
U32 weightTotal;
|
180
|
-
const BYTE* ip = (const BYTE*) src;
|
181
|
-
size_t iSize;
|
182
|
-
size_t oSize;
|
183
|
-
|
184
|
-
if (!srcSize) return ERROR(srcSize_wrong);
|
185
|
-
iSize = ip[0];
|
186
|
-
/* memset(huffWeight, 0, hwSize); *//* is not necessary, even though some analyzer complain ... */
|
187
|
-
|
188
|
-
if (iSize >= 128) { /* special header */
|
189
|
-
oSize = iSize - 127;
|
190
|
-
iSize = ((oSize+1)/2);
|
191
|
-
if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
|
192
|
-
if (oSize >= hwSize) return ERROR(corruption_detected);
|
193
|
-
ip += 1;
|
194
|
-
{ U32 n;
|
195
|
-
for (n=0; n<oSize; n+=2) {
|
196
|
-
huffWeight[n] = ip[n/2] >> 4;
|
197
|
-
huffWeight[n+1] = ip[n/2] & 15;
|
198
|
-
} } }
|
199
|
-
else { /* header compressed with FSE (normal case) */
|
200
|
-
FSE_DTable fseWorkspace[FSE_DTABLE_SIZE_U32(6)]; /* 6 is max possible tableLog for HUF header (maybe even 5, to be tested) */
|
201
|
-
if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
|
202
|
-
oSize = FSE_decompress_wksp(huffWeight, hwSize-1, ip+1, iSize, fseWorkspace, 6); /* max (hwSize-1) values decoded, as last one is implied */
|
203
|
-
if (FSE_isError(oSize)) return oSize;
|
204
|
-
}
|
205
|
-
|
206
|
-
/* collect weight stats */
|
207
|
-
memset(rankStats, 0, (HUF_TABLELOG_MAX + 1) * sizeof(U32));
|
208
|
-
weightTotal = 0;
|
209
|
-
{ U32 n; for (n=0; n<oSize; n++) {
|
210
|
-
if (huffWeight[n] >= HUF_TABLELOG_MAX) return ERROR(corruption_detected);
|
211
|
-
rankStats[huffWeight[n]]++;
|
212
|
-
weightTotal += (1 << huffWeight[n]) >> 1;
|
213
|
-
} }
|
214
|
-
if (weightTotal == 0) return ERROR(corruption_detected);
|
215
|
-
|
216
|
-
/* get last non-null symbol weight (implied, total must be 2^n) */
|
217
|
-
{ U32 const tableLog = BIT_highbit32(weightTotal) + 1;
|
218
|
-
if (tableLog > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
|
219
|
-
*tableLogPtr = tableLog;
|
220
|
-
/* determine last weight */
|
221
|
-
{ U32 const total = 1 << tableLog;
|
222
|
-
U32 const rest = total - weightTotal;
|
223
|
-
U32 const verif = 1 << BIT_highbit32(rest);
|
224
|
-
U32 const lastWeight = BIT_highbit32(rest) + 1;
|
225
|
-
if (verif != rest) return ERROR(corruption_detected); /* last value must be a clean power of 2 */
|
226
|
-
huffWeight[oSize] = (BYTE)lastWeight;
|
227
|
-
rankStats[lastWeight]++;
|
228
|
-
} }
|
229
|
-
|
230
|
-
/* check tree construction validity */
|
231
|
-
if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected); /* by construction : at least 2 elts of rank 1, must be even */
|
232
|
-
|
233
|
-
/* results */
|
234
|
-
*nbSymbolsPtr = (U32)(oSize+1);
|
235
|
-
return iSize+1;
|
236
|
-
}
|