pub fn read_uint40_be(data: &[u8]) -> Result<u64>Expand description
Read a 40-bit (5-byte) unsigned integer from a byte slice (big-endian)
40-bit integers are used throughout TACT formats for file sizes and offsets. They allow representing values up to 1TB while saving space compared to 64-bit.
§Arguments
data- Byte slice containing at least 5 bytes
§Returns
- The 40-bit value as a u64
§Errors
- Returns error if data contains less than 5 bytes
§Example
use tact_parser::utils::read_uint40_be;
let data = [0x01, 0x00, 0x00, 0x00, 0x00]; // 4GB file
let value = read_uint40_be(&data).unwrap();
assert_eq!(value, 0x100000000);