Function bitlab::u64 [] [src]

pub fn u64(
    source: &Vec<u8>,
    byte_offset: usize,
    bit_offset: usize,
    length: usize
) -> Result<u64, String>

Extracts a range of bits from a Vec and returns a Result object containing a 64 bit unsigned integer.

On success, the Result contains the desired value

On error, the Result contains an error message. This may happen if the range is larger than the data source (start + length > sizeof(i64))

Parameters:

  • source a vector of u8, which is the source of data
  • byte_offset (usize) the number of bytes to skip in source
  • bit_offset (usize) the start position of the bits to be extracted. Zero is the most significant bit
  • length (usize) the number of bits to be extracted.