Greatly improved performance for 16 bit images

This commit is contained in:
zroug committed 2018-08-27 23:05:16 +02:00
1 parent 724e5e8c80
commit 345aff0629
2 files changed
+12 -6

No files matched your search

+8
View File
@@ -28,6 +28,14 @@ pub trait EndianReader: Read {
}
}
#[inline(always)]
fn read_u16_into(&mut self, buffer: &mut [u16]) -> Result<(), io::Error> {
match self.byte_order() {
ByteOrder::LittleEndian => <Self as ReadBytesExt>::read_u16_into::<LittleEndian>(self, buffer),
ByteOrder::BigEndian => <Self as ReadBytesExt>::read_u16_into::<BigEndian>(self, buffer)
}
}
/// Reads an u32
#[inline(always)]
fn read_u32(&mut self) -> Result<u32, io::Error> {