feat(compress): move dedicated dict param reversion to Rust
Port ZSTD_dedicatedDictSearch_revertCParams to a Rust leaf that accepts and returns the complete repr(C) compression-parameter struct. Keep the existing C pointer wrapper and call order before ZSTD_adjustCParams_internal, while changing only hashLog for greedy, lazy, and lazy2 strategies. 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 (and --benches/--tests, rerun after fmt) - cargo +nightly fmt --manifest-path rust/Cargo.toml - make -B -C lib -j2 lib - make -B -C tests -j2 fuzzer - tests/fuzzer -s4560 -t47 -i48 -v - tests/fuzzer -s4560 -t57 -i1057 -v - make -B -C tests -j2 test-zstream - git diff --check
This commit is contained in:
@@ -132,7 +132,8 @@ int ZSTD_rust_params_resolveExternalRepcodeSearch(int mode, int cLevel);
|
||||
int ZSTD_rust_params_cdictIndicesAreTagged(ZSTD_compressionParameters cParams);
|
||||
int ZSTD_rust_params_dedicatedDictSearchIsSupported(ZSTD_compressionParameters cParams);
|
||||
U32 ZSTD_rust_params_dedicatedDictSearch_getHashLog(U32 hashLog);
|
||||
U32 ZSTD_rust_params_dedicatedDictSearch_revertHashLog(U32 hashLog);
|
||||
ZSTD_compressionParameters
|
||||
ZSTD_rust_params_dedicatedDictSearch_revertCParams(ZSTD_compressionParameters cParams);
|
||||
int ZSTD_rust_params_shouldAttachDict(int strategy, int dedicatedDictSearch,
|
||||
U64 pledgedSrcSize, int attachDictPref,
|
||||
int forceWindow);
|
||||
@@ -5678,21 +5679,7 @@ static ZSTD_compressionParameters ZSTD_dedicatedDictSearch_getCParams(int const
|
||||
*/
|
||||
static void ZSTD_dedicatedDictSearch_revertCParams(
|
||||
ZSTD_compressionParameters* cParams) {
|
||||
switch (cParams->strategy) {
|
||||
case ZSTD_fast:
|
||||
case ZSTD_dfast:
|
||||
break;
|
||||
case ZSTD_greedy:
|
||||
case ZSTD_lazy:
|
||||
case ZSTD_lazy2:
|
||||
cParams->hashLog = ZSTD_rust_params_dedicatedDictSearch_revertHashLog(cParams->hashLog);
|
||||
break;
|
||||
case ZSTD_btlazy2:
|
||||
case ZSTD_btopt:
|
||||
case ZSTD_btultra:
|
||||
case ZSTD_btultra2:
|
||||
break;
|
||||
}
|
||||
*cParams = ZSTD_rust_params_dedicatedDictSearch_revertCParams(*cParams);
|
||||
}
|
||||
|
||||
/*! ZSTD_getCParams_internal() :
|
||||
|
||||
Reference in New Issue
Block a user