Use ByteOrder function in decode_uint
This commit is contained in:
parent
6383f12ad0
commit
7109e30dcb
1 changed files with 3 additions and 3 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
use byteorder::{BigEndian, ByteOrder};
|
||||||
|
|
||||||
pub const EBML_HEAD_ID: u64 = 0x0A45DFA3;
|
pub const EBML_HEAD_ID: u64 = 0x0A45DFA3;
|
||||||
pub const VOID_ID: u64 = 0x6C;
|
pub const VOID_ID: u64 = 0x6C;
|
||||||
|
|
||||||
|
@ -98,9 +100,7 @@ pub fn decode_uint(bytes: &[u8]) -> Result<u64, Error> {
|
||||||
return Err(Error::CorruptPayload);
|
return Err(Error::CorruptPayload);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut value: u64 = 0;
|
Ok(BigEndian::read_uint(bytes, bytes.len()))
|
||||||
for byte in bytes {
|
|
||||||
value = (value << 8) + (*byte as u64);
|
|
||||||
}
|
}
|
||||||
Ok(value)
|
Ok(value)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue