deflate-ruby 0.1.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 +7 -0
- data/CLAUDE.md +138 -0
- data/LICENSE.txt +21 -0
- data/README.md +117 -0
- data/ext/deflate_ruby/deflate_ruby.c +301 -0
- data/ext/deflate_ruby/extconf.rb +34 -0
- data/ext/deflate_ruby/libdeflate/CMakeLists.txt +270 -0
- data/ext/deflate_ruby/libdeflate/COPYING +22 -0
- data/ext/deflate_ruby/libdeflate/NEWS.md +494 -0
- data/ext/deflate_ruby/libdeflate/README.md +228 -0
- data/ext/deflate_ruby/libdeflate/common_defs.h +747 -0
- data/ext/deflate_ruby/libdeflate/lib/adler32.c +162 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/adler32_impl.h +358 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/cpu_features.c +230 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/cpu_features.h +214 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/crc32_impl.h +600 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/crc32_pmull_helpers.h +156 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/crc32_pmull_wide.h +226 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/matchfinder_impl.h +78 -0
- data/ext/deflate_ruby/libdeflate/lib/bt_matchfinder.h +342 -0
- data/ext/deflate_ruby/libdeflate/lib/cpu_features_common.h +93 -0
- data/ext/deflate_ruby/libdeflate/lib/crc32.c +262 -0
- data/ext/deflate_ruby/libdeflate/lib/crc32_multipliers.h +377 -0
- data/ext/deflate_ruby/libdeflate/lib/crc32_tables.h +587 -0
- data/ext/deflate_ruby/libdeflate/lib/decompress_template.h +777 -0
- data/ext/deflate_ruby/libdeflate/lib/deflate_compress.c +4129 -0
- data/ext/deflate_ruby/libdeflate/lib/deflate_compress.h +15 -0
- data/ext/deflate_ruby/libdeflate/lib/deflate_constants.h +56 -0
- data/ext/deflate_ruby/libdeflate/lib/deflate_decompress.c +1208 -0
- data/ext/deflate_ruby/libdeflate/lib/gzip_compress.c +90 -0
- data/ext/deflate_ruby/libdeflate/lib/gzip_constants.h +45 -0
- data/ext/deflate_ruby/libdeflate/lib/gzip_decompress.c +144 -0
- data/ext/deflate_ruby/libdeflate/lib/hc_matchfinder.h +401 -0
- data/ext/deflate_ruby/libdeflate/lib/ht_matchfinder.h +234 -0
- data/ext/deflate_ruby/libdeflate/lib/lib_common.h +106 -0
- data/ext/deflate_ruby/libdeflate/lib/matchfinder_common.h +224 -0
- data/ext/deflate_ruby/libdeflate/lib/riscv/matchfinder_impl.h +97 -0
- data/ext/deflate_ruby/libdeflate/lib/utils.c +141 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/adler32_impl.h +134 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/adler32_template.h +518 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/cpu_features.c +183 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/cpu_features.h +169 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/crc32_impl.h +160 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/crc32_pclmul_template.h +495 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/decompress_impl.h +57 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/matchfinder_impl.h +122 -0
- data/ext/deflate_ruby/libdeflate/lib/zlib_compress.c +82 -0
- data/ext/deflate_ruby/libdeflate/lib/zlib_constants.h +21 -0
- data/ext/deflate_ruby/libdeflate/lib/zlib_decompress.c +104 -0
- data/ext/deflate_ruby/libdeflate/libdeflate-config.cmake.in +3 -0
- data/ext/deflate_ruby/libdeflate/libdeflate.h +411 -0
- data/ext/deflate_ruby/libdeflate/libdeflate.pc.in +18 -0
- data/ext/deflate_ruby/libdeflate/programs/CMakeLists.txt +105 -0
- data/ext/deflate_ruby/libdeflate/programs/benchmark.c +696 -0
- data/ext/deflate_ruby/libdeflate/programs/checksum.c +218 -0
- data/ext/deflate_ruby/libdeflate/programs/config.h.in +19 -0
- data/ext/deflate_ruby/libdeflate/programs/gzip.c +688 -0
- data/ext/deflate_ruby/libdeflate/programs/prog_util.c +521 -0
- data/ext/deflate_ruby/libdeflate/programs/prog_util.h +225 -0
- data/ext/deflate_ruby/libdeflate/programs/test_checksums.c +200 -0
- data/ext/deflate_ruby/libdeflate/programs/test_custom_malloc.c +155 -0
- data/ext/deflate_ruby/libdeflate/programs/test_incomplete_codes.c +385 -0
- data/ext/deflate_ruby/libdeflate/programs/test_invalid_streams.c +130 -0
- data/ext/deflate_ruby/libdeflate/programs/test_litrunlen_overflow.c +72 -0
- data/ext/deflate_ruby/libdeflate/programs/test_overread.c +95 -0
- data/ext/deflate_ruby/libdeflate/programs/test_slow_decompression.c +472 -0
- data/ext/deflate_ruby/libdeflate/programs/test_trailing_bytes.c +151 -0
- data/ext/deflate_ruby/libdeflate/programs/test_util.c +237 -0
- data/ext/deflate_ruby/libdeflate/programs/test_util.h +61 -0
- data/ext/deflate_ruby/libdeflate/programs/tgetopt.c +118 -0
- data/ext/deflate_ruby/libdeflate/scripts/android_build.sh +118 -0
- data/ext/deflate_ruby/libdeflate/scripts/android_tests.sh +69 -0
- data/ext/deflate_ruby/libdeflate/scripts/benchmark.sh +10 -0
- data/ext/deflate_ruby/libdeflate/scripts/checksum.sh +10 -0
- data/ext/deflate_ruby/libdeflate/scripts/checksum_benchmarks.sh +253 -0
- data/ext/deflate_ruby/libdeflate/scripts/cmake-helper.sh +17 -0
- data/ext/deflate_ruby/libdeflate/scripts/deflate_benchmarks.sh +119 -0
- data/ext/deflate_ruby/libdeflate/scripts/exec_tests.sh +38 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen-release-archives.sh +37 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen_bitreverse_tab.py +19 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen_crc32_multipliers.c +199 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen_crc32_tables.c +105 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen_default_litlen_costs.py +44 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen_offset_slot_map.py +29 -0
- data/ext/deflate_ruby/libdeflate/scripts/gzip_tests.sh +523 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_compress/corpus/0 +0 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_compress/fuzz.c +95 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_decompress/corpus/0 +3 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_decompress/fuzz.c +62 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/fuzz.sh +108 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/gzip_decompress/corpus/0 +0 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/gzip_decompress/fuzz.c +19 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/zlib_decompress/corpus/0 +3 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/zlib_decompress/fuzz.c +19 -0
- data/ext/deflate_ruby/libdeflate/scripts/run_tests.sh +416 -0
- data/ext/deflate_ruby/libdeflate/scripts/toolchain-i686-w64-mingw32.cmake +8 -0
- data/ext/deflate_ruby/libdeflate/scripts/toolchain-x86_64-w64-mingw32.cmake +8 -0
- data/lib/deflate_ruby/version.rb +5 -0
- data/lib/deflate_ruby.rb +71 -0
- metadata +191 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* zlib_compress.c - compress with a zlib wrapper
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Eric Biggers
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person
|
|
7
|
+
* obtaining a copy of this software and associated documentation
|
|
8
|
+
* files (the "Software"), to deal in the Software without
|
|
9
|
+
* restriction, including without limitation the rights to use,
|
|
10
|
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the
|
|
12
|
+
* Software is furnished to do so, subject to the following
|
|
13
|
+
* conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be
|
|
16
|
+
* included in all copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
22
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
23
|
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
24
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
25
|
+
* OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
#include "deflate_compress.h"
|
|
29
|
+
#include "zlib_constants.h"
|
|
30
|
+
|
|
31
|
+
LIBDEFLATEAPI size_t
|
|
32
|
+
libdeflate_zlib_compress(struct libdeflate_compressor *c,
|
|
33
|
+
const void *in, size_t in_nbytes,
|
|
34
|
+
void *out, size_t out_nbytes_avail)
|
|
35
|
+
{
|
|
36
|
+
u8 *out_next = out;
|
|
37
|
+
u16 hdr;
|
|
38
|
+
unsigned compression_level;
|
|
39
|
+
unsigned level_hint;
|
|
40
|
+
size_t deflate_size;
|
|
41
|
+
|
|
42
|
+
if (out_nbytes_avail <= ZLIB_MIN_OVERHEAD)
|
|
43
|
+
return 0;
|
|
44
|
+
|
|
45
|
+
/* 2 byte header: CMF and FLG */
|
|
46
|
+
hdr = (ZLIB_CM_DEFLATE << 8) | (ZLIB_CINFO_32K_WINDOW << 12);
|
|
47
|
+
compression_level = libdeflate_get_compression_level(c);
|
|
48
|
+
if (compression_level < 2)
|
|
49
|
+
level_hint = ZLIB_FASTEST_COMPRESSION;
|
|
50
|
+
else if (compression_level < 6)
|
|
51
|
+
level_hint = ZLIB_FAST_COMPRESSION;
|
|
52
|
+
else if (compression_level < 8)
|
|
53
|
+
level_hint = ZLIB_DEFAULT_COMPRESSION;
|
|
54
|
+
else
|
|
55
|
+
level_hint = ZLIB_SLOWEST_COMPRESSION;
|
|
56
|
+
hdr |= level_hint << 6;
|
|
57
|
+
hdr |= 31 - (hdr % 31);
|
|
58
|
+
|
|
59
|
+
put_unaligned_be16(hdr, out_next);
|
|
60
|
+
out_next += 2;
|
|
61
|
+
|
|
62
|
+
/* Compressed data */
|
|
63
|
+
deflate_size = libdeflate_deflate_compress(c, in, in_nbytes, out_next,
|
|
64
|
+
out_nbytes_avail - ZLIB_MIN_OVERHEAD);
|
|
65
|
+
if (deflate_size == 0)
|
|
66
|
+
return 0;
|
|
67
|
+
out_next += deflate_size;
|
|
68
|
+
|
|
69
|
+
/* ADLER32 */
|
|
70
|
+
put_unaligned_be32(libdeflate_adler32(1, in, in_nbytes), out_next);
|
|
71
|
+
out_next += 4;
|
|
72
|
+
|
|
73
|
+
return out_next - (u8 *)out;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
LIBDEFLATEAPI size_t
|
|
77
|
+
libdeflate_zlib_compress_bound(struct libdeflate_compressor *c,
|
|
78
|
+
size_t in_nbytes)
|
|
79
|
+
{
|
|
80
|
+
return ZLIB_MIN_OVERHEAD +
|
|
81
|
+
libdeflate_deflate_compress_bound(c, in_nbytes);
|
|
82
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* zlib_constants.h - constants for the zlib wrapper format
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#ifndef LIB_ZLIB_CONSTANTS_H
|
|
6
|
+
#define LIB_ZLIB_CONSTANTS_H
|
|
7
|
+
|
|
8
|
+
#define ZLIB_MIN_HEADER_SIZE 2
|
|
9
|
+
#define ZLIB_FOOTER_SIZE 4
|
|
10
|
+
#define ZLIB_MIN_OVERHEAD (ZLIB_MIN_HEADER_SIZE + ZLIB_FOOTER_SIZE)
|
|
11
|
+
|
|
12
|
+
#define ZLIB_CM_DEFLATE 8
|
|
13
|
+
|
|
14
|
+
#define ZLIB_CINFO_32K_WINDOW 7
|
|
15
|
+
|
|
16
|
+
#define ZLIB_FASTEST_COMPRESSION 0
|
|
17
|
+
#define ZLIB_FAST_COMPRESSION 1
|
|
18
|
+
#define ZLIB_DEFAULT_COMPRESSION 2
|
|
19
|
+
#define ZLIB_SLOWEST_COMPRESSION 3
|
|
20
|
+
|
|
21
|
+
#endif /* LIB_ZLIB_CONSTANTS_H */
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* zlib_decompress.c - decompress with a zlib wrapper
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Eric Biggers
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person
|
|
7
|
+
* obtaining a copy of this software and associated documentation
|
|
8
|
+
* files (the "Software"), to deal in the Software without
|
|
9
|
+
* restriction, including without limitation the rights to use,
|
|
10
|
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the
|
|
12
|
+
* Software is furnished to do so, subject to the following
|
|
13
|
+
* conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be
|
|
16
|
+
* included in all copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
22
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
23
|
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
24
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
25
|
+
* OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
#include "lib_common.h"
|
|
29
|
+
#include "zlib_constants.h"
|
|
30
|
+
|
|
31
|
+
LIBDEFLATEAPI enum libdeflate_result
|
|
32
|
+
libdeflate_zlib_decompress_ex(struct libdeflate_decompressor *d,
|
|
33
|
+
const void *in, size_t in_nbytes,
|
|
34
|
+
void *out, size_t out_nbytes_avail,
|
|
35
|
+
size_t *actual_in_nbytes_ret,
|
|
36
|
+
size_t *actual_out_nbytes_ret)
|
|
37
|
+
{
|
|
38
|
+
const u8 *in_next = in;
|
|
39
|
+
const u8 * const in_end = in_next + in_nbytes;
|
|
40
|
+
u16 hdr;
|
|
41
|
+
size_t actual_in_nbytes;
|
|
42
|
+
size_t actual_out_nbytes;
|
|
43
|
+
enum libdeflate_result result;
|
|
44
|
+
|
|
45
|
+
if (in_nbytes < ZLIB_MIN_OVERHEAD)
|
|
46
|
+
return LIBDEFLATE_BAD_DATA;
|
|
47
|
+
|
|
48
|
+
/* 2 byte header: CMF and FLG */
|
|
49
|
+
hdr = get_unaligned_be16(in_next);
|
|
50
|
+
in_next += 2;
|
|
51
|
+
|
|
52
|
+
/* FCHECK */
|
|
53
|
+
if ((hdr % 31) != 0)
|
|
54
|
+
return LIBDEFLATE_BAD_DATA;
|
|
55
|
+
|
|
56
|
+
/* CM */
|
|
57
|
+
if (((hdr >> 8) & 0xF) != ZLIB_CM_DEFLATE)
|
|
58
|
+
return LIBDEFLATE_BAD_DATA;
|
|
59
|
+
|
|
60
|
+
/* CINFO */
|
|
61
|
+
if ((hdr >> 12) > ZLIB_CINFO_32K_WINDOW)
|
|
62
|
+
return LIBDEFLATE_BAD_DATA;
|
|
63
|
+
|
|
64
|
+
/* FDICT */
|
|
65
|
+
if ((hdr >> 5) & 1)
|
|
66
|
+
return LIBDEFLATE_BAD_DATA;
|
|
67
|
+
|
|
68
|
+
/* Compressed data */
|
|
69
|
+
result = libdeflate_deflate_decompress_ex(d, in_next,
|
|
70
|
+
in_end - ZLIB_FOOTER_SIZE - in_next,
|
|
71
|
+
out, out_nbytes_avail,
|
|
72
|
+
&actual_in_nbytes, actual_out_nbytes_ret);
|
|
73
|
+
if (result != LIBDEFLATE_SUCCESS)
|
|
74
|
+
return result;
|
|
75
|
+
|
|
76
|
+
if (actual_out_nbytes_ret)
|
|
77
|
+
actual_out_nbytes = *actual_out_nbytes_ret;
|
|
78
|
+
else
|
|
79
|
+
actual_out_nbytes = out_nbytes_avail;
|
|
80
|
+
|
|
81
|
+
in_next += actual_in_nbytes;
|
|
82
|
+
|
|
83
|
+
/* ADLER32 */
|
|
84
|
+
if (libdeflate_adler32(1, out, actual_out_nbytes) !=
|
|
85
|
+
get_unaligned_be32(in_next))
|
|
86
|
+
return LIBDEFLATE_BAD_DATA;
|
|
87
|
+
in_next += 4;
|
|
88
|
+
|
|
89
|
+
if (actual_in_nbytes_ret)
|
|
90
|
+
*actual_in_nbytes_ret = in_next - (u8 *)in;
|
|
91
|
+
|
|
92
|
+
return LIBDEFLATE_SUCCESS;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
LIBDEFLATEAPI enum libdeflate_result
|
|
96
|
+
libdeflate_zlib_decompress(struct libdeflate_decompressor *d,
|
|
97
|
+
const void *in, size_t in_nbytes,
|
|
98
|
+
void *out, size_t out_nbytes_avail,
|
|
99
|
+
size_t *actual_out_nbytes_ret)
|
|
100
|
+
{
|
|
101
|
+
return libdeflate_zlib_decompress_ex(d, in, in_nbytes,
|
|
102
|
+
out, out_nbytes_avail,
|
|
103
|
+
NULL, actual_out_nbytes_ret);
|
|
104
|
+
}
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* libdeflate.h - public header for libdeflate
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#ifndef LIBDEFLATE_H
|
|
6
|
+
#define LIBDEFLATE_H
|
|
7
|
+
|
|
8
|
+
#include <stddef.h>
|
|
9
|
+
#include <stdint.h>
|
|
10
|
+
|
|
11
|
+
#ifdef __cplusplus
|
|
12
|
+
extern "C" {
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
#define LIBDEFLATE_VERSION_MAJOR 1
|
|
16
|
+
#define LIBDEFLATE_VERSION_MINOR 21
|
|
17
|
+
#define LIBDEFLATE_VERSION_STRING "1.21"
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* Users of libdeflate.dll on Windows can define LIBDEFLATE_DLL to cause
|
|
21
|
+
* __declspec(dllimport) to be used. This should be done when it's easy to do.
|
|
22
|
+
* Otherwise it's fine to skip it, since it is a very minor performance
|
|
23
|
+
* optimization that is irrelevant for most use cases of libdeflate.
|
|
24
|
+
*/
|
|
25
|
+
#ifndef LIBDEFLATEAPI
|
|
26
|
+
# if defined(LIBDEFLATE_DLL) && (defined(_WIN32) || defined(__CYGWIN__))
|
|
27
|
+
# define LIBDEFLATEAPI __declspec(dllimport)
|
|
28
|
+
# else
|
|
29
|
+
# define LIBDEFLATEAPI
|
|
30
|
+
# endif
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
/* ========================================================================== */
|
|
34
|
+
/* Compression */
|
|
35
|
+
/* ========================================================================== */
|
|
36
|
+
|
|
37
|
+
struct libdeflate_compressor;
|
|
38
|
+
struct libdeflate_options;
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
* libdeflate_alloc_compressor() allocates a new compressor that supports
|
|
42
|
+
* DEFLATE, zlib, and gzip compression. 'compression_level' is the compression
|
|
43
|
+
* level on a zlib-like scale but with a higher maximum value (1 = fastest, 6 =
|
|
44
|
+
* medium/default, 9 = slow, 12 = slowest). Level 0 is also supported and means
|
|
45
|
+
* "no compression", specifically "create a valid stream, but only emit
|
|
46
|
+
* uncompressed blocks" (this will expand the data slightly).
|
|
47
|
+
*
|
|
48
|
+
* The return value is a pointer to the new compressor, or NULL if out of memory
|
|
49
|
+
* or if the compression level is invalid (i.e. outside the range [0, 12]).
|
|
50
|
+
*
|
|
51
|
+
* Note: for compression, the sliding window size is defined at compilation time
|
|
52
|
+
* to 32768, the largest size permissible in the DEFLATE format. It cannot be
|
|
53
|
+
* changed at runtime.
|
|
54
|
+
*
|
|
55
|
+
* A single compressor is not safe to use by multiple threads concurrently.
|
|
56
|
+
* However, different threads may use different compressors concurrently.
|
|
57
|
+
*/
|
|
58
|
+
LIBDEFLATEAPI struct libdeflate_compressor *
|
|
59
|
+
libdeflate_alloc_compressor(int compression_level);
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
* Like libdeflate_alloc_compressor(), but adds the 'options' argument.
|
|
63
|
+
*/
|
|
64
|
+
LIBDEFLATEAPI struct libdeflate_compressor *
|
|
65
|
+
libdeflate_alloc_compressor_ex(int compression_level,
|
|
66
|
+
const struct libdeflate_options *options);
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* libdeflate_deflate_compress() performs raw DEFLATE compression on a buffer of
|
|
70
|
+
* data. It attempts to compress 'in_nbytes' bytes of data located at 'in' and
|
|
71
|
+
* write the result to 'out', which has space for 'out_nbytes_avail' bytes. The
|
|
72
|
+
* return value is the compressed size in bytes, or 0 if the data could not be
|
|
73
|
+
* compressed to 'out_nbytes_avail' bytes or fewer.
|
|
74
|
+
*
|
|
75
|
+
* If compression is successful, then the output data is guaranteed to be a
|
|
76
|
+
* valid DEFLATE stream that decompresses to the input data. No other
|
|
77
|
+
* guarantees are made about the output data. Notably, different versions of
|
|
78
|
+
* libdeflate can produce different compressed data for the same uncompressed
|
|
79
|
+
* data, even at the same compression level. Do ***NOT*** do things like
|
|
80
|
+
* writing tests that compare compressed data to a golden output, as this can
|
|
81
|
+
* break when libdeflate is updated. (This property isn't specific to
|
|
82
|
+
* libdeflate; the same is true for zlib and other compression libraries too.)
|
|
83
|
+
*/
|
|
84
|
+
LIBDEFLATEAPI size_t
|
|
85
|
+
libdeflate_deflate_compress(struct libdeflate_compressor *compressor,
|
|
86
|
+
const void *in, size_t in_nbytes,
|
|
87
|
+
void *out, size_t out_nbytes_avail);
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
* libdeflate_deflate_compress_bound() returns a worst-case upper bound on the
|
|
91
|
+
* number of bytes of compressed data that may be produced by compressing any
|
|
92
|
+
* buffer of length less than or equal to 'in_nbytes' using
|
|
93
|
+
* libdeflate_deflate_compress() with the specified compressor. This bound will
|
|
94
|
+
* necessarily be a number greater than or equal to 'in_nbytes'. It may be an
|
|
95
|
+
* overestimate of the true upper bound. The return value is guaranteed to be
|
|
96
|
+
* the same for all invocations with the same compressor and same 'in_nbytes'.
|
|
97
|
+
*
|
|
98
|
+
* As a special case, 'compressor' may be NULL. This causes the bound to be
|
|
99
|
+
* taken across *any* libdeflate_compressor that could ever be allocated with
|
|
100
|
+
* this build of the library, with any options.
|
|
101
|
+
*
|
|
102
|
+
* Note that this function is not necessary in many applications. With
|
|
103
|
+
* block-based compression, it is usually preferable to separately store the
|
|
104
|
+
* uncompressed size of each block and to store any blocks that did not compress
|
|
105
|
+
* to less than their original size uncompressed. In that scenario, there is no
|
|
106
|
+
* need to know the worst-case compressed size, since the maximum number of
|
|
107
|
+
* bytes of compressed data that may be used would always be one less than the
|
|
108
|
+
* input length. You can just pass a buffer of that size to
|
|
109
|
+
* libdeflate_deflate_compress() and store the data uncompressed if
|
|
110
|
+
* libdeflate_deflate_compress() returns 0, indicating that the compressed data
|
|
111
|
+
* did not fit into the provided output buffer.
|
|
112
|
+
*/
|
|
113
|
+
LIBDEFLATEAPI size_t
|
|
114
|
+
libdeflate_deflate_compress_bound(struct libdeflate_compressor *compressor,
|
|
115
|
+
size_t in_nbytes);
|
|
116
|
+
|
|
117
|
+
/*
|
|
118
|
+
* Like libdeflate_deflate_compress(), but uses the zlib wrapper format instead
|
|
119
|
+
* of raw DEFLATE.
|
|
120
|
+
*/
|
|
121
|
+
LIBDEFLATEAPI size_t
|
|
122
|
+
libdeflate_zlib_compress(struct libdeflate_compressor *compressor,
|
|
123
|
+
const void *in, size_t in_nbytes,
|
|
124
|
+
void *out, size_t out_nbytes_avail);
|
|
125
|
+
|
|
126
|
+
/*
|
|
127
|
+
* Like libdeflate_deflate_compress_bound(), but assumes the data will be
|
|
128
|
+
* compressed with libdeflate_zlib_compress() rather than with
|
|
129
|
+
* libdeflate_deflate_compress().
|
|
130
|
+
*/
|
|
131
|
+
LIBDEFLATEAPI size_t
|
|
132
|
+
libdeflate_zlib_compress_bound(struct libdeflate_compressor *compressor,
|
|
133
|
+
size_t in_nbytes);
|
|
134
|
+
|
|
135
|
+
/*
|
|
136
|
+
* Like libdeflate_deflate_compress(), but uses the gzip wrapper format instead
|
|
137
|
+
* of raw DEFLATE.
|
|
138
|
+
*/
|
|
139
|
+
LIBDEFLATEAPI size_t
|
|
140
|
+
libdeflate_gzip_compress(struct libdeflate_compressor *compressor,
|
|
141
|
+
const void *in, size_t in_nbytes,
|
|
142
|
+
void *out, size_t out_nbytes_avail);
|
|
143
|
+
|
|
144
|
+
/*
|
|
145
|
+
* Like libdeflate_deflate_compress_bound(), but assumes the data will be
|
|
146
|
+
* compressed with libdeflate_gzip_compress() rather than with
|
|
147
|
+
* libdeflate_deflate_compress().
|
|
148
|
+
*/
|
|
149
|
+
LIBDEFLATEAPI size_t
|
|
150
|
+
libdeflate_gzip_compress_bound(struct libdeflate_compressor *compressor,
|
|
151
|
+
size_t in_nbytes);
|
|
152
|
+
|
|
153
|
+
/*
|
|
154
|
+
* libdeflate_free_compressor() frees a compressor that was allocated with
|
|
155
|
+
* libdeflate_alloc_compressor(). If a NULL pointer is passed in, no action is
|
|
156
|
+
* taken.
|
|
157
|
+
*/
|
|
158
|
+
LIBDEFLATEAPI void
|
|
159
|
+
libdeflate_free_compressor(struct libdeflate_compressor *compressor);
|
|
160
|
+
|
|
161
|
+
/* ========================================================================== */
|
|
162
|
+
/* Decompression */
|
|
163
|
+
/* ========================================================================== */
|
|
164
|
+
|
|
165
|
+
struct libdeflate_decompressor;
|
|
166
|
+
struct libdeflate_options;
|
|
167
|
+
|
|
168
|
+
/*
|
|
169
|
+
* libdeflate_alloc_decompressor() allocates a new decompressor that can be used
|
|
170
|
+
* for DEFLATE, zlib, and gzip decompression. The return value is a pointer to
|
|
171
|
+
* the new decompressor, or NULL if out of memory.
|
|
172
|
+
*
|
|
173
|
+
* This function takes no parameters, and the returned decompressor is valid for
|
|
174
|
+
* decompressing data that was compressed at any compression level and with any
|
|
175
|
+
* sliding window size.
|
|
176
|
+
*
|
|
177
|
+
* A single decompressor is not safe to use by multiple threads concurrently.
|
|
178
|
+
* However, different threads may use different decompressors concurrently.
|
|
179
|
+
*/
|
|
180
|
+
LIBDEFLATEAPI struct libdeflate_decompressor *
|
|
181
|
+
libdeflate_alloc_decompressor(void);
|
|
182
|
+
|
|
183
|
+
/*
|
|
184
|
+
* Like libdeflate_alloc_decompressor(), but adds the 'options' argument.
|
|
185
|
+
*/
|
|
186
|
+
LIBDEFLATEAPI struct libdeflate_decompressor *
|
|
187
|
+
libdeflate_alloc_decompressor_ex(const struct libdeflate_options *options);
|
|
188
|
+
|
|
189
|
+
/*
|
|
190
|
+
* Result of a call to libdeflate_deflate_decompress(),
|
|
191
|
+
* libdeflate_zlib_decompress(), or libdeflate_gzip_decompress().
|
|
192
|
+
*/
|
|
193
|
+
enum libdeflate_result {
|
|
194
|
+
/* Decompression was successful. */
|
|
195
|
+
LIBDEFLATE_SUCCESS = 0,
|
|
196
|
+
|
|
197
|
+
/* Decompression failed because the compressed data was invalid,
|
|
198
|
+
* corrupt, or otherwise unsupported. */
|
|
199
|
+
LIBDEFLATE_BAD_DATA = 1,
|
|
200
|
+
|
|
201
|
+
/* A NULL 'actual_out_nbytes_ret' was provided, but the data would have
|
|
202
|
+
* decompressed to fewer than 'out_nbytes_avail' bytes. */
|
|
203
|
+
LIBDEFLATE_SHORT_OUTPUT = 2,
|
|
204
|
+
|
|
205
|
+
/* The data would have decompressed to more than 'out_nbytes_avail'
|
|
206
|
+
* bytes. */
|
|
207
|
+
LIBDEFLATE_INSUFFICIENT_SPACE = 3,
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/*
|
|
211
|
+
* libdeflate_deflate_decompress() decompresses a DEFLATE stream from the buffer
|
|
212
|
+
* 'in' with compressed size up to 'in_nbytes' bytes. The uncompressed data is
|
|
213
|
+
* written to 'out', a buffer with size 'out_nbytes_avail' bytes. If
|
|
214
|
+
* decompression succeeds, then 0 (LIBDEFLATE_SUCCESS) is returned. Otherwise,
|
|
215
|
+
* a nonzero result code such as LIBDEFLATE_BAD_DATA is returned, and the
|
|
216
|
+
* contents of the output buffer are undefined.
|
|
217
|
+
*
|
|
218
|
+
* Decompression stops at the end of the DEFLATE stream (as indicated by the
|
|
219
|
+
* BFINAL flag), even if it is actually shorter than 'in_nbytes' bytes.
|
|
220
|
+
*
|
|
221
|
+
* libdeflate_deflate_decompress() can be used in cases where the actual
|
|
222
|
+
* uncompressed size is known (recommended) or unknown (not recommended):
|
|
223
|
+
*
|
|
224
|
+
* - If the actual uncompressed size is known, then pass the actual
|
|
225
|
+
* uncompressed size as 'out_nbytes_avail' and pass NULL for
|
|
226
|
+
* 'actual_out_nbytes_ret'. This makes libdeflate_deflate_decompress() fail
|
|
227
|
+
* with LIBDEFLATE_SHORT_OUTPUT if the data decompressed to fewer than the
|
|
228
|
+
* specified number of bytes.
|
|
229
|
+
*
|
|
230
|
+
* - If the actual uncompressed size is unknown, then provide a non-NULL
|
|
231
|
+
* 'actual_out_nbytes_ret' and provide a buffer with some size
|
|
232
|
+
* 'out_nbytes_avail' that you think is large enough to hold all the
|
|
233
|
+
* uncompressed data. In this case, if the data decompresses to less than
|
|
234
|
+
* or equal to 'out_nbytes_avail' bytes, then
|
|
235
|
+
* libdeflate_deflate_decompress() will write the actual uncompressed size
|
|
236
|
+
* to *actual_out_nbytes_ret and return 0 (LIBDEFLATE_SUCCESS). Otherwise,
|
|
237
|
+
* it will return LIBDEFLATE_INSUFFICIENT_SPACE if the provided buffer was
|
|
238
|
+
* not large enough but no other problems were encountered, or another
|
|
239
|
+
* nonzero result code if decompression failed for another reason.
|
|
240
|
+
*/
|
|
241
|
+
LIBDEFLATEAPI enum libdeflate_result
|
|
242
|
+
libdeflate_deflate_decompress(struct libdeflate_decompressor *decompressor,
|
|
243
|
+
const void *in, size_t in_nbytes,
|
|
244
|
+
void *out, size_t out_nbytes_avail,
|
|
245
|
+
size_t *actual_out_nbytes_ret);
|
|
246
|
+
|
|
247
|
+
/*
|
|
248
|
+
* Like libdeflate_deflate_decompress(), but adds the 'actual_in_nbytes_ret'
|
|
249
|
+
* argument. If decompression succeeds and 'actual_in_nbytes_ret' is not NULL,
|
|
250
|
+
* then the actual compressed size of the DEFLATE stream (aligned to the next
|
|
251
|
+
* byte boundary) is written to *actual_in_nbytes_ret.
|
|
252
|
+
*/
|
|
253
|
+
LIBDEFLATEAPI enum libdeflate_result
|
|
254
|
+
libdeflate_deflate_decompress_ex(struct libdeflate_decompressor *decompressor,
|
|
255
|
+
const void *in, size_t in_nbytes,
|
|
256
|
+
void *out, size_t out_nbytes_avail,
|
|
257
|
+
size_t *actual_in_nbytes_ret,
|
|
258
|
+
size_t *actual_out_nbytes_ret);
|
|
259
|
+
|
|
260
|
+
/*
|
|
261
|
+
* Like libdeflate_deflate_decompress(), but assumes the zlib wrapper format
|
|
262
|
+
* instead of raw DEFLATE.
|
|
263
|
+
*
|
|
264
|
+
* Decompression will stop at the end of the zlib stream, even if it is shorter
|
|
265
|
+
* than 'in_nbytes'. If you need to know exactly where the zlib stream ended,
|
|
266
|
+
* use libdeflate_zlib_decompress_ex().
|
|
267
|
+
*/
|
|
268
|
+
LIBDEFLATEAPI enum libdeflate_result
|
|
269
|
+
libdeflate_zlib_decompress(struct libdeflate_decompressor *decompressor,
|
|
270
|
+
const void *in, size_t in_nbytes,
|
|
271
|
+
void *out, size_t out_nbytes_avail,
|
|
272
|
+
size_t *actual_out_nbytes_ret);
|
|
273
|
+
|
|
274
|
+
/*
|
|
275
|
+
* Like libdeflate_zlib_decompress(), but adds the 'actual_in_nbytes_ret'
|
|
276
|
+
* argument. If 'actual_in_nbytes_ret' is not NULL and the decompression
|
|
277
|
+
* succeeds (indicating that the first zlib-compressed stream in the input
|
|
278
|
+
* buffer was decompressed), then the actual number of input bytes consumed is
|
|
279
|
+
* written to *actual_in_nbytes_ret.
|
|
280
|
+
*/
|
|
281
|
+
LIBDEFLATEAPI enum libdeflate_result
|
|
282
|
+
libdeflate_zlib_decompress_ex(struct libdeflate_decompressor *decompressor,
|
|
283
|
+
const void *in, size_t in_nbytes,
|
|
284
|
+
void *out, size_t out_nbytes_avail,
|
|
285
|
+
size_t *actual_in_nbytes_ret,
|
|
286
|
+
size_t *actual_out_nbytes_ret);
|
|
287
|
+
|
|
288
|
+
/*
|
|
289
|
+
* Like libdeflate_deflate_decompress(), but assumes the gzip wrapper format
|
|
290
|
+
* instead of raw DEFLATE.
|
|
291
|
+
*
|
|
292
|
+
* If multiple gzip-compressed members are concatenated, then only the first
|
|
293
|
+
* will be decompressed. Use libdeflate_gzip_decompress_ex() if you need
|
|
294
|
+
* multi-member support.
|
|
295
|
+
*/
|
|
296
|
+
LIBDEFLATEAPI enum libdeflate_result
|
|
297
|
+
libdeflate_gzip_decompress(struct libdeflate_decompressor *decompressor,
|
|
298
|
+
const void *in, size_t in_nbytes,
|
|
299
|
+
void *out, size_t out_nbytes_avail,
|
|
300
|
+
size_t *actual_out_nbytes_ret);
|
|
301
|
+
|
|
302
|
+
/*
|
|
303
|
+
* Like libdeflate_gzip_decompress(), but adds the 'actual_in_nbytes_ret'
|
|
304
|
+
* argument. If 'actual_in_nbytes_ret' is not NULL and the decompression
|
|
305
|
+
* succeeds (indicating that the first gzip-compressed member in the input
|
|
306
|
+
* buffer was decompressed), then the actual number of input bytes consumed is
|
|
307
|
+
* written to *actual_in_nbytes_ret.
|
|
308
|
+
*/
|
|
309
|
+
LIBDEFLATEAPI enum libdeflate_result
|
|
310
|
+
libdeflate_gzip_decompress_ex(struct libdeflate_decompressor *decompressor,
|
|
311
|
+
const void *in, size_t in_nbytes,
|
|
312
|
+
void *out, size_t out_nbytes_avail,
|
|
313
|
+
size_t *actual_in_nbytes_ret,
|
|
314
|
+
size_t *actual_out_nbytes_ret);
|
|
315
|
+
|
|
316
|
+
/*
|
|
317
|
+
* libdeflate_free_decompressor() frees a decompressor that was allocated with
|
|
318
|
+
* libdeflate_alloc_decompressor(). If a NULL pointer is passed in, no action
|
|
319
|
+
* is taken.
|
|
320
|
+
*/
|
|
321
|
+
LIBDEFLATEAPI void
|
|
322
|
+
libdeflate_free_decompressor(struct libdeflate_decompressor *decompressor);
|
|
323
|
+
|
|
324
|
+
/* ========================================================================== */
|
|
325
|
+
/* Checksums */
|
|
326
|
+
/* ========================================================================== */
|
|
327
|
+
|
|
328
|
+
/*
|
|
329
|
+
* libdeflate_adler32() updates a running Adler-32 checksum with 'len' bytes of
|
|
330
|
+
* data and returns the updated checksum. When starting a new checksum, the
|
|
331
|
+
* required initial value for 'adler' is 1. This value is also returned when
|
|
332
|
+
* 'buffer' is specified as NULL.
|
|
333
|
+
*/
|
|
334
|
+
LIBDEFLATEAPI uint32_t
|
|
335
|
+
libdeflate_adler32(uint32_t adler, const void *buffer, size_t len);
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
/*
|
|
339
|
+
* libdeflate_crc32() updates a running CRC-32 checksum with 'len' bytes of data
|
|
340
|
+
* and returns the updated checksum. When starting a new checksum, the required
|
|
341
|
+
* initial value for 'crc' is 0. This value is also returned when 'buffer' is
|
|
342
|
+
* specified as NULL.
|
|
343
|
+
*/
|
|
344
|
+
LIBDEFLATEAPI uint32_t
|
|
345
|
+
libdeflate_crc32(uint32_t crc, const void *buffer, size_t len);
|
|
346
|
+
|
|
347
|
+
/* ========================================================================== */
|
|
348
|
+
/* Custom memory allocator */
|
|
349
|
+
/* ========================================================================== */
|
|
350
|
+
|
|
351
|
+
/*
|
|
352
|
+
* Install a custom memory allocator which libdeflate will use for all memory
|
|
353
|
+
* allocations by default. 'malloc_func' is a function that must behave like
|
|
354
|
+
* malloc(), and 'free_func' is a function that must behave like free().
|
|
355
|
+
*
|
|
356
|
+
* The per-(de)compressor custom memory allocator that can be specified in
|
|
357
|
+
* 'struct libdeflate_options' takes priority over this.
|
|
358
|
+
*
|
|
359
|
+
* This doesn't affect the free() function that will be used to free
|
|
360
|
+
* (de)compressors that were already in existence when this is called.
|
|
361
|
+
*/
|
|
362
|
+
LIBDEFLATEAPI void
|
|
363
|
+
libdeflate_set_memory_allocator(void *(*malloc_func)(size_t),
|
|
364
|
+
void (*free_func)(void *));
|
|
365
|
+
|
|
366
|
+
/*
|
|
367
|
+
* Advanced options. This is the options structure that
|
|
368
|
+
* libdeflate_alloc_compressor_ex() and libdeflate_alloc_decompressor_ex()
|
|
369
|
+
* require. Most users won't need this and should just use the non-"_ex"
|
|
370
|
+
* functions instead. If you do need this, it should be initialized like this:
|
|
371
|
+
*
|
|
372
|
+
* struct libdeflate_options options;
|
|
373
|
+
*
|
|
374
|
+
* memset(&options, 0, sizeof(options));
|
|
375
|
+
* options.sizeof_options = sizeof(options);
|
|
376
|
+
* // Then set the fields that you need to override the defaults for.
|
|
377
|
+
*/
|
|
378
|
+
struct libdeflate_options {
|
|
379
|
+
|
|
380
|
+
/*
|
|
381
|
+
* This field must be set to the struct size. This field exists for
|
|
382
|
+
* extensibility, so that fields can be appended to this struct in
|
|
383
|
+
* future versions of libdeflate while still supporting old binaries.
|
|
384
|
+
*/
|
|
385
|
+
size_t sizeof_options;
|
|
386
|
+
|
|
387
|
+
/*
|
|
388
|
+
* An optional custom memory allocator to use for this (de)compressor.
|
|
389
|
+
* 'malloc_func' must be a function that behaves like malloc(), and
|
|
390
|
+
* 'free_func' must be a function that behaves like free().
|
|
391
|
+
*
|
|
392
|
+
* This is useful in cases where a process might have multiple users of
|
|
393
|
+
* libdeflate who want to use different memory allocators. For example,
|
|
394
|
+
* a library might want to use libdeflate with a custom memory allocator
|
|
395
|
+
* without interfering with user code that might use libdeflate too.
|
|
396
|
+
*
|
|
397
|
+
* This takes priority over the "global" memory allocator (which by
|
|
398
|
+
* default is malloc() and free(), but can be changed by
|
|
399
|
+
* libdeflate_set_memory_allocator()). Moreover, libdeflate will never
|
|
400
|
+
* call the "global" memory allocator if a per-(de)compressor custom
|
|
401
|
+
* allocator is always given.
|
|
402
|
+
*/
|
|
403
|
+
void *(*malloc_func)(size_t);
|
|
404
|
+
void (*free_func)(void *);
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
#ifdef __cplusplus
|
|
408
|
+
}
|
|
409
|
+
#endif
|
|
410
|
+
|
|
411
|
+
#endif /* LIBDEFLATE_H */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
prefix=@CMAKE_INSTALL_PREFIX@
|
|
2
|
+
exec_prefix=${prefix}
|
|
3
|
+
includedir=@CMAKE_PKGCONFIG_INCLUDEDIR@
|
|
4
|
+
libdir=@CMAKE_PKGCONFIG_LIBDIR@
|
|
5
|
+
|
|
6
|
+
Name: libdeflate
|
|
7
|
+
Description: Fast implementation of DEFLATE, zlib, and gzip
|
|
8
|
+
Version: @PROJECT_VERSION@
|
|
9
|
+
Libs: -L${libdir} -ldeflate
|
|
10
|
+
Cflags: -I${includedir}
|
|
11
|
+
|
|
12
|
+
# Note: this library's public header allows LIBDEFLATE_DLL to be defined when
|
|
13
|
+
# linking to the DLL on Windows, to make __declspec(dllimport) be used.
|
|
14
|
+
# However, the only way to define a shared-library-only flag in a pkgconfig file
|
|
15
|
+
# is to use the weird workaround of unconditionally defining it in Cflags, then
|
|
16
|
+
# undefining it in Cflags.private. Just don't bother with this, since
|
|
17
|
+
# __declspec(dllimport) is optional anyway. It is a very minor performance
|
|
18
|
+
# optimization that is irrelevant for most use cases of libdeflate.
|