pub fn checked_from_u256_le_bytes_to_u64(
le_u256: &[u8; 32],
) -> Result<u64, ProgramError>Expand description
Converts a little-endian 256-bit unsigned integer to a 64-bit unsigned integer.
This function takes a 32-byte array representing a little-endian 256-bit unsigned integer and converts it to a 64-bit unsigned integer, ensuring that the upper bytes are all zero.
§Arguments
le_u256- A reference to a 32-byte array representing a little-endian 256-bit unsigned integer.
§Errors
Returns ProgramError::InvalidArgument if the upper bytes are not all
zero and the caller should take care of adding more contextual information
into the program.
§Examples
use program_utils::checked_from_u256_le_bytes_to_u64;
let le_u256: [u8; 32] = [0; 32];
let result = checked_from_u256_le_bytes_to_u64(&le_u256).unwrap();
assert_eq!(result, 0);