From: Kostya Shishkov Date: Sat, 17 Aug 2019 12:48:40 +0000 (+0200) Subject: core: fix read_XX_{be,le} funcs X-Git-Url: https://git.nihav.org/?p=nihav.git;a=commitdiff_plain;h=c9087a4c607b9408aef7bec25fec8b9fa41788d5 core: fix read_XX_{be,le} funcs --- diff --git a/nihav-core/src/io/byteio.rs b/nihav-core/src/io/byteio.rs index 545bff5..e7e63db 100644 --- a/nihav-core/src/io/byteio.rs +++ b/nihav-core/src/io/byteio.rs @@ -72,7 +72,7 @@ macro_rules! read_int_func { if src.len() < $size { return Err(ByteIOError::ReadError); } unsafe { let mut buf: $inttype = 0; - ptr::copy_nonoverlapping(src.as_ptr(), &mut buf as *mut $inttype as *mut u8, 1); + ptr::copy_nonoverlapping(src.as_ptr(), &mut buf as *mut $inttype as *mut u8, std::mem::size_of::<$inttype>()); Ok(buf.$which()) } }