module PackedFields; (* A packed record's fields are read and written wherever they sit *) import Out; import SYSTEM; type Header = packed record kind: U8; len: U32; big: I64; tag: U8; end; proc main*; var h, g: Header; b: ^U8; begin h.kind := 7; h.len := 0DEADBEEFH; h.big := -5; h.tag := 9; INC(h.len); g := h; Out.int(SIZE(Header)); Out.str(" "); Out.int(I64(g.kind)); Out.str(" "); Out.hex(U64(g.len), 8); Out.str(" "); Out.int(g.big); Out.str(" "); Out.int(I64(g.tag)); Out.ln; b := SYSTEM.ADR(g.kind); Out.int(I64(b[1])); Out.ln; end; end PackedFields.