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-2020, 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 coinside 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 46 /* Include zstd_deps.h first with all the options we need enabled. */ 47 #define ZSTD_DEPS_NEED_MALLOC 48 #define ZSTD_DEPS_NEED_MATH64 49 #include "common/zstd_deps.h" 50 51 #include "common/debug.c" 52 #include "common/entropy_common.c" 53 #include "common/error_private.c" 54 #include "common/fse_decompress.c" 55 #include "common/threading.c" 56 #include "common/pool.c" 57 #include "common/zstd_common.c" 58 59 #include "compress/fse_compress.c" 60 #include "compress/hist.c" 61 #include "compress/huf_compress.c" 62 #include "compress/zstd_compress_literals.c" 63 #include "compress/zstd_compress_sequences.c" 64 #include "compress/zstd_compress_superblock.c" 65 #include "compress/zstd_compress.c" 66 #include "compress/zstd_double_fast.c" 67 #include "compress/zstd_fast.c" 68 #include "compress/zstd_lazy.c" 69 #include "compress/zstd_ldm.c" 70 #include "compress/zstd_opt.c" 71 #ifdef ZSTD_MULTITHREAD 72 #include "compress/zstdmt_compress.c" 73 #endif 74 75 #include "decompress/huf_decompress.c" 76 #include "decompress/zstd_ddict.c" 77 #include "decompress/zstd_decompress.c" 78 #include "decompress/zstd_decompress_block.c" 79 80 #include "dictBuilder/cover.c" 81 #include "dictBuilder/divsufsort.c" 82 #include "dictBuilder/fastcover.c" 83 #include "dictBuilder/zdict.c" 84