Search results

There are no results.

std.endian.big.write_i64

Show source code
Hide 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.swap_bytes
    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.big

let bytes = ByteArray.filled(with: 0, times: 8)

big.write_i64(123456789, into: bytes, at: 0)
bytes # => ByteArray.from_array([7, 91, 205, 21])