| ... | @@ -1644,6 +1644,14 @@ pub const CLASS = enum(u8) { | ... | @@ -1644,6 +1644,14 @@ pub const CLASS = enum(u8) { |
| 1644 | | 1644 | |
| 1645 | pub const NUM = @typeInfo(CLASS).@"enum".field_names.len; | 1645 | pub const NUM = @typeInfo(CLASS).@"enum".field_names.len; |
| 1646 | | 1646 | |
| | 1647 | pub inline fn size(class: CLASS) u32 { |
| | 1648 | return switch (class) { |
| | 1649 | .NONE, _ => unreachable, |
| | 1650 | .@"32" => 4, |
| | 1651 | .@"64" => 8, |
| | 1652 | }; |
| | 1653 | } |
| | 1654 | |
| 1647 | pub fn ElfN(comptime class: CLASS) type { | 1655 | pub fn ElfN(comptime class: CLASS) type { |
| 1648 | return switch (class) { | 1656 | return switch (class) { |
| 1649 | .NONE, _ => comptime unreachable, | 1657 | .NONE, _ => comptime unreachable, |
| ... | @@ -1668,6 +1676,14 @@ pub const DATA = enum(u8) { | ... | @@ -1668,6 +1676,14 @@ pub const DATA = enum(u8) { |
| 1668 | _, | 1676 | _, |
| 1669 | | 1677 | |
| 1670 | pub const NUM = @typeInfo(DATA).@"enum".field_names.len; | 1678 | pub const NUM = @typeInfo(DATA).@"enum".field_names.len; |
| | 1679 | |
| | 1680 | pub inline fn endian(data: DATA) std.lang.Endian { |
| | 1681 | return switch (data) { |
| | 1682 | .NONE, _ => unreachable, |
| | 1683 | .@"2LSB" => .little, |
| | 1684 | .@"2MSB" => .big, |
| | 1685 | }; |
| | 1686 | } |
| 1671 | }; | 1687 | }; |
| 1672 | | 1688 | |
| 1673 | pub const OSABI = enum(u8) { | 1689 | pub const OSABI = enum(u8) { |