const builtin = @import("builtin"); const std = @import("std"); const value = @import("../value.zig"); const gc = @import("../gc.zig"); const Value = value.Value; const Endian = enum(u1) { little, big, const native: Endian = switch (builtin.target.cpu.arch.endian()) { .little => .little, .big => .big, }; }; pub const Header = packed struct(u64) { type: enum(u2) { values, string, ints, floats, }, info: packed union { values: packed struct(u14) { weak: bool = false, _: u13 = 0, }, string: packed struct(u14) { enc: enum(u4) { utf8, utf16, utf24, utf32 }, endian: Endian = .native, quoted: bool, interned: bool, _: u7 = 0, }, ints: packed struct(u14) { signed: bool, endian: Endian = .native, size: u12, }, floats: packed struct(u14) { double: bool, endian: Endian = .native, _: u12 = 0, }, }, size: u48, pub fn bytes(self: *Header) []u8 { const hs = @sizeOf(Header); const ptr: [*]u8 = @ptrCast(self); const end = hs + self.size; return ptr[hs..end]; } };