/// Encode a 32-bit unsigned integer in little-endian.
pub fn encode_little_endian_u32(value: u32) -> [u8; 4] {
    [
        (value >>  0) as u8,
        (value >>  8) as u8,
        (value >> 16) as u8,
        (value >> 24) as u8,
    ]
}
/// Encode a 64-bit unsigned integer in little-endian.
pub fn encode_little_endian_u64(value: u64) -> [u8; 8] {
    [
        (value >>  0) as u8,
        (value >>  8) as u8,
        (value >> 16) as u8,
        (value >> 24) as u8,
        (value >> 32) as u8,
        (value >> 40) as u8,
        (value >> 48) as u8,
        (value >> 56) as u8,
    ]
}

/// Decode a 32-bit unsigned integer in little-endian.
pub fn decode_little_endian_u32(buffer: &[u8]) -> u32 {
    ((buffer[0] as u32) <<  0) |
    ((buffer[1] as u32) <<  8) |
    ((buffer[2] as u32) << 16) |
    ((buffer[3] as u32) << 24)
}

/// Decode a 64-bit unsigned integer in little-endian.
pub fn decode_little_endian_u64(buffer: &[u8]) -> u64 {
    ((buffer[0] as u64) <<  0) |
    ((buffer[1] as u64) <<  8) |
    ((buffer[2] as u64) << 16) |
    ((buffer[3] as u64) << 24) |
    ((buffer[4] as u64) << 32) |
    ((buffer[5] as u64) << 40) |
    ((buffer[6] as u64) << 48) |
    ((buffer[7] as u64) << 56)
}
