struct

Int64

Inherits Int / Number / Steppable / Comparable / Value / Object

Constructors

from_be_bytes(bytes : Bytes) : Int64

Create a Int64 value from its representation as a byte array in big endian.

bytes = Bytes[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xD2]
Int64.from_be_bytes(bytes)
# => 1234_i64
Source
from_bytes(bytes : Bytes, format : IO::ByteFormat = IO::ByteFormat::SystemEndian) : Int64

Create a Int64 value from its representation as a byte array.

Source
from_le_bytes(bytes : Bytes) : Int64

Create a Int64 value from its representation as a byte array in little endian.

bytes = Bytes[0xD2, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
Int64.from_le_bytes(bytes)
# => 1234_i64
Source
from_ne_bytes(bytes : Bytes) : Int64

Create a Int64 value from its representation as a byte array in native endian.

Source

Instance methods

to_be_bytes

Return the memory representation of this number as a byte array in big-endian (network) byte order.

bytes = "1234_i64".to_be_bytes
# => Bytes[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xD2]
Source

Return the memory representation of this number as a byte array using the specified format

Source
to_le_bytes

Return the memory representation of this number as a byte array in little-endian byte order.

bytes = 1234_i64.to_le_bytes
# => Bytes[0xD2, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
Source
to_ne_bytes

Return the memory representation of this number as a byte array in native-endian byte order.

Source