refactor(ldm): expose max sequence bound from Rust

The LDM sequence-space helper was already implemented in Rust, but C still
owned the public symbol and forwarded through a pointer-based Rust bridge.
Make the Rust parameter representation public and ABI-compatible for the
original by-value `ldmParams_t` call, then have Rust compare `enableLdm`
directly with `ZSTD_ps_enable` before applying the sequence bound. Remove only
the redundant C bridge declaration and wrapper; table sizing, state, and
sequence generation remain unchanged.

Test Plan:
- `git diff --check` -- passed.
- `git diff --cached --check` -- passed.
- `cc -std=c99 -Ilib -Ilib/common -Ilib/compress -Ilib/decompress -Ilib/dict -fsyntax-only lib/compress/zstd_ldm.c` -- passed.
- `cargo +nightly fmt --manifest-path rust/Cargo.toml --all -- --check` -- passed.
- Cargo build/test, make, and other heavy checks were intentionally not run per the requested lightweight-only scope.
This commit is contained in:
2026-07-20 13:16:26 +02:00
parent 66a163a78c
commit 7174d2ec71
2 changed files with 27 additions and 16 deletions
-8
View File
@@ -256,8 +256,6 @@ void ZSTD_rust_ldm_adjustParameters(
U32 hashLogMax, U32 bucketSizeLogMax, int btultra);
size_t ZSTD_rust_ldm_getTableSize(
const void* params, int enableLdm, size_t redzoneSize);
size_t ZSTD_rust_ldm_getMaxNbSeq(
const void* params, int enableLdm, size_t maxChunkSize);
void ZSTD_rust_ldm_fillHashTable(
void* hashTable, BYTE* bucketOffsets, const BYTE* base,
const BYTE* ip, const BYTE* iend, const void* params);
@@ -357,12 +355,6 @@ size_t ZSTD_ldm_getTableSize(ldmParams_t params)
&params, params.enableLdm == ZSTD_ps_enable, redzoneSize);
}
size_t ZSTD_ldm_getMaxNbSeq(ldmParams_t params, size_t maxChunkSize)
{
return ZSTD_rust_ldm_getMaxNbSeq(
&params, params.enableLdm == ZSTD_ps_enable, maxChunkSize);
}
void ZSTD_ldm_fillHashTable(
ldmState_t* ldmState, const BYTE* ip,
const BYTE* iend, ldmParams_t const* params)