zstdlib 0.10.0-x86-mingw32 → 0.12.0-x86-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 +17 -0
- data/ext/zstdlib_c/extconf.rb +9 -4
- data/ext/zstdlib_c/ruby/zlib-3.2/zstdlib.c +5090 -0
- data/ext/zstdlib_c/ruby/zlib-3.3/zstdlib.c +5090 -0
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/adler32.c +5 -27
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/compress.c +5 -16
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/crc32.c +94 -161
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/deflate.c +362 -434
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/deflate.h +43 -12
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/gzclose.c +1 -3
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/gzguts.h +13 -18
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/gzlib.c +28 -85
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/gzread.c +23 -73
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/gzwrite.c +19 -65
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/infback.c +17 -30
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/inffast.c +1 -4
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/inffast.h +1 -1
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/inflate.c +36 -102
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/inftrees.c +6 -11
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/inftrees.h +6 -6
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/trees.c +290 -355
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/uncompr.c +4 -12
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/zconf.h +23 -14
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/zlib.h +202 -199
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/zutil.c +18 -44
- data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/zutil.h +13 -33
- data/ext/zstdlib_c/zstd-1.5.5/lib/common/allocations.h +55 -0
- data/ext/zstdlib_c/zstd-1.5.5/lib/common/bits.h +200 -0
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/bitstream.h +19 -60
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/compiler.h +26 -3
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/cpu.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/debug.c +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/debug.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/entropy_common.c +12 -40
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/error_private.c +9 -2
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/error_private.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/fse.h +5 -83
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/fse_decompress.c +7 -99
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/huf.h +65 -156
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/mem.h +39 -46
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/pool.c +26 -10
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/pool.h +7 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/portability_macros.h +22 -3
- data/ext/zstdlib_c/zstd-1.5.5/lib/common/threading.c +176 -0
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/threading.h +5 -10
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/xxhash.c +2 -2
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/xxhash.h +8 -8
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/zstd_common.c +1 -36
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/zstd_deps.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/zstd_internal.h +17 -118
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/common/zstd_trace.h +3 -3
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/clevels.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/fse_compress.c +7 -124
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/hist.c +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/hist.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/huf_compress.c +234 -169
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_compress.c +1243 -538
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_compress_internal.h +225 -151
- data/ext/zstdlib_c/zstd-1.5.5/lib/compress/zstd_compress_literals.c +235 -0
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_compress_literals.h +16 -8
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_compress_sequences.c +3 -3
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_compress_sequences.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_compress_superblock.c +25 -21
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_compress_superblock.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_cwksp.h +128 -62
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_double_fast.c +95 -33
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_double_fast.h +3 -2
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_fast.c +433 -148
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_fast.h +3 -2
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_lazy.c +398 -345
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_lazy.h +4 -2
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_ldm.c +5 -5
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_ldm.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_ldm_geartab.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_opt.c +106 -80
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstd_opt.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstdmt_compress.c +17 -9
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/compress/zstdmt_compress.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/decompress/huf_decompress.c +434 -441
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/decompress/huf_decompress_amd64.S +30 -39
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/decompress/zstd_ddict.c +4 -4
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/decompress/zstd_ddict.h +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/decompress/zstd_decompress.c +205 -80
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/decompress/zstd_decompress_block.c +201 -81
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/decompress/zstd_decompress_block.h +6 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/decompress/zstd_decompress_internal.h +4 -2
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/zdict.h +53 -31
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/zstd.h +580 -135
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/lib/zstd_errors.h +27 -8
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/zlibWrapper/gzclose.c +1 -1
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/zlibWrapper/gzcompatibility.h +8 -8
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/zlibWrapper/gzguts.h +10 -10
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/zlibWrapper/gzlib.c +3 -3
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/zlibWrapper/gzread.c +10 -10
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/zlibWrapper/gzwrite.c +5 -5
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/zlibWrapper/zstd_zlibwrapper.c +46 -44
- data/ext/zstdlib_c/{zstd-1.5.2 → zstd-1.5.5}/zlibWrapper/zstd_zlibwrapper.h +4 -1
- data/lib/2.4/zstdlib_c.so +0 -0
- data/lib/2.5/zstdlib_c.so +0 -0
- data/lib/2.6/zstdlib_c.so +0 -0
- data/lib/2.7/zstdlib_c.so +0 -0
- data/lib/3.0/zstdlib_c.so +0 -0
- data/lib/3.1/zstdlib_c.so +0 -0
- data/lib/3.2/zstdlib_c.so +0 -0
- data/lib/3.3/zstdlib_c.so +0 -0
- metadata +111 -105
- data/ext/zstdlib_c/zstd-1.5.2/lib/common/threading.c +0 -122
- data/ext/zstdlib_c/zstd-1.5.2/lib/compress/zstd_compress_literals.c +0 -159
- /data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/crc32.h +0 -0
- /data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/inffixed.h +0 -0
- /data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/inflate.h +0 -0
- /data/ext/zstdlib_c/{zlib-1.2.12 → zlib-1.3.1}/trees.h +0 -0
@@ -24,13 +24,11 @@ z_const char * const z_errmsg[10] = {
|
|
24
24
|
};
|
25
25
|
|
26
26
|
|
27
|
-
const char * ZEXPORT zlibVersion()
|
28
|
-
{
|
27
|
+
const char * ZEXPORT zlibVersion(void) {
|
29
28
|
return ZLIB_VERSION;
|
30
29
|
}
|
31
30
|
|
32
|
-
uLong ZEXPORT zlibCompileFlags()
|
33
|
-
{
|
31
|
+
uLong ZEXPORT zlibCompileFlags(void) {
|
34
32
|
uLong flags;
|
35
33
|
|
36
34
|
flags = 0;
|
@@ -61,9 +59,11 @@ uLong ZEXPORT zlibCompileFlags()
|
|
61
59
|
#ifdef ZLIB_DEBUG
|
62
60
|
flags += 1 << 8;
|
63
61
|
#endif
|
62
|
+
/*
|
64
63
|
#if defined(ASMV) || defined(ASMINF)
|
65
64
|
flags += 1 << 9;
|
66
65
|
#endif
|
66
|
+
*/
|
67
67
|
#ifdef ZLIB_WINAPI
|
68
68
|
flags += 1 << 10;
|
69
69
|
#endif
|
@@ -119,9 +119,7 @@ uLong ZEXPORT zlibCompileFlags()
|
|
119
119
|
# endif
|
120
120
|
int ZLIB_INTERNAL z_verbose = verbose;
|
121
121
|
|
122
|
-
void ZLIB_INTERNAL z_error
|
123
|
-
char *m;
|
124
|
-
{
|
122
|
+
void ZLIB_INTERNAL z_error(char *m) {
|
125
123
|
fprintf(stderr, "%s\n", m);
|
126
124
|
exit(1);
|
127
125
|
}
|
@@ -130,9 +128,7 @@ void ZLIB_INTERNAL z_error (m)
|
|
130
128
|
/* exported to allow conversion of error code to string for compress() and
|
131
129
|
* uncompress()
|
132
130
|
*/
|
133
|
-
const char * ZEXPORT zError(err)
|
134
|
-
int err;
|
135
|
-
{
|
131
|
+
const char * ZEXPORT zError(int err) {
|
136
132
|
return ERR_MSG(err);
|
137
133
|
}
|
138
134
|
|
@@ -146,22 +142,14 @@ const char * ZEXPORT zError(err)
|
|
146
142
|
|
147
143
|
#ifndef HAVE_MEMCPY
|
148
144
|
|
149
|
-
void ZLIB_INTERNAL zmemcpy(dest, source, len)
|
150
|
-
Bytef* dest;
|
151
|
-
const Bytef* source;
|
152
|
-
uInt len;
|
153
|
-
{
|
145
|
+
void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) {
|
154
146
|
if (len == 0) return;
|
155
147
|
do {
|
156
148
|
*dest++ = *source++; /* ??? to be unrolled */
|
157
149
|
} while (--len != 0);
|
158
150
|
}
|
159
151
|
|
160
|
-
int ZLIB_INTERNAL zmemcmp(s1, s2, len)
|
161
|
-
const Bytef* s1;
|
162
|
-
const Bytef* s2;
|
163
|
-
uInt len;
|
164
|
-
{
|
152
|
+
int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) {
|
165
153
|
uInt j;
|
166
154
|
|
167
155
|
for (j = 0; j < len; j++) {
|
@@ -170,10 +158,7 @@ int ZLIB_INTERNAL zmemcmp(s1, s2, len)
|
|
170
158
|
return 0;
|
171
159
|
}
|
172
160
|
|
173
|
-
void ZLIB_INTERNAL zmemzero(dest, len)
|
174
|
-
Bytef* dest;
|
175
|
-
uInt len;
|
176
|
-
{
|
161
|
+
void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) {
|
177
162
|
if (len == 0) return;
|
178
163
|
do {
|
179
164
|
*dest++ = 0; /* ??? to be unrolled */
|
@@ -214,8 +199,7 @@ local ptr_table table[MAX_PTR];
|
|
214
199
|
* a protected system like OS/2. Use Microsoft C instead.
|
215
200
|
*/
|
216
201
|
|
217
|
-
voidpf ZLIB_INTERNAL zcalloc
|
218
|
-
{
|
202
|
+
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
|
219
203
|
voidpf buf;
|
220
204
|
ulg bsize = (ulg)items*size;
|
221
205
|
|
@@ -240,8 +224,7 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
|
|
240
224
|
return buf;
|
241
225
|
}
|
242
226
|
|
243
|
-
void ZLIB_INTERNAL zcfree
|
244
|
-
{
|
227
|
+
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
|
245
228
|
int n;
|
246
229
|
|
247
230
|
(void)opaque;
|
@@ -277,14 +260,12 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
|
|
277
260
|
# define _hfree hfree
|
278
261
|
#endif
|
279
262
|
|
280
|
-
voidpf ZLIB_INTERNAL zcalloc
|
281
|
-
{
|
263
|
+
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) {
|
282
264
|
(void)opaque;
|
283
265
|
return _halloc((long)items, size);
|
284
266
|
}
|
285
267
|
|
286
|
-
void ZLIB_INTERNAL zcfree
|
287
|
-
{
|
268
|
+
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
|
288
269
|
(void)opaque;
|
289
270
|
_hfree(ptr);
|
290
271
|
}
|
@@ -297,25 +278,18 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
|
|
297
278
|
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
|
298
279
|
|
299
280
|
#ifndef STDC
|
300
|
-
extern voidp
|
301
|
-
extern voidp
|
302
|
-
extern void
|
281
|
+
extern voidp malloc(uInt size);
|
282
|
+
extern voidp calloc(uInt items, uInt size);
|
283
|
+
extern void free(voidpf ptr);
|
303
284
|
#endif
|
304
285
|
|
305
|
-
voidpf ZLIB_INTERNAL zcalloc
|
306
|
-
voidpf opaque;
|
307
|
-
unsigned items;
|
308
|
-
unsigned size;
|
309
|
-
{
|
286
|
+
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
|
310
287
|
(void)opaque;
|
311
288
|
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
|
312
289
|
(voidpf)calloc(items, size);
|
313
290
|
}
|
314
291
|
|
315
|
-
void ZLIB_INTERNAL zcfree
|
316
|
-
voidpf opaque;
|
317
|
-
voidpf ptr;
|
318
|
-
{
|
292
|
+
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
|
319
293
|
(void)opaque;
|
320
294
|
free(ptr);
|
321
295
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* zutil.h -- internal interface and configuration of the compression library
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -56,7 +56,7 @@ typedef unsigned long ulg;
|
|
56
56
|
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
57
57
|
/* (size given to avoid silly warnings with Visual C++) */
|
58
58
|
|
59
|
-
#define ERR_MSG(err) z_errmsg[
|
59
|
+
#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
|
60
60
|
|
61
61
|
#define ERR_RETURN(strm,err) \
|
62
62
|
return (strm->msg = ERR_MSG(err), (err))
|
@@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|
137
137
|
# endif
|
138
138
|
#endif
|
139
139
|
|
140
|
-
#if defined(MACOS)
|
140
|
+
#if defined(MACOS)
|
141
141
|
# define OS_CODE 7
|
142
|
-
# ifndef Z_SOLO
|
143
|
-
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
|
144
|
-
# include <unix.h> /* for fdopen */
|
145
|
-
# else
|
146
|
-
# ifndef fdopen
|
147
|
-
# define fdopen(fd,mode) NULL /* No fdopen() */
|
148
|
-
# endif
|
149
|
-
# endif
|
150
|
-
# endif
|
151
142
|
#endif
|
152
143
|
|
153
144
|
#ifdef __acorn
|
@@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|
170
161
|
# define OS_CODE 19
|
171
162
|
#endif
|
172
163
|
|
173
|
-
#if defined(_BEOS_) || defined(RISCOS)
|
174
|
-
# define fdopen(fd,mode) NULL /* No fdopen() */
|
175
|
-
#endif
|
176
|
-
|
177
|
-
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
|
178
|
-
# if defined(_WIN32_WCE)
|
179
|
-
# define fdopen(fd,mode) NULL /* No fdopen() */
|
180
|
-
# else
|
181
|
-
# define fdopen(fd,type) _fdopen(fd,type)
|
182
|
-
# endif
|
183
|
-
#endif
|
184
|
-
|
185
164
|
#if defined(__BORLANDC__) && !defined(MSDOS)
|
186
165
|
#pragma warn -8004
|
187
166
|
#pragma warn -8008
|
@@ -191,8 +170,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|
191
170
|
/* provide prototypes for these when building zlib without LFS */
|
192
171
|
#if !defined(_WIN32) && \
|
193
172
|
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
|
194
|
-
ZEXTERN uLong ZEXPORT adler32_combine64
|
195
|
-
ZEXTERN uLong ZEXPORT crc32_combine64
|
173
|
+
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
|
174
|
+
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
|
175
|
+
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
|
196
176
|
#endif
|
197
177
|
|
198
178
|
/* common defaults */
|
@@ -231,16 +211,16 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|
231
211
|
# define zmemzero(dest, len) memset(dest, 0, len)
|
232
212
|
# endif
|
233
213
|
#else
|
234
|
-
void ZLIB_INTERNAL zmemcpy
|
235
|
-
int ZLIB_INTERNAL zmemcmp
|
236
|
-
void ZLIB_INTERNAL zmemzero
|
214
|
+
void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len);
|
215
|
+
int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len);
|
216
|
+
void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len);
|
237
217
|
#endif
|
238
218
|
|
239
219
|
/* Diagnostic functions */
|
240
220
|
#ifdef ZLIB_DEBUG
|
241
221
|
# include <stdio.h>
|
242
222
|
extern int ZLIB_INTERNAL z_verbose;
|
243
|
-
extern void ZLIB_INTERNAL z_error
|
223
|
+
extern void ZLIB_INTERNAL z_error(char *m);
|
244
224
|
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
245
225
|
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
246
226
|
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
@@ -257,9 +237,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|
257
237
|
#endif
|
258
238
|
|
259
239
|
#ifndef Z_SOLO
|
260
|
-
voidpf ZLIB_INTERNAL zcalloc
|
261
|
-
|
262
|
-
void ZLIB_INTERNAL zcfree
|
240
|
+
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items,
|
241
|
+
unsigned size);
|
242
|
+
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr);
|
263
243
|
#endif
|
264
244
|
|
265
245
|
#define ZALLOC(strm, items, size) \
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
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
|
+
/* This file provides custom allocation primitives
|
12
|
+
*/
|
13
|
+
|
14
|
+
#define ZSTD_DEPS_NEED_MALLOC
|
15
|
+
#include "zstd_deps.h" /* ZSTD_malloc, ZSTD_calloc, ZSTD_free, ZSTD_memset */
|
16
|
+
|
17
|
+
#include "mem.h" /* MEM_STATIC */
|
18
|
+
#define ZSTD_STATIC_LINKING_ONLY
|
19
|
+
#include "../zstd.h" /* ZSTD_customMem */
|
20
|
+
|
21
|
+
#ifndef ZSTD_ALLOCATIONS_H
|
22
|
+
#define ZSTD_ALLOCATIONS_H
|
23
|
+
|
24
|
+
/* custom memory allocation functions */
|
25
|
+
|
26
|
+
MEM_STATIC void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem)
|
27
|
+
{
|
28
|
+
if (customMem.customAlloc)
|
29
|
+
return customMem.customAlloc(customMem.opaque, size);
|
30
|
+
return ZSTD_malloc(size);
|
31
|
+
}
|
32
|
+
|
33
|
+
MEM_STATIC void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem)
|
34
|
+
{
|
35
|
+
if (customMem.customAlloc) {
|
36
|
+
/* calloc implemented as malloc+memset;
|
37
|
+
* not as efficient as calloc, but next best guess for custom malloc */
|
38
|
+
void* const ptr = customMem.customAlloc(customMem.opaque, size);
|
39
|
+
ZSTD_memset(ptr, 0, size);
|
40
|
+
return ptr;
|
41
|
+
}
|
42
|
+
return ZSTD_calloc(1, size);
|
43
|
+
}
|
44
|
+
|
45
|
+
MEM_STATIC void ZSTD_customFree(void* ptr, ZSTD_customMem customMem)
|
46
|
+
{
|
47
|
+
if (ptr!=NULL) {
|
48
|
+
if (customMem.customFree)
|
49
|
+
customMem.customFree(customMem.opaque, ptr);
|
50
|
+
else
|
51
|
+
ZSTD_free(ptr);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
#endif /* ZSTD_ALLOCATIONS_H */
|
@@ -0,0 +1,200 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
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_BITS_H
|
12
|
+
#define ZSTD_BITS_H
|
13
|
+
|
14
|
+
#include "mem.h"
|
15
|
+
|
16
|
+
MEM_STATIC unsigned ZSTD_countTrailingZeros32_fallback(U32 val)
|
17
|
+
{
|
18
|
+
assert(val != 0);
|
19
|
+
{
|
20
|
+
static const U32 DeBruijnBytePos[32] = {0, 1, 28, 2, 29, 14, 24, 3,
|
21
|
+
30, 22, 20, 15, 25, 17, 4, 8,
|
22
|
+
31, 27, 13, 23, 21, 19, 16, 7,
|
23
|
+
26, 12, 18, 6, 11, 5, 10, 9};
|
24
|
+
return DeBruijnBytePos[((U32) ((val & -(S32) val) * 0x077CB531U)) >> 27];
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
MEM_STATIC unsigned ZSTD_countTrailingZeros32(U32 val)
|
29
|
+
{
|
30
|
+
assert(val != 0);
|
31
|
+
# if defined(_MSC_VER)
|
32
|
+
# if STATIC_BMI2 == 1
|
33
|
+
return (unsigned)_tzcnt_u32(val);
|
34
|
+
# else
|
35
|
+
if (val != 0) {
|
36
|
+
unsigned long r;
|
37
|
+
_BitScanForward(&r, val);
|
38
|
+
return (unsigned)r;
|
39
|
+
} else {
|
40
|
+
/* Should not reach this code path */
|
41
|
+
__assume(0);
|
42
|
+
}
|
43
|
+
# endif
|
44
|
+
# elif defined(__GNUC__) && (__GNUC__ >= 4)
|
45
|
+
return (unsigned)__builtin_ctz(val);
|
46
|
+
# else
|
47
|
+
return ZSTD_countTrailingZeros32_fallback(val);
|
48
|
+
# endif
|
49
|
+
}
|
50
|
+
|
51
|
+
MEM_STATIC unsigned ZSTD_countLeadingZeros32_fallback(U32 val) {
|
52
|
+
assert(val != 0);
|
53
|
+
{
|
54
|
+
static const U32 DeBruijnClz[32] = {0, 9, 1, 10, 13, 21, 2, 29,
|
55
|
+
11, 14, 16, 18, 22, 25, 3, 30,
|
56
|
+
8, 12, 20, 28, 15, 17, 24, 7,
|
57
|
+
19, 27, 23, 6, 26, 5, 4, 31};
|
58
|
+
val |= val >> 1;
|
59
|
+
val |= val >> 2;
|
60
|
+
val |= val >> 4;
|
61
|
+
val |= val >> 8;
|
62
|
+
val |= val >> 16;
|
63
|
+
return 31 - DeBruijnClz[(val * 0x07C4ACDDU) >> 27];
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
MEM_STATIC unsigned ZSTD_countLeadingZeros32(U32 val)
|
68
|
+
{
|
69
|
+
assert(val != 0);
|
70
|
+
# if defined(_MSC_VER)
|
71
|
+
# if STATIC_BMI2 == 1
|
72
|
+
return (unsigned)_lzcnt_u32(val);
|
73
|
+
# else
|
74
|
+
if (val != 0) {
|
75
|
+
unsigned long r;
|
76
|
+
_BitScanReverse(&r, val);
|
77
|
+
return (unsigned)(31 - r);
|
78
|
+
} else {
|
79
|
+
/* Should not reach this code path */
|
80
|
+
__assume(0);
|
81
|
+
}
|
82
|
+
# endif
|
83
|
+
# elif defined(__GNUC__) && (__GNUC__ >= 4)
|
84
|
+
return (unsigned)__builtin_clz(val);
|
85
|
+
# else
|
86
|
+
return ZSTD_countLeadingZeros32_fallback(val);
|
87
|
+
# endif
|
88
|
+
}
|
89
|
+
|
90
|
+
MEM_STATIC unsigned ZSTD_countTrailingZeros64(U64 val)
|
91
|
+
{
|
92
|
+
assert(val != 0);
|
93
|
+
# if defined(_MSC_VER) && defined(_WIN64)
|
94
|
+
# if STATIC_BMI2 == 1
|
95
|
+
return (unsigned)_tzcnt_u64(val);
|
96
|
+
# else
|
97
|
+
if (val != 0) {
|
98
|
+
unsigned long r;
|
99
|
+
_BitScanForward64(&r, val);
|
100
|
+
return (unsigned)r;
|
101
|
+
} else {
|
102
|
+
/* Should not reach this code path */
|
103
|
+
__assume(0);
|
104
|
+
}
|
105
|
+
# endif
|
106
|
+
# elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__)
|
107
|
+
return (unsigned)__builtin_ctzll(val);
|
108
|
+
# else
|
109
|
+
{
|
110
|
+
U32 mostSignificantWord = (U32)(val >> 32);
|
111
|
+
U32 leastSignificantWord = (U32)val;
|
112
|
+
if (leastSignificantWord == 0) {
|
113
|
+
return 32 + ZSTD_countTrailingZeros32(mostSignificantWord);
|
114
|
+
} else {
|
115
|
+
return ZSTD_countTrailingZeros32(leastSignificantWord);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
# endif
|
119
|
+
}
|
120
|
+
|
121
|
+
MEM_STATIC unsigned ZSTD_countLeadingZeros64(U64 val)
|
122
|
+
{
|
123
|
+
assert(val != 0);
|
124
|
+
# if defined(_MSC_VER) && defined(_WIN64)
|
125
|
+
# if STATIC_BMI2 == 1
|
126
|
+
return (unsigned)_lzcnt_u64(val);
|
127
|
+
# else
|
128
|
+
if (val != 0) {
|
129
|
+
unsigned long r;
|
130
|
+
_BitScanReverse64(&r, val);
|
131
|
+
return (unsigned)(63 - r);
|
132
|
+
} else {
|
133
|
+
/* Should not reach this code path */
|
134
|
+
__assume(0);
|
135
|
+
}
|
136
|
+
# endif
|
137
|
+
# elif defined(__GNUC__) && (__GNUC__ >= 4)
|
138
|
+
return (unsigned)(__builtin_clzll(val));
|
139
|
+
# else
|
140
|
+
{
|
141
|
+
U32 mostSignificantWord = (U32)(val >> 32);
|
142
|
+
U32 leastSignificantWord = (U32)val;
|
143
|
+
if (mostSignificantWord == 0) {
|
144
|
+
return 32 + ZSTD_countLeadingZeros32(leastSignificantWord);
|
145
|
+
} else {
|
146
|
+
return ZSTD_countLeadingZeros32(mostSignificantWord);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
# endif
|
150
|
+
}
|
151
|
+
|
152
|
+
MEM_STATIC unsigned ZSTD_NbCommonBytes(size_t val)
|
153
|
+
{
|
154
|
+
if (MEM_isLittleEndian()) {
|
155
|
+
if (MEM_64bits()) {
|
156
|
+
return ZSTD_countTrailingZeros64((U64)val) >> 3;
|
157
|
+
} else {
|
158
|
+
return ZSTD_countTrailingZeros32((U32)val) >> 3;
|
159
|
+
}
|
160
|
+
} else { /* Big Endian CPU */
|
161
|
+
if (MEM_64bits()) {
|
162
|
+
return ZSTD_countLeadingZeros64((U64)val) >> 3;
|
163
|
+
} else {
|
164
|
+
return ZSTD_countLeadingZeros32((U32)val) >> 3;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
MEM_STATIC unsigned ZSTD_highbit32(U32 val) /* compress, dictBuilder, decodeCorpus */
|
170
|
+
{
|
171
|
+
assert(val != 0);
|
172
|
+
return 31 - ZSTD_countLeadingZeros32(val);
|
173
|
+
}
|
174
|
+
|
175
|
+
/* ZSTD_rotateRight_*():
|
176
|
+
* Rotates a bitfield to the right by "count" bits.
|
177
|
+
* https://en.wikipedia.org/w/index.php?title=Circular_shift&oldid=991635599#Implementing_circular_shifts
|
178
|
+
*/
|
179
|
+
MEM_STATIC
|
180
|
+
U64 ZSTD_rotateRight_U64(U64 const value, U32 count) {
|
181
|
+
assert(count < 64);
|
182
|
+
count &= 0x3F; /* for fickle pattern recognition */
|
183
|
+
return (value >> count) | (U64)(value << ((0U - count) & 0x3F));
|
184
|
+
}
|
185
|
+
|
186
|
+
MEM_STATIC
|
187
|
+
U32 ZSTD_rotateRight_U32(U32 const value, U32 count) {
|
188
|
+
assert(count < 32);
|
189
|
+
count &= 0x1F; /* for fickle pattern recognition */
|
190
|
+
return (value >> count) | (U32)(value << ((0U - count) & 0x1F));
|
191
|
+
}
|
192
|
+
|
193
|
+
MEM_STATIC
|
194
|
+
U16 ZSTD_rotateRight_U16(U16 const value, U32 count) {
|
195
|
+
assert(count < 16);
|
196
|
+
count &= 0x0F; /* for fickle pattern recognition */
|
197
|
+
return (value >> count) | (U16)(value << ((0U - count) & 0x0F));
|
198
|
+
}
|
199
|
+
|
200
|
+
#endif /* ZSTD_BITS_H */
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* ******************************************************************
|
2
2
|
* bitstream
|
3
3
|
* Part of FSE library
|
4
|
-
* Copyright (c)
|
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
|
@@ -30,14 +30,15 @@ extern "C" {
|
|
30
30
|
#include "compiler.h" /* UNLIKELY() */
|
31
31
|
#include "debug.h" /* assert(), DEBUGLOG(), RAWLOG() */
|
32
32
|
#include "error_private.h" /* error codes and messages */
|
33
|
+
#include "bits.h" /* ZSTD_highbit32 */
|
33
34
|
|
34
35
|
|
35
36
|
/*=========================================
|
36
37
|
* Target specific
|
37
38
|
=========================================*/
|
38
39
|
#ifndef ZSTD_NO_INTRINSICS
|
39
|
-
# if defined(__BMI__) && defined(__GNUC__)
|
40
|
-
# include <immintrin.h> /* support for bextr (experimental) */
|
40
|
+
# if (defined(__BMI__) || defined(__BMI2__)) && defined(__GNUC__)
|
41
|
+
# include <immintrin.h> /* support for bextr (experimental)/bzhi */
|
41
42
|
# elif defined(__ICCARM__)
|
42
43
|
# include <intrinsics.h>
|
43
44
|
# endif
|
@@ -132,48 +133,6 @@ MEM_STATIC void BIT_flushBitsFast(BIT_CStream_t* bitC);
|
|
132
133
|
MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits);
|
133
134
|
/* faster, but works only if nbBits >= 1 */
|
134
135
|
|
135
|
-
|
136
|
-
|
137
|
-
/*-**************************************************************
|
138
|
-
* Internal functions
|
139
|
-
****************************************************************/
|
140
|
-
MEM_STATIC unsigned BIT_highbit32 (U32 val)
|
141
|
-
{
|
142
|
-
assert(val != 0);
|
143
|
-
{
|
144
|
-
# if defined(_MSC_VER) /* Visual */
|
145
|
-
# if STATIC_BMI2 == 1
|
146
|
-
return _lzcnt_u32(val) ^ 31;
|
147
|
-
# else
|
148
|
-
if (val != 0) {
|
149
|
-
unsigned long r;
|
150
|
-
_BitScanReverse(&r, val);
|
151
|
-
return (unsigned)r;
|
152
|
-
} else {
|
153
|
-
/* Should not reach this code path */
|
154
|
-
__assume(0);
|
155
|
-
}
|
156
|
-
# endif
|
157
|
-
# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
|
158
|
-
return __builtin_clz (val) ^ 31;
|
159
|
-
# elif defined(__ICCARM__) /* IAR Intrinsic */
|
160
|
-
return 31 - __CLZ(val);
|
161
|
-
# else /* Software version */
|
162
|
-
static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29,
|
163
|
-
11, 14, 16, 18, 22, 25, 3, 30,
|
164
|
-
8, 12, 20, 28, 15, 17, 24, 7,
|
165
|
-
19, 27, 23, 6, 26, 5, 4, 31 };
|
166
|
-
U32 v = val;
|
167
|
-
v |= v >> 1;
|
168
|
-
v |= v >> 2;
|
169
|
-
v |= v >> 4;
|
170
|
-
v |= v >> 8;
|
171
|
-
v |= v >> 16;
|
172
|
-
return DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27];
|
173
|
-
# endif
|
174
|
-
}
|
175
|
-
}
|
176
|
-
|
177
136
|
/*===== Local Constants =====*/
|
178
137
|
static const unsigned BIT_mask[] = {
|
179
138
|
0, 1, 3, 7, 0xF, 0x1F,
|
@@ -203,6 +162,16 @@ MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC,
|
|
203
162
|
return 0;
|
204
163
|
}
|
205
164
|
|
165
|
+
MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits)
|
166
|
+
{
|
167
|
+
#if defined(STATIC_BMI2) && STATIC_BMI2 == 1 && !defined(ZSTD_NO_INTRINSICS)
|
168
|
+
return _bzhi_u64(bitContainer, nbBits);
|
169
|
+
#else
|
170
|
+
assert(nbBits < BIT_MASK_SIZE);
|
171
|
+
return bitContainer & BIT_mask[nbBits];
|
172
|
+
#endif
|
173
|
+
}
|
174
|
+
|
206
175
|
/*! BIT_addBits() :
|
207
176
|
* can add up to 31 bits into `bitC`.
|
208
177
|
* Note : does not check for register overflow ! */
|
@@ -212,7 +181,7 @@ MEM_STATIC void BIT_addBits(BIT_CStream_t* bitC,
|
|
212
181
|
DEBUG_STATIC_ASSERT(BIT_MASK_SIZE == 32);
|
213
182
|
assert(nbBits < BIT_MASK_SIZE);
|
214
183
|
assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
|
215
|
-
bitC->bitContainer |= (value
|
184
|
+
bitC->bitContainer |= BIT_getLowerBits(value, nbBits) << bitC->bitPos;
|
216
185
|
bitC->bitPos += nbBits;
|
217
186
|
}
|
218
187
|
|
@@ -291,7 +260,7 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si
|
|
291
260
|
bitD->ptr = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
|
292
261
|
bitD->bitContainer = MEM_readLEST(bitD->ptr);
|
293
262
|
{ BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
|
294
|
-
bitD->bitsConsumed = lastByte ? 8 -
|
263
|
+
bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0; /* ensures bitsConsumed is always set */
|
295
264
|
if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
|
296
265
|
} else {
|
297
266
|
bitD->ptr = bitD->start;
|
@@ -319,7 +288,7 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si
|
|
319
288
|
default: break;
|
320
289
|
}
|
321
290
|
{ BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
|
322
|
-
bitD->bitsConsumed = lastByte ? 8 -
|
291
|
+
bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
|
323
292
|
if (lastByte == 0) return ERROR(corruption_detected); /* endMark not present */
|
324
293
|
}
|
325
294
|
bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
|
@@ -350,16 +319,6 @@ MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getMiddleBits(size_t bitContainer, U32 c
|
|
350
319
|
#endif
|
351
320
|
}
|
352
321
|
|
353
|
-
MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits)
|
354
|
-
{
|
355
|
-
#if defined(STATIC_BMI2) && STATIC_BMI2 == 1
|
356
|
-
return _bzhi_u64(bitContainer, nbBits);
|
357
|
-
#else
|
358
|
-
assert(nbBits < BIT_MASK_SIZE);
|
359
|
-
return bitContainer & BIT_mask[nbBits];
|
360
|
-
#endif
|
361
|
-
}
|
362
|
-
|
363
322
|
/*! BIT_lookBits() :
|
364
323
|
* Provides next n bits from local register.
|
365
324
|
* local register is not modified.
|
@@ -406,7 +365,7 @@ MEM_STATIC FORCE_INLINE_ATTR size_t BIT_readBits(BIT_DStream_t* bitD, unsigned n
|
|
406
365
|
}
|
407
366
|
|
408
367
|
/*! BIT_readBitsFast() :
|
409
|
-
* unsafe version; only works
|
368
|
+
* unsafe version; only works if nbBits >= 1 */
|
410
369
|
MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits)
|
411
370
|
{
|
412
371
|
size_t const value = BIT_lookBitsFast(bitD, nbBits);
|
@@ -437,7 +396,7 @@ MEM_STATIC BIT_DStream_status BIT_reloadDStreamFast(BIT_DStream_t* bitD)
|
|
437
396
|
* This function is safe, it guarantees it will not read beyond src buffer.
|
438
397
|
* @return : status of `BIT_DStream_t` internal register.
|
439
398
|
* when status == BIT_DStream_unfinished, internal register is filled with at least 25 or 57 bits */
|
440
|
-
MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD)
|
399
|
+
MEM_STATIC FORCE_INLINE_ATTR BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD)
|
441
400
|
{
|
442
401
|
if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8)) /* overflow detected, like end of stream */
|
443
402
|
return BIT_DStream_overflow;
|