Delete unused Huffman functions

Remove all Huffman functions that aren't used by zstd.
This commit is contained in:
Nick Terrell
2023-01-20 14:12:53 -08:00
committed by Nick Terrell
parent bb9b9bc7be
commit 0cc1b0cb22
15 changed files with 57 additions and 581 deletions
+5 -5
View File
@@ -460,7 +460,7 @@ static size_t writeHufHeader(U32* seed, HUF_CElt* hufTable, void* dst, size_t ds
}
/* Write table description header */
{ size_t const hSize = HUF_writeCTable (op, dstSize, hufTable, maxSymbolValue, huffLog);
{ size_t const hSize = HUF_writeCTable_wksp (op, dstSize, hufTable, maxSymbolValue, huffLog, WKSP, sizeof(WKSP));
if (hSize + 12 >= srcSize) return 0; /* not useful to try compression */
op += hSize;
}
@@ -562,12 +562,12 @@ static size_t writeLiteralsBlockCompressed(U32* seed, frame_t* frame, size_t con
do {
compressedSize =
sizeFormat == 0
? HUF_compress1X_usingCTable(
? HUF_compress1X_usingCTable_bmi2(
op, opend - op, LITERAL_BUFFER, litSize,
frame->stats.hufTable)
: HUF_compress4X_usingCTable(
frame->stats.hufTable, /* bmi2 */ 0)
: HUF_compress4X_usingCTable_bmi2(
op, opend - op, LITERAL_BUFFER, litSize,
frame->stats.hufTable);
frame->stats.hufTable, /* bmi2 */ 0);
CHECKERR(compressedSize);
/* this only occurs when it could not compress or similar */
} while (compressedSize <= 0);
-2
View File
@@ -13,8 +13,6 @@
* compares the result with the original, and calls abort() on corruption.
*/
#define HUF_STATIC_LINKING_ONLY
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
+1 -3
View File
@@ -13,8 +13,6 @@
* compares the result with the original, and calls abort() on corruption.
*/
#define HUF_STATIC_LINKING_ONLY
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
@@ -98,7 +96,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size)
if (symbols == 0) {
FUZZ_ZASSERT(HUF_readDTableX1_wksp_bmi2(dt, cBuf, tableSize, wksp, wkspSize, bmi2));
} else {
size_t const ret = HUF_readDTableX2_wksp(dt, cBuf, tableSize, wksp, wkspSize);
size_t const ret = HUF_readDTableX2_wksp_bmi2(dt, cBuf, tableSize, wksp, wkspSize, bmi2);
if (ERR_getErrorCode(ret) == ZSTD_error_tableLog_tooLarge) {
FUZZ_ZASSERT(HUF_readDTableX1_wksp_bmi2(dt, cBuf, tableSize, wksp, wkspSize, bmi2));
} else {