From 4970d4cfaec311bc399fd19c2e13469a44a20d97 Mon Sep 17 00:00:00 2001 From: John <110930793+mpratsaki@users.noreply.github.com> Date: Wed, 11 Nov 2026 14:11:07 +0200 Subject: [PATCH] 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 --- crates/media/tests/roundtrip.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/media/tests/roundtrip.rs b/crates/media/tests/roundtrip.rs index 1f21680b..b37bd955 100644 --- a/crates/media/tests/roundtrip.rs +++ b/crates/media/tests/roundtrip.rs @@ -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::(), bytes); assert_eq!(s.iter().map(|s| u64::from(s.duration)).sum::(), bytes / 4); assert!(s.iter().all(|s| s.size <= 1 << 20));