vec_i16

Function vec_i16 

Source
pub fn vec_i16(bits: &Bits) -> Vec<i16>
Expand description

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

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

ยงExample

let bits = Bits::new([0x10, 0xFE]);
let ishorts = bits_as::vec_i16(&bits);

assert_eq!(ishorts.len(), 1);
assert_eq!(ishorts, vec![0xFE10u16 as i16]);

let bits = Bits::from([0x10, 0x5E]);
let ishorts = bits_as::vec_i16(&bits);

assert_eq!(ishorts.len(), 1);
assert_eq!(ishorts, vec![0xDE10u16 as i16]);