std.endian.little.write_i64
Show source codeHide source code
fn pub write_i64(value: Int, into: mut ByteArray, at: Int) {
if into.size - at < 8 { size_error(8) }
(into.to_pointer as Int + at as Pointer[UInt64]).0 = value as UInt64
}
fn pub static write_i64(value: Int, into: mut ByteArray, at: Int)
Writes a value interpreted as a 64-bits signed integer into into
as a series
of bytes, starting at the index at
.
Panics
This method panics if into
doesn't contain at least 8 values starting at
index at
.
Examples
import std.endian.little
let bytes = ByteArray.filled(with: 0, times: 8)
little.write_i64(123456789, into: bytes, at: 0)
bytes # => ByteArray.from_array([21, 205, 91, 7])