Search results

There are no results.

std.endian.big.read_i64

Show source code
Hide source code
fn pub read_i64(from: ref ByteArray, at: Int) -> Int {
  if from.size - at < 8 { size_error(8) }

  ((from.to_pointer as Int + at as Pointer[UInt64]).0 as Int).swap_bytes
}
fn pub static read_i64(from: ref ByteArray, at: Int) -> Int

Reads eight bytes starting at at as a 64-bits signed integer.

Panics

This method panics if from 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)
big.read_i64(from: bytes, at: 0) # => 123456789