Skip to main content

data_byte_offset

Function data_byte_offset 

Source
fn data_byte_offset(field: &FieldDef) -> u32
Expand description

Compute the byte offset for a data-section field based on its type and slot_offset.

Cap’n Proto slot_offset is in units of the type size:

  • Bool: 1-bit units (byteOff = offset/8, bitIdx = offset%8)
  • UInt8/Int8: byte units
  • UInt16/Int16: 2-byte units
  • UInt32/Int32/Float32: 4-byte units
  • UInt64/Int64/Float64: 8-byte units