Function bitconv::to_int32 [−][src]
pub fn to_int32<T: BitConvEndian>(data: &[u8], start_index: usize) -> i32
Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array.
The to_int32
function converts the bytes from index start_index to
start_index + 3 to a i32
value.
Example
use bitconv::{ endian::{Big, Little}, to_int32 }; let buffer = [15, 0, 0, 128, 16, 39, 240, 216, 241, 255, 127]; assert_eq!(-265875328, to_int32::<Little>(&buffer, 3)); assert_eq!(-2146424848, to_int32::<Big>(&buffer, 3));