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