switch to native endianness

This commit is contained in:
Breval Ferrari 2025-01-17 19:21:19 -05:00
parent 1728b9b2c4
commit 0ac42b0793
No known key found for this signature in database
GPG key ID: CEAB625B75A836B2

View file

@ -16,7 +16,7 @@ where
{ {
fn into_bytes(self) -> crate::Bytes { fn into_bytes(self) -> crate::Bytes {
self.iter() self.iter()
.flat_map(|subpixel| subpixel.to_be_bytes().as_ref().to_vec()) .flat_map(|subpixel| subpixel.to_ne_bytes().as_ref().to_vec())
.collect() .collect()
} }
} }
@ -42,9 +42,9 @@ where
format.width, format.width,
format.height, format.height,
bytes bytes
.chunks_exact(P::Subpixel::zero().to_be_bytes().as_ref().len()) .chunks_exact(P::Subpixel::zero().to_ne_bytes().as_ref().len())
.map(|p| { .map(|p| {
P::Subpixel::from_be_bytes( P::Subpixel::from_ne_bytes(
&match <P::Subpixel as FromBytes>::Bytes::try_from(p) { &match <P::Subpixel as FromBytes>::Bytes::try_from(p) {
Ok(v) => v, Ok(v) => v,
Err(_) => unreachable!("you messed up chunk size!"), Err(_) => unreachable!("you messed up chunk size!"),