2020-04-03 10:07:46 -07:00
|
|
|
/**
|
|
|
|
* \file zstd.c
|
|
|
|
* Single-file Zstandard library.
|
2020-04-07 09:17:59 -07:00
|
|
|
*
|
2020-04-03 10:07:46 -07:00
|
|
|
* Generate using:
|
|
|
|
* \code
|
2022-01-20 05:50:31 -08:00
|
|
|
* python combine.py -r ../../lib -x legacy/zstd_legacy.h -o zstd.c zstd-in.c
|
2020-04-03 10:07:46 -07:00
|
|
|
* \endcode
|
|
|
|
*/
|
|
|
|
/*
|
2022-01-20 05:50:31 -08:00
|
|
|
* Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
|
2020-04-03 10:07:46 -07:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under both the BSD-style license (found in the
|
|
|
|
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
|
|
* in the COPYING file in the root directory of this source tree).
|
|
|
|
* You may select, at your option, one of the above-listed licenses.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Settings to bake for the single library file.
|
2020-04-07 09:17:59 -07:00
|
|
|
*
|
2020-04-03 10:07:46 -07:00
|
|
|
* Note: It's important that none of these affects 'zstd.h' (only the
|
|
|
|
* implementation files we're amalgamating).
|
2020-04-07 09:17:59 -07:00
|
|
|
*
|
2020-04-03 10:07:46 -07:00
|
|
|
* Note: MEM_MODULE stops xxhash redefining BYTE, U16, etc., which are also
|
|
|
|
* defined in mem.h (breaking C99 compatibility).
|
2020-04-07 09:17:59 -07:00
|
|
|
*
|
2022-03-11 23:52:40 -08:00
|
|
|
* Note: the undefs for xxHash allow Zstd's implementation to coincide with
|
2020-04-07 09:17:59 -07:00
|
|
|
* standalone xxHash usage (with global defines).
|
|
|
|
*
|
2022-01-20 05:50:31 -08:00
|
|
|
* Note: if you enable ZSTD_LEGACY_SUPPORT the combine.py script will need
|
|
|
|
* re-running without the "-x legacy/zstd_legacy.h" option (it excludes the
|
|
|
|
* legacy support at the source level).
|
|
|
|
*
|
2020-04-03 10:07:46 -07:00
|
|
|
* Note: multithreading is enabled for all platforms apart from Emscripten.
|
|
|
|
*/
|
|
|
|
#define DEBUGLEVEL 0
|
|
|
|
#define MEM_MODULE
|
2020-04-07 09:17:59 -07:00
|
|
|
#undef XXH_NAMESPACE
|
2020-04-03 10:07:46 -07:00
|
|
|
#define XXH_NAMESPACE ZSTD_
|
2020-04-07 09:17:59 -07:00
|
|
|
#undef XXH_PRIVATE_API
|
2020-04-03 10:07:46 -07:00
|
|
|
#define XXH_PRIVATE_API
|
2020-04-07 09:17:59 -07:00
|
|
|
#undef XXH_INLINE_ALL
|
2020-04-03 10:07:46 -07:00
|
|
|
#define XXH_INLINE_ALL
|
|
|
|
#define ZSTD_LEGACY_SUPPORT 0
|
|
|
|
#ifndef __EMSCRIPTEN__
|
|
|
|
#define ZSTD_MULTITHREAD
|
|
|
|
#endif
|
2021-02-03 19:53:00 -08:00
|
|
|
#define ZSTD_TRACE 0
|
2021-09-17 11:43:04 -07:00
|
|
|
/* TODO: Can't amalgamate ASM function */
|
2021-12-01 12:52:23 -08:00
|
|
|
#define ZSTD_DISABLE_ASM 1
|
2020-04-03 10:07:46 -07:00
|
|
|
|
2020-08-06 20:18:05 -07:00
|
|
|
/* Include zstd_deps.h first with all the options we need enabled. */
|
|
|
|
#define ZSTD_DEPS_NEED_MALLOC
|
2020-08-27 15:01:18 -07:00
|
|
|
#define ZSTD_DEPS_NEED_MATH64
|
2020-08-06 20:18:05 -07:00
|
|
|
#include "common/zstd_deps.h"
|
|
|
|
|
2020-05-01 14:56:51 -07:00
|
|
|
#include "common/debug.c"
|
|
|
|
#include "common/entropy_common.c"
|
|
|
|
#include "common/error_private.c"
|
|
|
|
#include "common/fse_decompress.c"
|
|
|
|
#include "common/threading.c"
|
|
|
|
#include "common/pool.c"
|
|
|
|
#include "common/zstd_common.c"
|
2020-04-03 10:07:46 -07:00
|
|
|
|
2020-05-01 14:56:51 -07:00
|
|
|
#include "compress/fse_compress.c"
|
|
|
|
#include "compress/hist.c"
|
|
|
|
#include "compress/huf_compress.c"
|
|
|
|
#include "compress/zstd_compress_literals.c"
|
|
|
|
#include "compress/zstd_compress_sequences.c"
|
|
|
|
#include "compress/zstd_compress_superblock.c"
|
|
|
|
#include "compress/zstd_compress.c"
|
|
|
|
#include "compress/zstd_double_fast.c"
|
|
|
|
#include "compress/zstd_fast.c"
|
|
|
|
#include "compress/zstd_lazy.c"
|
|
|
|
#include "compress/zstd_ldm.c"
|
|
|
|
#include "compress/zstd_opt.c"
|
2020-04-03 10:07:46 -07:00
|
|
|
#ifdef ZSTD_MULTITHREAD
|
2020-05-01 14:56:51 -07:00
|
|
|
#include "compress/zstdmt_compress.c"
|
2020-04-03 10:07:46 -07:00
|
|
|
#endif
|
|
|
|
|
2020-05-01 14:56:51 -07:00
|
|
|
#include "decompress/huf_decompress.c"
|
|
|
|
#include "decompress/zstd_ddict.c"
|
|
|
|
#include "decompress/zstd_decompress.c"
|
|
|
|
#include "decompress/zstd_decompress_block.c"
|
2020-06-22 01:31:36 -07:00
|
|
|
|
|
|
|
#include "dictBuilder/cover.c"
|
|
|
|
#include "dictBuilder/divsufsort.c"
|
|
|
|
#include "dictBuilder/fastcover.c"
|
|
|
|
#include "dictBuilder/zdict.c"
|