feat(compress): move block policy predicates to Rust
Move target block-size and block-splitter policy predicates behind narrow Rust ABI shims while retaining the C debug logging, finalized-mode assertion, and surrounding control flow. Test Plan: - cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression - cargo clippy --manifest-path rust/Cargo.toml and native library build - make -B -C tests -j2 test-zstream (84 deterministic tests; fuzzers 6778 and 8299 cases)
This commit is contained in:
@@ -107,6 +107,8 @@ ZSTD_CCtx_params* ZSTD_rust_createCCtxParams(ZSTD_customMem customMem);
|
||||
size_t ZSTD_rust_freeCCtxParams(ZSTD_CCtx_params* params);
|
||||
size_t ZSTD_rust_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams,
|
||||
ZSTD_parameters params);
|
||||
int ZSTD_rust_useTargetCBlockSize(const ZSTD_CCtx_params* cctxParams);
|
||||
int ZSTD_rust_blockSplitterEnabled(ZSTD_CCtx_params* cctxParams);
|
||||
|
||||
#define ZSTD_RUST_CCTX_PARAMS_ASSERT(name, condition) \
|
||||
typedef char name[(condition) ? 1 : -1]
|
||||
@@ -2132,7 +2134,7 @@ static void ZSTD_reduceIndex (ZSTD_MatchState_t* ms, ZSTD_CCtx_params const* par
|
||||
static int ZSTD_useTargetCBlockSize(const ZSTD_CCtx_params* cctxParams)
|
||||
{
|
||||
DEBUGLOG(5, "ZSTD_useTargetCBlockSize (targetCBlockSize=%zu)", cctxParams->targetCBlockSize);
|
||||
return (cctxParams->targetCBlockSize != 0);
|
||||
return ZSTD_rust_useTargetCBlockSize(cctxParams);
|
||||
}
|
||||
|
||||
/* ZSTD_blockSplitterEnabled():
|
||||
@@ -2143,8 +2145,7 @@ static int ZSTD_useTargetCBlockSize(const ZSTD_CCtx_params* cctxParams)
|
||||
static int ZSTD_blockSplitterEnabled(ZSTD_CCtx_params* cctxParams)
|
||||
{
|
||||
DEBUGLOG(5, "ZSTD_blockSplitterEnabled (postBlockSplitter=%d)", cctxParams->postBlockSplitter);
|
||||
assert(cctxParams->postBlockSplitter != ZSTD_ps_auto);
|
||||
return (cctxParams->postBlockSplitter == ZSTD_ps_enable);
|
||||
return ZSTD_rust_blockSplitterEnabled(cctxParams);
|
||||
}
|
||||
|
||||
/* ZSTD_buildSequencesStatistics() and the ZSTD_entropyCompressSeqStore*()
|
||||
|
||||
Reference in New Issue
Block a user