revm_bytecode/
utils.rs

1/// Reads big-endian i16 from u8 pointer.
2///
3/// # Safety
4///
5/// Pointer needs to point to at least 2 byte.
6pub unsafe fn read_i16(ptr: *const u8) -> i16 {
7    i16::from_be_bytes(core::slice::from_raw_parts(ptr, 2).try_into().unwrap())
8}
9
10/// Reads big-endian u16 from u8 pointer.
11///
12/// # Safety
13///
14/// Pointer needs to point to at least 2 byte.
15pub unsafe fn read_u16(ptr: *const u8) -> u16 {
16    u16::from_be_bytes(core::slice::from_raw_parts(ptr, 2).try_into().unwrap())
17}