feat(compress): move sequence validation identity to Rust
ZSTD_resolveExternalSequenceValidation() is a pure int identity used while resolving CCtx parameters. Route its existing C wrapper through a Rust extern "C" entry point in the parameter module, preserving the int-to-int ABI and every call-site result. Add boundary coverage for signed int modes. Test Plan: - `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression` -- passed (253 tests) - `make -B -C lib -j2 lib` -- passed - required clippy passes for the compression feature, benches, and tests -- passed - `cargo +nightly fmt --manifest-path rust/Cargo.toml` and `git diff --check` -- passed
This commit is contained in:
@@ -415,6 +415,17 @@ pub extern "C" fn ZSTD_rust_params_resolveExternalRepcodeSearch(
|
||||
resolve_external_repcode_search(mode, compression_level)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn resolve_external_sequence_validation(mode: c_int) -> c_int {
|
||||
mode
|
||||
}
|
||||
|
||||
/// C ABI for `ZSTD_resolveExternalSequenceValidation()`.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn ZSTD_rust_params_resolveExternalSequenceValidation(mode: c_int) -> c_int {
|
||||
resolve_external_sequence_validation(mode)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn cdict_indices_are_tagged(cparams: ZSTD_compressionParameters) -> bool {
|
||||
cparams.strategy == ZSTD_FAST || cparams.strategy == ZSTD_DFAST
|
||||
@@ -1213,6 +1224,16 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn external_sequence_validation_preserves_its_int_mode() {
|
||||
for mode in [c_int::MIN, -1, 0, 1, c_int::MAX] {
|
||||
assert_eq!(
|
||||
ZSTD_rust_params_resolveExternalSequenceValidation(mode),
|
||||
mode
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn level_tables_match_representative_clevels_entries() {
|
||||
let large = select_cparams(3, ZSTD_CONTENTSIZE_UNKNOWN, 0, ZSTD_RUST_CPM_UNKNOWN);
|
||||
|
||||
Reference in New Issue
Block a user