RegisterOffset

zio.blocks.schema.binding.RegisterOffset

A RegisterOffset is a position in Registers, or an amount of space in them, packed into one Long. The high 32 bits count bytes of the byte area, which holds primitive values, and the low 32 bits count slots of the object area, which holds references. Offsets add up: the offset of a record field is the space taken by the fields before it, and offset + base places a record inside a larger Registers. Plain + is correct as long as neither total reaches 2^31; add checks that.

import zio.blocks.schema.binding._

val offset = RegisterOffset(objects = 3, bytes = 4, ints = 2)
val bytes  = RegisterOffset.getBytes(offset)   // 12
val slots  = RegisterOffset.getObjects(offset) // 3

Attributes

See also
Source
RegisterOffset.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Types

type RegisterOffset = Long

A packed byte count and object-slot count; see the RegisterOffset object.

A packed byte count and object-slot count; see the RegisterOffset object.

Attributes

Source
RegisterOffset.scala

Value members

Concrete methods

inline def add(left: RegisterOffset, right: RegisterOffset): RegisterOffset

Returns left + right, adding the byte counts and the object counts.

Returns left + right, adding the byte counts and the object counts.

Attributes

Throws
java.lang.IllegalArgumentException

offset overflow, when either total is 2^31 or more

Source
RegisterOffset.scala
def apply(booleans: Int = ..., bytes: Int = ..., shorts: Int = ..., ints: Int = ..., longs: Int = ..., floats: Int = ..., doubles: Int = ..., chars: Int = ..., objects: Int = ...): RegisterOffset

Returns the space that the given numbers of values take: booleans + bytes + 2 * (chars + shorts) + 4 * (floats + ints) + 8 * (doubles + longs) bytes and objects object slots. Used as an offset, it points just past those values.

Returns the space that the given numbers of values take: booleans + bytes + 2 * (chars + shorts) + 4 * (floats + ints) + 8 * (doubles + longs) bytes and objects object slots. Used as an offset, it points just past those values.

Attributes

Throws
java.lang.IllegalArgumentException

offset overflow, when the byte total is negative or 2^31 or more, or objects is negative

Source
RegisterOffset.scala
inline def getBytes(offset: RegisterOffset): Int

Returns the byte part of offset: a byte index in the byte area, or a number of bytes.

Returns the byte part of offset: a byte index in the byte area, or a number of bytes.

Attributes

Source
RegisterOffset.scala
inline def getObjects(offset: RegisterOffset): Int

Returns the object part of offset: an object-slot index, or a number of slots.

Returns the object part of offset: an object-slot index, or a number of slots.

Attributes

Source
RegisterOffset.scala

Returns offset moved past 1 byte, the size of a Boolean or a Byte.

Returns offset moved past 1 byte, the size of a Boolean or a Byte.

Attributes

Source
RegisterOffset.scala

Returns offset moved past 2 bytes, the size of a Char or a Short.

Returns offset moved past 2 bytes, the size of a Char or a Short.

Attributes

Source
RegisterOffset.scala

Returns offset moved past 8 bytes, the size of a Double or a Long.

Returns offset moved past 8 bytes, the size of a Double or a Long.

Attributes

Source
RegisterOffset.scala

Returns offset moved past 4 bytes, the size of a Float or an Int.

Returns offset moved past 4 bytes, the size of a Float or an Int.

Attributes

Source
RegisterOffset.scala

Returns offset moved past one object slot.

Returns offset moved past one object slot.

Attributes

Source
RegisterOffset.scala

Concrete fields

The first byte and the first object slot; also no space at all.

The first byte and the first object slot; also no space at all.

Attributes

Source
RegisterOffset.scala