struct UInt64
- UInt64
- Int
- Number
- Value
- Object
Defined in:
bytes_ext.crConstructors
-
.from_be_bytes(bytes : Bytes) : UInt64
Create a
UInt64
value from its representation as a byte array in big endian. -
.from_bytes(bytes : Bytes, format : IO::ByteFormat = IO::ByteFormat::SystemEndian) : UInt64
Create a
UInt64
value from its representation as a byte array. -
.from_le_bytes(bytes : Bytes) : UInt64
Create a
UInt64
value from its representation as a byte array in little endian.
Instance Method Summary
-
#to_be_bytes : Bytes
Return the memory representation of this number as a byte array in big-endian (network) byte order.
-
#to_bytes(format : IO::ByteFormat = IO::ByteFormat::SystemEndian) : Bytes
Return the memory representation of this number as a byte array using the specified format
-
#to_le_bytes : Bytes
Return the memory representation of this number as a byte array in little-endian byte order.
Constructor Detail
Create a UInt64
value from its representation as a byte array in big endian.
bytes = Bytes[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]
UInt64.from_be_bytes(bytes)
# => 1234567890123456_u64
Create a UInt64
value from its representation as a byte array.
Create a UInt64
value from its representation as a byte array in little endian.
bytes = Bytes[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]
UInt64.from_le_bytes(bytes)
# => 1234567890123456_u64
Instance Method Detail
Return the memory representation of this number as a byte array in big-endian (network) byte order.
bytes = "1234567890123456_u64".to_be_bytes
# => Bytes[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]
Return the memory representation of this number as a byte array using the specified format
Return the memory representation of this number as a byte array in little-endian byte order.
bytes = 1234567890123456_u64.to_le_bytes
# => Bytes[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]