Function write_uint40_be

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

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

§Arguments

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

§Returns

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

§Panics

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

§Example

use tact_parser::utils::write_uint40_be;

let bytes = write_uint40_be(0x100000000); // 4GB
assert_eq!(bytes, [0x01, 0x00, 0x00, 0x00, 0x00]);