Function init [src]

Prototype

pub fn init(hdr: anytype, endian: std.builtin.Endian) Header

Parameters

endian: std.builtin.Endian

Source

pub fn init(hdr: anytype, endian: std.builtin.Endian) Header { // Converting integers to exhaustive enums using `@enumFromInt` could cause a panic. comptime assert(!@typeInfo(OSABI).@"enum".is_exhaustive); return .{ .is_64 = switch (@TypeOf(hdr)) { Elf32_Ehdr => false, Elf64_Ehdr => true, else => @compileError("bad type"), }, .endian = endian, .os_abi = @enumFromInt(hdr.e_ident[EI_OSABI]), .abi_version = hdr.e_ident[EI_ABIVERSION], .type = hdr.e_type, .machine = hdr.e_machine, .entry = hdr.e_entry, .phoff = hdr.e_phoff, .shoff = hdr.e_shoff, .phentsize = hdr.e_phentsize, .phnum = hdr.e_phnum, .shentsize = hdr.e_shentsize, .shnum = hdr.e_shnum, .shstrndx = hdr.e_shstrndx, }; }