/* * Copyright (c) Meta Platforms, Inc. and affiliates. * 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. */ /*-************************************* * Dependencies ***************************************/ #include "zstd_compress_literals.h" /* ************************************************************** * Debug Traces ****************************************************************/ #if DEBUGLEVEL >= 2 static size_t showHexa(const void* src, size_t srcSize) { const BYTE* const ip = (const BYTE*)src; size_t u; for (u=0; u<srcSize; u++) { RAWLOG(5, " %02X", ip[u]); (void)ip; } RAWLOG(5, " \n"); return srcSize; } #endif /* ************************************************************** * Literals compression - special cases ****************************************************************/ size_t ZSTD_noCompressLiterals (void* dst, size_t dstCapacity, const void* src, size_t srcSize) { … } static int allBytesIdentical(const void* src, size_t srcSize) { … } size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize) { … } /* ZSTD_minLiteralsToCompress() : * returns minimal amount of literals * for literal compression to even be attempted. * Minimum is made tighter as compression strategy increases. */ static size_t ZSTD_minLiteralsToCompress(ZSTD_strategy strategy, HUF_repeat huf_repeat) { … } size_t ZSTD_compressLiterals ( void* dst, size_t dstCapacity, const void* src, size_t srcSize, void* entropyWorkspace, size_t entropyWorkspaceSize, const ZSTD_hufCTables_t* prevHuf, ZSTD_hufCTables_t* nextHuf, ZSTD_strategy strategy, int disableLiteralCompression, int suspectUncompressible, int bmi2) { … }