Use from_be_bytes in one more place.
This commit is contained in:
parent
46510fef82
commit
d04939182d
|
@ -41,7 +41,7 @@ pub fn read8<R>(reader: &mut R) -> Result<u8, io::Error> where R: io::Read {
|
|||
pub fn read16<R>(reader: &mut R) -> Result<u16, io::Error> where R: io::Read {
|
||||
let mut buf = [0u8; 2];
|
||||
reader.read_exact(&mut buf)?;
|
||||
Ok(((buf[0] as u16) << 8) + buf[1] as u16)
|
||||
Ok(u16::from_be_bytes(buf))
|
||||
}
|
||||
|
||||
// This function must not be called with more than 4 bytes.
|
||||
|
|
Loading…
Reference in New Issue