feat(compress): move deprecated block-size formula to Rust
Keep validation of the applied compression parameters in C and delegate the context-free minimum calculation through a narrow ABI leaf. Preserve the public getter and deprecated block-compression paths. Test Plan: - cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression - cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression --all-targets - cargo +nightly fmt --manifest-path rust/Cargo.toml - make -B -C lib -j2 lib - make -C tests -j2 fuzzer - tests/fuzzer -s4560 -t47 -i48 -v
This commit is contained in:
@@ -103,6 +103,7 @@ ZSTD_parameters ZSTD_rust_params_makeParams(ZSTD_compressionParameters cParams);
|
||||
size_t ZSTD_rust_params_maxNbSeq(size_t blockSize, U32 minMatch,
|
||||
int useSequenceProducer);
|
||||
size_t ZSTD_rust_params_resolveMaxBlockSize(size_t maxBlockSize);
|
||||
size_t ZSTD_rust_params_getBlockSize(size_t maxBlockSize, U32 windowLog);
|
||||
int ZSTD_rust_params_rowMatchFinderSupported(int strategy);
|
||||
int ZSTD_rust_params_rowMatchFinderUsed(int strategy, int mode);
|
||||
int ZSTD_rust_params_resolveRowMatchFinderMode(
|
||||
@@ -3350,7 +3351,7 @@ static size_t ZSTD_getBlockSize_deprecated(const ZSTD_CCtx* cctx)
|
||||
{
|
||||
ZSTD_compressionParameters const cParams = cctx->appliedParams.cParams;
|
||||
assert(!ZSTD_checkCParams(cParams));
|
||||
return MIN(cctx->appliedParams.maxBlockSize, (size_t)1 << cParams.windowLog);
|
||||
return ZSTD_rust_params_getBlockSize(cctx->appliedParams.maxBlockSize, cParams.windowLog);
|
||||
}
|
||||
|
||||
/* NOTE: Must just wrap ZSTD_getBlockSize_deprecated() */
|
||||
|
||||
Reference in New Issue
Block a user