From 0e49a8066c3b4d8bd068d65cb2089e36dc5a9dc1 Mon Sep 17 00:00:00 2001 From: bendn Date: Tue, 23 Jan 2024 08:55:11 +0700 Subject: [PATCH] shrug --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 74f4ef4..e6b060f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -438,7 +438,7 @@ impl Image { T: AsRef<[U]>, { // SAFETY: 0 sized images illegal - unsafe { assert_unchecked(self.len() > CHANNELS) }; + unsafe { assert_unchecked(self.len() >= CHANNELS) }; // SAFETY: no half pixels! unsafe { assert_unchecked(self.len() % CHANNELS == 0) }; self.buffer().as_ref().array_chunks::() @@ -529,7 +529,7 @@ impl + AsRef<[u8]>, const CHANNELS: usize> Image { /// Returns a iterator over every pixel, mutably pub fn chunked_mut(&mut self) -> impl Iterator { // SAFETY: 0 sized images are not allowed - unsafe { assert_unchecked(self.len() > CHANNELS) }; + unsafe { assert_unchecked(self.len() >= CHANNELS) }; // SAFETY: buffer cannot have half pixels unsafe { assert_unchecked(self.len() % CHANNELS == 0) }; self.buffer.as_mut().array_chunks_mut::()