Skip to content

Commit 8d2d642

Browse files
committed
Don't attempt to run AVX2 test on machines without AVX2
1 parent 120c5be commit 8d2d642

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/avx2/ycbcr.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ mod tests {
191191
#[test]
192192
#[cfg(feature = "simd")]
193193
fn avx_matches_scalar_rgb() {
194+
// Do not run AVX2 test on machines without it
195+
if !std::is_x86_feature_detected!("avx2") {
196+
return;
197+
}
194198
let mut rng = SimpleRng::new(42);
195199
let width = 512 + 3; // power of two plus a bit to stress remainder handling
196200
let height = 1;
@@ -213,6 +217,7 @@ mod tests {
213217
width.try_into().unwrap(),
214218
height.try_into().unwrap(),
215219
);
220+
// SAFETY: we've checked above that AVX2 is present
216221
unsafe {
217222
let avx_result = avx_input.fill_buffers_avx2(0, &mut buffers);
218223
}

0 commit comments

Comments
 (0)