putUInt64Le

fun ByteArray.putUInt64Le(offset: Int, value: ULong, validRange: ULongRange = ULong.MIN_VALUE..ULong.MAX_VALUE)

Writes a UInt64 value to the byte array at the specified offset in little-endian order.

This function takes an unsigned long value and writes it as eight bytes (UInt64) into the byte array at the specified offset using little-endian byte order. It also validates that the value falls within a specified range, ensuring it can be represented as an unsigned eight-byte integer.

Parameters

offset

The offset (index) in the byte array where the UInt64 value should be written. Must be within the valid range of the array's indices.

value

The UInt64 value to be written.

validRange

The valid range for the value. Defaults to ULong.MIN_VALUE to ULong.MAX_VALUE (i.e., 0 to 18446744073709551615). Any value outside this range will cause an exception to be thrown.

Throws

If the value is outside the specified validRange.

If the offset or offset + 7 is negative or greater than or equal to the array's size.