zstdlib 0.13.0-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +6 -0
- data/CHANGES.md +107 -0
- data/Gemfile +3 -0
- data/README.md +107 -0
- data/Rakefile +59 -0
- data/ext/zstdlib_c/extconf.rb +59 -0
- data/ext/zstdlib_c/ruby/zlib-2.2/zstdlib.c +4675 -0
- data/ext/zstdlib_c/ruby/zlib-2.3/zstdlib.c +4702 -0
- data/ext/zstdlib_c/ruby/zlib-2.4/zstdlib.c +4859 -0
- data/ext/zstdlib_c/ruby/zlib-2.5/zstdlib.c +4864 -0
- data/ext/zstdlib_c/ruby/zlib-2.6/zstdlib.c +4906 -0
- data/ext/zstdlib_c/ruby/zlib-2.7/zstdlib.c +4895 -0
- data/ext/zstdlib_c/ruby/zlib-3.0/zstdlib.c +4994 -0
- data/ext/zstdlib_c/ruby/zlib-3.1/zstdlib.c +5076 -0
- 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.3.1/adler32.c +164 -0
- data/ext/zstdlib_c/zlib-1.3.1/compress.c +75 -0
- data/ext/zstdlib_c/zlib-1.3.1/crc32.c +1049 -0
- data/ext/zstdlib_c/zlib-1.3.1/crc32.h +9446 -0
- data/ext/zstdlib_c/zlib-1.3.1/deflate.c +2139 -0
- data/ext/zstdlib_c/zlib-1.3.1/deflate.h +377 -0
- data/ext/zstdlib_c/zlib-1.3.1/gzclose.c +23 -0
- data/ext/zstdlib_c/zlib-1.3.1/gzguts.h +214 -0
- data/ext/zstdlib_c/zlib-1.3.1/gzlib.c +582 -0
- data/ext/zstdlib_c/zlib-1.3.1/gzread.c +602 -0
- data/ext/zstdlib_c/zlib-1.3.1/gzwrite.c +631 -0
- data/ext/zstdlib_c/zlib-1.3.1/infback.c +628 -0
- data/ext/zstdlib_c/zlib-1.3.1/inffast.c +320 -0
- data/ext/zstdlib_c/zlib-1.3.1/inffast.h +11 -0
- data/ext/zstdlib_c/zlib-1.3.1/inffixed.h +94 -0
- data/ext/zstdlib_c/zlib-1.3.1/inflate.c +1526 -0
- data/ext/zstdlib_c/zlib-1.3.1/inflate.h +126 -0
- data/ext/zstdlib_c/zlib-1.3.1/inftrees.c +299 -0
- data/ext/zstdlib_c/zlib-1.3.1/inftrees.h +62 -0
- data/ext/zstdlib_c/zlib-1.3.1/trees.c +1117 -0
- data/ext/zstdlib_c/zlib-1.3.1/trees.h +128 -0
- data/ext/zstdlib_c/zlib-1.3.1/uncompr.c +85 -0
- data/ext/zstdlib_c/zlib-1.3.1/zconf.h +543 -0
- data/ext/zstdlib_c/zlib-1.3.1/zlib.h +1938 -0
- data/ext/zstdlib_c/zlib-1.3.1/zutil.c +299 -0
- data/ext/zstdlib_c/zlib-1.3.1/zutil.h +254 -0
- data/ext/zstdlib_c/zlib.mk +14 -0
- data/ext/zstdlib_c/zlibwrapper/zlibwrapper.c +10 -0
- data/ext/zstdlib_c/zlibwrapper.mk +14 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/allocations.h +55 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/bits.h +200 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/bitstream.h +457 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/compiler.h +450 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/cpu.h +249 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/debug.c +30 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/debug.h +116 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/entropy_common.c +340 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/error_private.c +63 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/error_private.h +168 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/fse.h +640 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/fse_decompress.c +313 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/huf.h +286 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/mem.h +426 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/pool.c +371 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/pool.h +90 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/portability_macros.h +158 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/threading.c +182 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/threading.h +150 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/xxhash.c +18 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/xxhash.h +7020 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_common.c +48 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_deps.h +111 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_internal.h +392 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_trace.h +163 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/clevels.h +134 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/fse_compress.c +625 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/hist.c +181 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/hist.h +75 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/huf_compress.c +1464 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress.c +7153 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_internal.h +1534 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_literals.c +235 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_literals.h +39 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_sequences.c +442 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_sequences.h +54 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_superblock.c +688 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_superblock.h +32 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_cwksp.h +748 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_double_fast.c +770 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_double_fast.h +50 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_fast.c +968 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_fast.h +38 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_lazy.c +2199 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_lazy.h +202 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_ldm.c +730 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_ldm.h +117 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_ldm_geartab.h +106 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_opt.c +1576 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_opt.h +80 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstdmt_compress.c +1882 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstdmt_compress.h +113 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/huf_decompress.c +1944 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/huf_decompress_amd64.S +595 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_ddict.c +244 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_ddict.h +44 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress.c +2407 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress_block.c +2215 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress_block.h +73 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress_internal.h +240 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/zdict.h +474 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/zstd.h +3089 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/zstd_errors.h +114 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzclose.c +26 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzcompatibility.h +68 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzguts.h +229 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzlib.c +587 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzread.c +637 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzwrite.c +631 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/zstd_zlibwrapper.c +1200 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/zstd_zlibwrapper.h +91 -0
- data/ext/zstdlib_c/zstd.mk +15 -0
- 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
- data/lib/zstdlib.rb +6 -0
- data/test/zstdlib_test.rb +21 -0
- metadata +243 -0
@@ -0,0 +1,48 @@
|
|
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
|
+
|
12
|
+
|
13
|
+
/*-*************************************
|
14
|
+
* Dependencies
|
15
|
+
***************************************/
|
16
|
+
#define ZSTD_DEPS_NEED_MALLOC
|
17
|
+
#include "error_private.h"
|
18
|
+
#include "zstd_internal.h"
|
19
|
+
|
20
|
+
|
21
|
+
/*-****************************************
|
22
|
+
* Version
|
23
|
+
******************************************/
|
24
|
+
unsigned ZSTD_versionNumber(void) { return ZSTD_VERSION_NUMBER; }
|
25
|
+
|
26
|
+
const char* ZSTD_versionString(void) { return ZSTD_VERSION_STRING; }
|
27
|
+
|
28
|
+
|
29
|
+
/*-****************************************
|
30
|
+
* ZSTD Error Management
|
31
|
+
******************************************/
|
32
|
+
#undef ZSTD_isError /* defined within zstd_internal.h */
|
33
|
+
/*! ZSTD_isError() :
|
34
|
+
* tells if a return value is an error code
|
35
|
+
* symbol is required for external callers */
|
36
|
+
unsigned ZSTD_isError(size_t code) { return ERR_isError(code); }
|
37
|
+
|
38
|
+
/*! ZSTD_getErrorName() :
|
39
|
+
* provides error code string from function result (useful for debugging) */
|
40
|
+
const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); }
|
41
|
+
|
42
|
+
/*! ZSTD_getError() :
|
43
|
+
* convert a `size_t` function result into a proper ZSTD_errorCode enum */
|
44
|
+
ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); }
|
45
|
+
|
46
|
+
/*! ZSTD_getErrorString() :
|
47
|
+
* provides error code string from enum */
|
48
|
+
const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); }
|
@@ -0,0 +1,111 @@
|
|
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 common libc dependencies that zstd requires.
|
12
|
+
* The purpose is to allow replacing this file with a custom implementation
|
13
|
+
* to compile zstd without libc support.
|
14
|
+
*/
|
15
|
+
|
16
|
+
/* Need:
|
17
|
+
* NULL
|
18
|
+
* INT_MAX
|
19
|
+
* UINT_MAX
|
20
|
+
* ZSTD_memcpy()
|
21
|
+
* ZSTD_memset()
|
22
|
+
* ZSTD_memmove()
|
23
|
+
*/
|
24
|
+
#ifndef ZSTD_DEPS_COMMON
|
25
|
+
#define ZSTD_DEPS_COMMON
|
26
|
+
|
27
|
+
#include <limits.h>
|
28
|
+
#include <stddef.h>
|
29
|
+
#include <string.h>
|
30
|
+
|
31
|
+
#if defined(__GNUC__) && __GNUC__ >= 4
|
32
|
+
# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
|
33
|
+
# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
|
34
|
+
# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
|
35
|
+
#else
|
36
|
+
# define ZSTD_memcpy(d,s,l) memcpy((d),(s),(l))
|
37
|
+
# define ZSTD_memmove(d,s,l) memmove((d),(s),(l))
|
38
|
+
# define ZSTD_memset(p,v,l) memset((p),(v),(l))
|
39
|
+
#endif
|
40
|
+
|
41
|
+
#endif /* ZSTD_DEPS_COMMON */
|
42
|
+
|
43
|
+
/* Need:
|
44
|
+
* ZSTD_malloc()
|
45
|
+
* ZSTD_free()
|
46
|
+
* ZSTD_calloc()
|
47
|
+
*/
|
48
|
+
#ifdef ZSTD_DEPS_NEED_MALLOC
|
49
|
+
#ifndef ZSTD_DEPS_MALLOC
|
50
|
+
#define ZSTD_DEPS_MALLOC
|
51
|
+
|
52
|
+
#include <stdlib.h>
|
53
|
+
|
54
|
+
#define ZSTD_malloc(s) malloc(s)
|
55
|
+
#define ZSTD_calloc(n,s) calloc((n), (s))
|
56
|
+
#define ZSTD_free(p) free((p))
|
57
|
+
|
58
|
+
#endif /* ZSTD_DEPS_MALLOC */
|
59
|
+
#endif /* ZSTD_DEPS_NEED_MALLOC */
|
60
|
+
|
61
|
+
/*
|
62
|
+
* Provides 64-bit math support.
|
63
|
+
* Need:
|
64
|
+
* U64 ZSTD_div64(U64 dividend, U32 divisor)
|
65
|
+
*/
|
66
|
+
#ifdef ZSTD_DEPS_NEED_MATH64
|
67
|
+
#ifndef ZSTD_DEPS_MATH64
|
68
|
+
#define ZSTD_DEPS_MATH64
|
69
|
+
|
70
|
+
#define ZSTD_div64(dividend, divisor) ((dividend) / (divisor))
|
71
|
+
|
72
|
+
#endif /* ZSTD_DEPS_MATH64 */
|
73
|
+
#endif /* ZSTD_DEPS_NEED_MATH64 */
|
74
|
+
|
75
|
+
/* Need:
|
76
|
+
* assert()
|
77
|
+
*/
|
78
|
+
#ifdef ZSTD_DEPS_NEED_ASSERT
|
79
|
+
#ifndef ZSTD_DEPS_ASSERT
|
80
|
+
#define ZSTD_DEPS_ASSERT
|
81
|
+
|
82
|
+
#include <assert.h>
|
83
|
+
|
84
|
+
#endif /* ZSTD_DEPS_ASSERT */
|
85
|
+
#endif /* ZSTD_DEPS_NEED_ASSERT */
|
86
|
+
|
87
|
+
/* Need:
|
88
|
+
* ZSTD_DEBUG_PRINT()
|
89
|
+
*/
|
90
|
+
#ifdef ZSTD_DEPS_NEED_IO
|
91
|
+
#ifndef ZSTD_DEPS_IO
|
92
|
+
#define ZSTD_DEPS_IO
|
93
|
+
|
94
|
+
#include <stdio.h>
|
95
|
+
#define ZSTD_DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
|
96
|
+
|
97
|
+
#endif /* ZSTD_DEPS_IO */
|
98
|
+
#endif /* ZSTD_DEPS_NEED_IO */
|
99
|
+
|
100
|
+
/* Only requested when <stdint.h> is known to be present.
|
101
|
+
* Need:
|
102
|
+
* intptr_t
|
103
|
+
*/
|
104
|
+
#ifdef ZSTD_DEPS_NEED_STDINT
|
105
|
+
#ifndef ZSTD_DEPS_STDINT
|
106
|
+
#define ZSTD_DEPS_STDINT
|
107
|
+
|
108
|
+
#include <stdint.h>
|
109
|
+
|
110
|
+
#endif /* ZSTD_DEPS_STDINT */
|
111
|
+
#endif /* ZSTD_DEPS_NEED_STDINT */
|
@@ -0,0 +1,392 @@
|
|
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_CCOMMON_H_MODULE
|
12
|
+
#define ZSTD_CCOMMON_H_MODULE
|
13
|
+
|
14
|
+
/* this module contains definitions which must be identical
|
15
|
+
* across compression, decompression and dictBuilder.
|
16
|
+
* It also contains a few functions useful to at least 2 of them
|
17
|
+
* and which benefit from being inlined */
|
18
|
+
|
19
|
+
/*-*************************************
|
20
|
+
* Dependencies
|
21
|
+
***************************************/
|
22
|
+
#include "compiler.h"
|
23
|
+
#include "cpu.h"
|
24
|
+
#include "mem.h"
|
25
|
+
#include "debug.h" /* assert, DEBUGLOG, RAWLOG, g_debuglevel */
|
26
|
+
#include "error_private.h"
|
27
|
+
#define ZSTD_STATIC_LINKING_ONLY
|
28
|
+
#include "../zstd.h"
|
29
|
+
#define FSE_STATIC_LINKING_ONLY
|
30
|
+
#include "fse.h"
|
31
|
+
#include "huf.h"
|
32
|
+
#ifndef XXH_STATIC_LINKING_ONLY
|
33
|
+
# define XXH_STATIC_LINKING_ONLY /* XXH64_state_t */
|
34
|
+
#endif
|
35
|
+
#include "xxhash.h" /* XXH_reset, update, digest */
|
36
|
+
#ifndef ZSTD_NO_TRACE
|
37
|
+
# include "zstd_trace.h"
|
38
|
+
#else
|
39
|
+
# define ZSTD_TRACE 0
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#if defined (__cplusplus)
|
43
|
+
extern "C" {
|
44
|
+
#endif
|
45
|
+
|
46
|
+
/* ---- static assert (debug) --- */
|
47
|
+
#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
|
48
|
+
#define ZSTD_isError ERR_isError /* for inlining */
|
49
|
+
#define FSE_isError ERR_isError
|
50
|
+
#define HUF_isError ERR_isError
|
51
|
+
|
52
|
+
|
53
|
+
/*-*************************************
|
54
|
+
* shared macros
|
55
|
+
***************************************/
|
56
|
+
#undef MIN
|
57
|
+
#undef MAX
|
58
|
+
#define MIN(a,b) ((a)<(b) ? (a) : (b))
|
59
|
+
#define MAX(a,b) ((a)>(b) ? (a) : (b))
|
60
|
+
#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
|
61
|
+
|
62
|
+
|
63
|
+
/*-*************************************
|
64
|
+
* Common constants
|
65
|
+
***************************************/
|
66
|
+
#define ZSTD_OPT_NUM (1<<12)
|
67
|
+
|
68
|
+
#define ZSTD_REP_NUM 3 /* number of repcodes */
|
69
|
+
static UNUSED_ATTR const U32 repStartValue[ZSTD_REP_NUM] = { 1, 4, 8 };
|
70
|
+
|
71
|
+
#define KB *(1 <<10)
|
72
|
+
#define MB *(1 <<20)
|
73
|
+
#define GB *(1U<<30)
|
74
|
+
|
75
|
+
#define BIT7 128
|
76
|
+
#define BIT6 64
|
77
|
+
#define BIT5 32
|
78
|
+
#define BIT4 16
|
79
|
+
#define BIT1 2
|
80
|
+
#define BIT0 1
|
81
|
+
|
82
|
+
#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
|
83
|
+
static UNUSED_ATTR const size_t ZSTD_fcs_fieldSize[4] = { 0, 2, 4, 8 };
|
84
|
+
static UNUSED_ATTR const size_t ZSTD_did_fieldSize[4] = { 0, 1, 2, 4 };
|
85
|
+
|
86
|
+
#define ZSTD_FRAMEIDSIZE 4 /* magic number size */
|
87
|
+
|
88
|
+
#define ZSTD_BLOCKHEADERSIZE 3 /* C standard doesn't allow `static const` variable to be init using another `static const` variable */
|
89
|
+
static UNUSED_ATTR const size_t ZSTD_blockHeaderSize = ZSTD_BLOCKHEADERSIZE;
|
90
|
+
typedef enum { bt_raw, bt_rle, bt_compressed, bt_reserved } blockType_e;
|
91
|
+
|
92
|
+
#define ZSTD_FRAMECHECKSUMSIZE 4
|
93
|
+
|
94
|
+
#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
|
95
|
+
#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */) /* for a non-null block */
|
96
|
+
#define MIN_LITERALS_FOR_4_STREAMS 6
|
97
|
+
|
98
|
+
typedef enum { set_basic, set_rle, set_compressed, set_repeat } symbolEncodingType_e;
|
99
|
+
|
100
|
+
#define LONGNBSEQ 0x7F00
|
101
|
+
|
102
|
+
#define MINMATCH 3
|
103
|
+
|
104
|
+
#define Litbits 8
|
105
|
+
#define LitHufLog 11
|
106
|
+
#define MaxLit ((1<<Litbits) - 1)
|
107
|
+
#define MaxML 52
|
108
|
+
#define MaxLL 35
|
109
|
+
#define DefaultMaxOff 28
|
110
|
+
#define MaxOff 31
|
111
|
+
#define MaxSeq MAX(MaxLL, MaxML) /* Assumption : MaxOff < MaxLL,MaxML */
|
112
|
+
#define MLFSELog 9
|
113
|
+
#define LLFSELog 9
|
114
|
+
#define OffFSELog 8
|
115
|
+
#define MaxFSELog MAX(MAX(MLFSELog, LLFSELog), OffFSELog)
|
116
|
+
#define MaxMLBits 16
|
117
|
+
#define MaxLLBits 16
|
118
|
+
|
119
|
+
#define ZSTD_MAX_HUF_HEADER_SIZE 128 /* header + <= 127 byte tree description */
|
120
|
+
/* Each table cannot take more than #symbols * FSELog bits */
|
121
|
+
#define ZSTD_MAX_FSE_HEADERS_SIZE (((MaxML + 1) * MLFSELog + (MaxLL + 1) * LLFSELog + (MaxOff + 1) * OffFSELog + 7) / 8)
|
122
|
+
|
123
|
+
static UNUSED_ATTR const U8 LL_bits[MaxLL+1] = {
|
124
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
125
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
126
|
+
1, 1, 1, 1, 2, 2, 3, 3,
|
127
|
+
4, 6, 7, 8, 9,10,11,12,
|
128
|
+
13,14,15,16
|
129
|
+
};
|
130
|
+
static UNUSED_ATTR const S16 LL_defaultNorm[MaxLL+1] = {
|
131
|
+
4, 3, 2, 2, 2, 2, 2, 2,
|
132
|
+
2, 2, 2, 2, 2, 1, 1, 1,
|
133
|
+
2, 2, 2, 2, 2, 2, 2, 2,
|
134
|
+
2, 3, 2, 1, 1, 1, 1, 1,
|
135
|
+
-1,-1,-1,-1
|
136
|
+
};
|
137
|
+
#define LL_DEFAULTNORMLOG 6 /* for static allocation */
|
138
|
+
static UNUSED_ATTR const U32 LL_defaultNormLog = LL_DEFAULTNORMLOG;
|
139
|
+
|
140
|
+
static UNUSED_ATTR const U8 ML_bits[MaxML+1] = {
|
141
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
142
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
143
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
144
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
145
|
+
1, 1, 1, 1, 2, 2, 3, 3,
|
146
|
+
4, 4, 5, 7, 8, 9,10,11,
|
147
|
+
12,13,14,15,16
|
148
|
+
};
|
149
|
+
static UNUSED_ATTR const S16 ML_defaultNorm[MaxML+1] = {
|
150
|
+
1, 4, 3, 2, 2, 2, 2, 2,
|
151
|
+
2, 1, 1, 1, 1, 1, 1, 1,
|
152
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
153
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
154
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
155
|
+
1, 1, 1, 1, 1, 1,-1,-1,
|
156
|
+
-1,-1,-1,-1,-1
|
157
|
+
};
|
158
|
+
#define ML_DEFAULTNORMLOG 6 /* for static allocation */
|
159
|
+
static UNUSED_ATTR const U32 ML_defaultNormLog = ML_DEFAULTNORMLOG;
|
160
|
+
|
161
|
+
static UNUSED_ATTR const S16 OF_defaultNorm[DefaultMaxOff+1] = {
|
162
|
+
1, 1, 1, 1, 1, 1, 2, 2,
|
163
|
+
2, 1, 1, 1, 1, 1, 1, 1,
|
164
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
165
|
+
-1,-1,-1,-1,-1
|
166
|
+
};
|
167
|
+
#define OF_DEFAULTNORMLOG 5 /* for static allocation */
|
168
|
+
static UNUSED_ATTR const U32 OF_defaultNormLog = OF_DEFAULTNORMLOG;
|
169
|
+
|
170
|
+
|
171
|
+
/*-*******************************************
|
172
|
+
* Shared functions to include for inlining
|
173
|
+
*********************************************/
|
174
|
+
static void ZSTD_copy8(void* dst, const void* src) {
|
175
|
+
#if defined(ZSTD_ARCH_ARM_NEON)
|
176
|
+
vst1_u8((uint8_t*)dst, vld1_u8((const uint8_t*)src));
|
177
|
+
#else
|
178
|
+
ZSTD_memcpy(dst, src, 8);
|
179
|
+
#endif
|
180
|
+
}
|
181
|
+
#define COPY8(d,s) do { ZSTD_copy8(d,s); d+=8; s+=8; } while (0)
|
182
|
+
|
183
|
+
/* Need to use memmove here since the literal buffer can now be located within
|
184
|
+
the dst buffer. In circumstances where the op "catches up" to where the
|
185
|
+
literal buffer is, there can be partial overlaps in this call on the final
|
186
|
+
copy if the literal is being shifted by less than 16 bytes. */
|
187
|
+
static void ZSTD_copy16(void* dst, const void* src) {
|
188
|
+
#if defined(ZSTD_ARCH_ARM_NEON)
|
189
|
+
vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src));
|
190
|
+
#elif defined(ZSTD_ARCH_X86_SSE2)
|
191
|
+
_mm_storeu_si128((__m128i*)dst, _mm_loadu_si128((const __m128i*)src));
|
192
|
+
#elif defined(__clang__)
|
193
|
+
ZSTD_memmove(dst, src, 16);
|
194
|
+
#else
|
195
|
+
/* ZSTD_memmove is not inlined properly by gcc */
|
196
|
+
BYTE copy16_buf[16];
|
197
|
+
ZSTD_memcpy(copy16_buf, src, 16);
|
198
|
+
ZSTD_memcpy(dst, copy16_buf, 16);
|
199
|
+
#endif
|
200
|
+
}
|
201
|
+
#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
|
202
|
+
|
203
|
+
#define WILDCOPY_OVERLENGTH 32
|
204
|
+
#define WILDCOPY_VECLEN 16
|
205
|
+
|
206
|
+
typedef enum {
|
207
|
+
ZSTD_no_overlap,
|
208
|
+
ZSTD_overlap_src_before_dst
|
209
|
+
/* ZSTD_overlap_dst_before_src, */
|
210
|
+
} ZSTD_overlap_e;
|
211
|
+
|
212
|
+
/*! ZSTD_wildcopy() :
|
213
|
+
* Custom version of ZSTD_memcpy(), can over read/write up to WILDCOPY_OVERLENGTH bytes (if length==0)
|
214
|
+
* @param ovtype controls the overlap detection
|
215
|
+
* - ZSTD_no_overlap: The source and destination are guaranteed to be at least WILDCOPY_VECLEN bytes apart.
|
216
|
+
* - ZSTD_overlap_src_before_dst: The src and dst may overlap, but they MUST be at least 8 bytes apart.
|
217
|
+
* The src buffer must be before the dst buffer.
|
218
|
+
*/
|
219
|
+
MEM_STATIC FORCE_INLINE_ATTR
|
220
|
+
void ZSTD_wildcopy(void* dst, const void* src, ptrdiff_t length, ZSTD_overlap_e const ovtype)
|
221
|
+
{
|
222
|
+
ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
|
223
|
+
const BYTE* ip = (const BYTE*)src;
|
224
|
+
BYTE* op = (BYTE*)dst;
|
225
|
+
BYTE* const oend = op + length;
|
226
|
+
|
227
|
+
if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
|
228
|
+
/* Handle short offset copies. */
|
229
|
+
do {
|
230
|
+
COPY8(op, ip);
|
231
|
+
} while (op < oend);
|
232
|
+
} else {
|
233
|
+
assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
|
234
|
+
/* Separate out the first COPY16() call because the copy length is
|
235
|
+
* almost certain to be short, so the branches have different
|
236
|
+
* probabilities. Since it is almost certain to be short, only do
|
237
|
+
* one COPY16() in the first call. Then, do two calls per loop since
|
238
|
+
* at that point it is more likely to have a high trip count.
|
239
|
+
*/
|
240
|
+
ZSTD_copy16(op, ip);
|
241
|
+
if (16 >= length) return;
|
242
|
+
op += 16;
|
243
|
+
ip += 16;
|
244
|
+
do {
|
245
|
+
COPY16(op, ip);
|
246
|
+
COPY16(op, ip);
|
247
|
+
}
|
248
|
+
while (op < oend);
|
249
|
+
}
|
250
|
+
}
|
251
|
+
|
252
|
+
MEM_STATIC size_t ZSTD_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize)
|
253
|
+
{
|
254
|
+
size_t const length = MIN(dstCapacity, srcSize);
|
255
|
+
if (length > 0) {
|
256
|
+
ZSTD_memcpy(dst, src, length);
|
257
|
+
}
|
258
|
+
return length;
|
259
|
+
}
|
260
|
+
|
261
|
+
/* define "workspace is too large" as this number of times larger than needed */
|
262
|
+
#define ZSTD_WORKSPACETOOLARGE_FACTOR 3
|
263
|
+
|
264
|
+
/* when workspace is continuously too large
|
265
|
+
* during at least this number of times,
|
266
|
+
* context's memory usage is considered wasteful,
|
267
|
+
* because it's sized to handle a worst case scenario which rarely happens.
|
268
|
+
* In which case, resize it down to free some memory */
|
269
|
+
#define ZSTD_WORKSPACETOOLARGE_MAXDURATION 128
|
270
|
+
|
271
|
+
/* Controls whether the input/output buffer is buffered or stable. */
|
272
|
+
typedef enum {
|
273
|
+
ZSTD_bm_buffered = 0, /* Buffer the input/output */
|
274
|
+
ZSTD_bm_stable = 1 /* ZSTD_inBuffer/ZSTD_outBuffer is stable */
|
275
|
+
} ZSTD_bufferMode_e;
|
276
|
+
|
277
|
+
|
278
|
+
/*-*******************************************
|
279
|
+
* Private declarations
|
280
|
+
*********************************************/
|
281
|
+
typedef struct seqDef_s {
|
282
|
+
U32 offBase; /* offBase == Offset + ZSTD_REP_NUM, or repcode 1,2,3 */
|
283
|
+
U16 litLength;
|
284
|
+
U16 mlBase; /* mlBase == matchLength - MINMATCH */
|
285
|
+
} seqDef;
|
286
|
+
|
287
|
+
/* Controls whether seqStore has a single "long" litLength or matchLength. See seqStore_t. */
|
288
|
+
typedef enum {
|
289
|
+
ZSTD_llt_none = 0, /* no longLengthType */
|
290
|
+
ZSTD_llt_literalLength = 1, /* represents a long literal */
|
291
|
+
ZSTD_llt_matchLength = 2 /* represents a long match */
|
292
|
+
} ZSTD_longLengthType_e;
|
293
|
+
|
294
|
+
typedef struct {
|
295
|
+
seqDef* sequencesStart;
|
296
|
+
seqDef* sequences; /* ptr to end of sequences */
|
297
|
+
BYTE* litStart;
|
298
|
+
BYTE* lit; /* ptr to end of literals */
|
299
|
+
BYTE* llCode;
|
300
|
+
BYTE* mlCode;
|
301
|
+
BYTE* ofCode;
|
302
|
+
size_t maxNbSeq;
|
303
|
+
size_t maxNbLit;
|
304
|
+
|
305
|
+
/* longLengthPos and longLengthType to allow us to represent either a single litLength or matchLength
|
306
|
+
* in the seqStore that has a value larger than U16 (if it exists). To do so, we increment
|
307
|
+
* the existing value of the litLength or matchLength by 0x10000.
|
308
|
+
*/
|
309
|
+
ZSTD_longLengthType_e longLengthType;
|
310
|
+
U32 longLengthPos; /* Index of the sequence to apply long length modification to */
|
311
|
+
} seqStore_t;
|
312
|
+
|
313
|
+
typedef struct {
|
314
|
+
U32 litLength;
|
315
|
+
U32 matchLength;
|
316
|
+
} ZSTD_sequenceLength;
|
317
|
+
|
318
|
+
/**
|
319
|
+
* Returns the ZSTD_sequenceLength for the given sequences. It handles the decoding of long sequences
|
320
|
+
* indicated by longLengthPos and longLengthType, and adds MINMATCH back to matchLength.
|
321
|
+
*/
|
322
|
+
MEM_STATIC ZSTD_sequenceLength ZSTD_getSequenceLength(seqStore_t const* seqStore, seqDef const* seq)
|
323
|
+
{
|
324
|
+
ZSTD_sequenceLength seqLen;
|
325
|
+
seqLen.litLength = seq->litLength;
|
326
|
+
seqLen.matchLength = seq->mlBase + MINMATCH;
|
327
|
+
if (seqStore->longLengthPos == (U32)(seq - seqStore->sequencesStart)) {
|
328
|
+
if (seqStore->longLengthType == ZSTD_llt_literalLength) {
|
329
|
+
seqLen.litLength += 0x10000;
|
330
|
+
}
|
331
|
+
if (seqStore->longLengthType == ZSTD_llt_matchLength) {
|
332
|
+
seqLen.matchLength += 0x10000;
|
333
|
+
}
|
334
|
+
}
|
335
|
+
return seqLen;
|
336
|
+
}
|
337
|
+
|
338
|
+
/**
|
339
|
+
* Contains the compressed frame size and an upper-bound for the decompressed frame size.
|
340
|
+
* Note: before using `compressedSize`, check for errors using ZSTD_isError().
|
341
|
+
* similarly, before using `decompressedBound`, check for errors using:
|
342
|
+
* `decompressedBound != ZSTD_CONTENTSIZE_ERROR`
|
343
|
+
*/
|
344
|
+
typedef struct {
|
345
|
+
size_t nbBlocks;
|
346
|
+
size_t compressedSize;
|
347
|
+
unsigned long long decompressedBound;
|
348
|
+
} ZSTD_frameSizeInfo; /* decompress & legacy */
|
349
|
+
|
350
|
+
const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx); /* compress & dictBuilder */
|
351
|
+
int ZSTD_seqToCodes(const seqStore_t* seqStorePtr); /* compress, dictBuilder, decodeCorpus (shouldn't get its definition from here) */
|
352
|
+
|
353
|
+
|
354
|
+
/* ZSTD_invalidateRepCodes() :
|
355
|
+
* ensures next compression will not use repcodes from previous block.
|
356
|
+
* Note : only works with regular variant;
|
357
|
+
* do not use with extDict variant ! */
|
358
|
+
void ZSTD_invalidateRepCodes(ZSTD_CCtx* cctx); /* zstdmt, adaptive_compression (shouldn't get this definition from here) */
|
359
|
+
|
360
|
+
|
361
|
+
typedef struct {
|
362
|
+
blockType_e blockType;
|
363
|
+
U32 lastBlock;
|
364
|
+
U32 origSize;
|
365
|
+
} blockProperties_t; /* declared here for decompress and fullbench */
|
366
|
+
|
367
|
+
/*! ZSTD_getcBlockSize() :
|
368
|
+
* Provides the size of compressed block from block header `src` */
|
369
|
+
/* Used by: decompress, fullbench */
|
370
|
+
size_t ZSTD_getcBlockSize(const void* src, size_t srcSize,
|
371
|
+
blockProperties_t* bpPtr);
|
372
|
+
|
373
|
+
/*! ZSTD_decodeSeqHeaders() :
|
374
|
+
* decode sequence header from src */
|
375
|
+
/* Used by: zstd_decompress_block, fullbench */
|
376
|
+
size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr,
|
377
|
+
const void* src, size_t srcSize);
|
378
|
+
|
379
|
+
/**
|
380
|
+
* @returns true iff the CPU supports dynamic BMI2 dispatch.
|
381
|
+
*/
|
382
|
+
MEM_STATIC int ZSTD_cpuSupportsBmi2(void)
|
383
|
+
{
|
384
|
+
ZSTD_cpuid_t cpuid = ZSTD_cpuid();
|
385
|
+
return ZSTD_cpuid_bmi1(cpuid) && ZSTD_cpuid_bmi2(cpuid);
|
386
|
+
}
|
387
|
+
|
388
|
+
#if defined (__cplusplus)
|
389
|
+
}
|
390
|
+
#endif
|
391
|
+
|
392
|
+
#endif /* ZSTD_CCOMMON_H_MODULE */
|
@@ -0,0 +1,163 @@
|
|
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_TRACE_H
|
12
|
+
#define ZSTD_TRACE_H
|
13
|
+
|
14
|
+
#if defined (__cplusplus)
|
15
|
+
extern "C" {
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#include <stddef.h>
|
19
|
+
|
20
|
+
/* weak symbol support
|
21
|
+
* For now, enable conservatively:
|
22
|
+
* - Only GNUC
|
23
|
+
* - Only ELF
|
24
|
+
* - Only x86-64, i386 and aarch64
|
25
|
+
* Also, explicitly disable on platforms known not to work so they aren't
|
26
|
+
* forgotten in the future.
|
27
|
+
*/
|
28
|
+
#if !defined(ZSTD_HAVE_WEAK_SYMBOLS) && \
|
29
|
+
defined(__GNUC__) && defined(__ELF__) && \
|
30
|
+
(defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) || defined(__aarch64__)) && \
|
31
|
+
!defined(__APPLE__) && !defined(_WIN32) && !defined(__MINGW32__) && \
|
32
|
+
!defined(__CYGWIN__) && !defined(_AIX)
|
33
|
+
# define ZSTD_HAVE_WEAK_SYMBOLS 1
|
34
|
+
#else
|
35
|
+
# define ZSTD_HAVE_WEAK_SYMBOLS 0
|
36
|
+
#endif
|
37
|
+
#if ZSTD_HAVE_WEAK_SYMBOLS
|
38
|
+
# define ZSTD_WEAK_ATTR __attribute__((__weak__))
|
39
|
+
#else
|
40
|
+
# define ZSTD_WEAK_ATTR
|
41
|
+
#endif
|
42
|
+
|
43
|
+
/* Only enable tracing when weak symbols are available. */
|
44
|
+
#ifndef ZSTD_TRACE
|
45
|
+
# define ZSTD_TRACE ZSTD_HAVE_WEAK_SYMBOLS
|
46
|
+
#endif
|
47
|
+
|
48
|
+
#if ZSTD_TRACE
|
49
|
+
|
50
|
+
struct ZSTD_CCtx_s;
|
51
|
+
struct ZSTD_DCtx_s;
|
52
|
+
struct ZSTD_CCtx_params_s;
|
53
|
+
|
54
|
+
typedef struct {
|
55
|
+
/**
|
56
|
+
* ZSTD_VERSION_NUMBER
|
57
|
+
*
|
58
|
+
* This is guaranteed to be the first member of ZSTD_trace.
|
59
|
+
* Otherwise, this struct is not stable between versions. If
|
60
|
+
* the version number does not match your expectation, you
|
61
|
+
* should not interpret the rest of the struct.
|
62
|
+
*/
|
63
|
+
unsigned version;
|
64
|
+
/**
|
65
|
+
* Non-zero if streaming (de)compression is used.
|
66
|
+
*/
|
67
|
+
unsigned streaming;
|
68
|
+
/**
|
69
|
+
* The dictionary ID.
|
70
|
+
*/
|
71
|
+
unsigned dictionaryID;
|
72
|
+
/**
|
73
|
+
* Is the dictionary cold?
|
74
|
+
* Only set on decompression.
|
75
|
+
*/
|
76
|
+
unsigned dictionaryIsCold;
|
77
|
+
/**
|
78
|
+
* The dictionary size or zero if no dictionary.
|
79
|
+
*/
|
80
|
+
size_t dictionarySize;
|
81
|
+
/**
|
82
|
+
* The uncompressed size of the data.
|
83
|
+
*/
|
84
|
+
size_t uncompressedSize;
|
85
|
+
/**
|
86
|
+
* The compressed size of the data.
|
87
|
+
*/
|
88
|
+
size_t compressedSize;
|
89
|
+
/**
|
90
|
+
* The fully resolved CCtx parameters (NULL on decompression).
|
91
|
+
*/
|
92
|
+
struct ZSTD_CCtx_params_s const* params;
|
93
|
+
/**
|
94
|
+
* The ZSTD_CCtx pointer (NULL on decompression).
|
95
|
+
*/
|
96
|
+
struct ZSTD_CCtx_s const* cctx;
|
97
|
+
/**
|
98
|
+
* The ZSTD_DCtx pointer (NULL on compression).
|
99
|
+
*/
|
100
|
+
struct ZSTD_DCtx_s const* dctx;
|
101
|
+
} ZSTD_Trace;
|
102
|
+
|
103
|
+
/**
|
104
|
+
* A tracing context. It must be 0 when tracing is disabled.
|
105
|
+
* Otherwise, any non-zero value returned by a tracing begin()
|
106
|
+
* function is presented to any subsequent calls to end().
|
107
|
+
*
|
108
|
+
* Any non-zero value is treated as tracing is enabled and not
|
109
|
+
* interpreted by the library.
|
110
|
+
*
|
111
|
+
* Two possible uses are:
|
112
|
+
* * A timestamp for when the begin() function was called.
|
113
|
+
* * A unique key identifying the (de)compression, like the
|
114
|
+
* address of the [dc]ctx pointer if you need to track
|
115
|
+
* more information than just a timestamp.
|
116
|
+
*/
|
117
|
+
typedef unsigned long long ZSTD_TraceCtx;
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Trace the beginning of a compression call.
|
121
|
+
* @param cctx The dctx pointer for the compression.
|
122
|
+
* It can be used as a key to map begin() to end().
|
123
|
+
* @returns Non-zero if tracing is enabled. The return value is
|
124
|
+
* passed to ZSTD_trace_compress_end().
|
125
|
+
*/
|
126
|
+
ZSTD_WEAK_ATTR ZSTD_TraceCtx ZSTD_trace_compress_begin(
|
127
|
+
struct ZSTD_CCtx_s const* cctx);
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Trace the end of a compression call.
|
131
|
+
* @param ctx The return value of ZSTD_trace_compress_begin().
|
132
|
+
* @param trace The zstd tracing info.
|
133
|
+
*/
|
134
|
+
ZSTD_WEAK_ATTR void ZSTD_trace_compress_end(
|
135
|
+
ZSTD_TraceCtx ctx,
|
136
|
+
ZSTD_Trace const* trace);
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Trace the beginning of a decompression call.
|
140
|
+
* @param dctx The dctx pointer for the decompression.
|
141
|
+
* It can be used as a key to map begin() to end().
|
142
|
+
* @returns Non-zero if tracing is enabled. The return value is
|
143
|
+
* passed to ZSTD_trace_compress_end().
|
144
|
+
*/
|
145
|
+
ZSTD_WEAK_ATTR ZSTD_TraceCtx ZSTD_trace_decompress_begin(
|
146
|
+
struct ZSTD_DCtx_s const* dctx);
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Trace the end of a decompression call.
|
150
|
+
* @param ctx The return value of ZSTD_trace_decompress_begin().
|
151
|
+
* @param trace The zstd tracing info.
|
152
|
+
*/
|
153
|
+
ZSTD_WEAK_ATTR void ZSTD_trace_decompress_end(
|
154
|
+
ZSTD_TraceCtx ctx,
|
155
|
+
ZSTD_Trace const* trace);
|
156
|
+
|
157
|
+
#endif /* ZSTD_TRACE */
|
158
|
+
|
159
|
+
#if defined (__cplusplus)
|
160
|
+
}
|
161
|
+
#endif
|
162
|
+
|
163
|
+
#endif /* ZSTD_TRACE_H */
|