pub fn arr_to_i64(arr: &[u8]) -> Result<i64, ToolError>
Expand description

Reads an i64 value from any length array slice.

Rather than forcing the input to be a [u8; 8] like standard library methods, this can interpret an i64 from a slice of any length < 8. Bytes are assumed to be least significant when reading the value - i.e. an array of [4, 0] would return a value of 1024.

§Errors

This method will return an error if the input slice has a length > 8.

§Example

let result = arr_to_i64(&[4,0])?;
assert_eq!(result, 1024);