test(rust): make entropy tests portable to 32-bit

Use an explicitly 64-bit literal before narrowing it in the common-byte test,
and derive the FSE compression-bound expectation from `size_of::<usize>()`.
The tests now exercise the same public contracts on 32-bit and 64-bit targets
instead of embedding a 64-bit-only compile-time assumption.

Test Plan:
- cargo clippy; cargo clippy --benches; cargo clippy --tests
- cargo +nightly fmt, then repeat the Clippy checks
- cargo test --target i686-unknown-linux-gnu --lib
- cargo test --target i686-unknown-linux-gnu --lib --features \
  huf-force-decompress-x1
- cargo test --target i686-unknown-linux-gnu --lib --features \
  huf-force-decompress-x2

Refs: rust/README.md
This commit is contained in:
2026-07-10 20:44:02 +02:00
parent 5f9d607ddd
commit 58a50db413
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ mod tests {
if MEM_isLittleEndian() {
assert_eq!(ZSTD_NbCommonBytes(0x0000_0000_0001_0000), 2);
} else if MEM_64bits() {
assert_eq!(ZSTD_NbCommonBytes(0x0001_0000_0000_0000), 2);
assert_eq!(ZSTD_NbCommonBytes(0x0001_0000_0000_0000u64 as usize), 2);
} else {
assert_eq!(ZSTD_NbCommonBytes(0x0001_0000), 2);
}