Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

LR-IMP-FORMATS: word16_order reads sample pairs with as_chunks instead of indexing

Brandon Thomase7da679cb312
diff --git a/crates/raw/src/vendor/arw.rs b/crates/raw/src/vendor/arw.rs
index cb66f7754..cc5854234 100644
--- a/crates/raw/src/vendor/arw.rs
+++ b/crates/raw/src/vendor/arw.rs
@@ -429,8 +429,7 @@ fn word16_order(strip: &[u8], bits: u32, file: lightcraft_tiff::ByteOrder) -> li
let (mut n, mut over_file, mut over_other) = (0usize, 0usize, 0usize);
let words = strip.len() / 2;
let step = (words / 65536).max(1);
- for i in (0..words).step_by(step) {
- let b = [strip[2 * i], strip[2 * i + 1]];
+ for &b in strip.as_chunks::<2>().0.iter().step_by(step) {
n += 1;
over_file += usize::from(u32::from(file.u16(b)) >= limit);
over_other += usize::from(u32::from(other.u16(b)) >= limit);