vec_i32

Function vec_i32 

Source
pub fn vec_i32(bits: &Bits) -> Vec<i32>
Expand description

Converts a bit string to a vector of 32 bit signed integers.

If the length of the the bit string is not divisible by 32 it is sign-extended to the next length that is, then it is converted.

ยงExample

let bits = Bits::new([0x10, 0x32, 0x54, 0x76]);
let ints = bits_as::vec_i32(&bits);

assert_eq!(ints.len(), 1);
assert_eq!(ints, vec![0x76543210]);

let bits = Bits::from([0x10, 0x32, 0x54, 0x76]);
let ints = bits_as::vec_i32(&bits);

assert_eq!(ints.len(), 1);
assert_eq!(ints, vec![0xF6543210u32 as i32]);