mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-12 01:54:47 +00:00
craft-media: roundtrip test builds on 32-bit targets (#578)
`(writes * MIB) as u64` multiplies in `usize` before widening: 4,097 MiB
overflows a 32-bit `usize`, so `cargo test --target i686-pc-windows-msvc`
failed to compile ("this arithmetic operation will overflow"). Widen first.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -309,7 +309,7 @@ fn pcm_past_4_gib_reads_back_whole() {
|
||||
let out = w.finish().unwrap();
|
||||
let f = open(&out).unwrap();
|
||||
let s = &f.tracks[0].samples;
|
||||
let bytes = (writes * MIB) as u64;
|
||||
let bytes = writes as u64 * MIB as u64;
|
||||
assert_eq!(s.iter().map(|s| u64::from(s.size)).sum::<u64>(), bytes);
|
||||
assert_eq!(s.iter().map(|s| u64::from(s.duration)).sum::<u64>(), bytes / 4);
|
||||
assert!(s.iter().all(|s| s.size <= 1 << 20));
|
||||
|
||||
Reference in New Issue
Block a user