xref: /freebsd/sys/contrib/openzfs/module/zstd/zstd-in.c (revision 8a62a2a5659d1839d8799b4274c04469d7f17c78)
1 // SPDX-License-Identifier: BSD-3-Clause
2 /**
3  * \file zstd.c
4  * Single-file Zstandard library.
5  *
6  * Generate using:
7  * \code
8  *	python combine.py -r ../../lib -x legacy/zstd_legacy.h -o zstd.c zstd-in.c
9  * \endcode
10  */
11 /*
12  * Copyright (c) Meta Platforms, Inc. and affiliates.
13  * All rights reserved.
14  *
15  * This source code is licensed under both the BSD-style license (found in the
16  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
17  * in the COPYING file in the root directory of this source tree).
18  * You may select, at your option, one of the above-listed licenses.
19  */
20 /*
21  * Settings to bake for the single library file.
22  *
23  * Note: It's important that none of these affects 'zstd.h' (only the
24  * implementation files we're amalgamating).
25  *
26  * Note: MEM_MODULE stops xxhash redefining BYTE, U16, etc., which are also
27  * defined in mem.h (breaking C99 compatibility).
28  *
29  * Note: the undefs for xxHash allow Zstd's implementation to coincide with
30  * standalone xxHash usage (with global defines).
31  *
32  * Note: if you enable ZSTD_LEGACY_SUPPORT the combine.py script will need
33  * re-running without the "-x legacy/zstd_legacy.h" option (it excludes the
34  * legacy support at the source level).
35  *
36  * Note: multithreading is enabled for all platforms apart from Emscripten.
37  */
38 #define DEBUGLEVEL 0
39 #define MEM_MODULE
40 #undef  XXH_NAMESPACE
41 #define XXH_NAMESPACE ZSTD_
42 #undef  XXH_PRIVATE_API
43 #define XXH_PRIVATE_API
44 #undef  XXH_INLINE_ALL
45 #define XXH_INLINE_ALL
46 #define ZSTD_LEGACY_SUPPORT 0
47 #ifndef __EMSCRIPTEN__
48 #define ZSTD_MULTITHREAD
49 #endif
50 #define ZSTD_TRACE 0
51 /* TODO: Can't amalgamate ASM function */
52 #define ZSTD_DISABLE_ASM 1
53 
54 /* Include zstd_deps.h first with all the options we need enabled. */
55 #define ZSTD_DEPS_NEED_MALLOC
56 #define ZSTD_DEPS_NEED_MATH64
57 #include "common/zstd_deps.h"
58 
59 #include "common/debug.c"
60 #include "common/entropy_common.c"
61 #include "common/error_private.c"
62 #include "common/fse_decompress.c"
63 #include "common/threading.c"
64 #include "common/pool.c"
65 #include "common/zstd_common.c"
66 
67 #include "compress/fse_compress.c"
68 #include "compress/hist.c"
69 #include "compress/huf_compress.c"
70 #include "compress/zstd_compress_literals.c"
71 #include "compress/zstd_compress_sequences.c"
72 #include "compress/zstd_compress_superblock.c"
73 #include "compress/zstd_preSplit.c"
74 #include "compress/zstd_compress.c"
75 #include "compress/zstd_double_fast.c"
76 #include "compress/zstd_fast.c"
77 #include "compress/zstd_lazy.c"
78 #include "compress/zstd_ldm.c"
79 #include "compress/zstd_opt.c"
80 #ifdef ZSTD_MULTITHREAD
81 #include "compress/zstdmt_compress.c"
82 #endif
83 
84 #include "decompress/huf_decompress.c"
85 #include "decompress/zstd_ddict.c"
86 #include "decompress/zstd_decompress.c"
87 #include "decompress/zstd_decompress_block.c"
88 
89 #include "dictBuilder/cover.c"
90 #include "dictBuilder/divsufsort.c"
91 #include "dictBuilder/fastcover.c"
92 #include "dictBuilder/zdict.c"
93