Function write_uint40

Source
pub fn write_uint40(value: u64) -> [u8; 5]
Expand description

Write a 40-bit (5-byte) unsigned integer to a byte array (little-endian)

§Arguments

  • value - The value to write (must fit in 40 bits)

§Returns

  • A 5-byte array containing the value in little-endian format

§Panics

  • Panics if value exceeds 40-bit range (>= 2^40)

§Example

use tact_parser::utils::write_uint40;

let bytes = write_uint40(0x9A78563412);
assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78, 0x9A]);