diff options
author | pommicket <pommicket@gmail.com> | 2022-11-05 11:43:27 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-11-05 11:43:27 -0400 |
commit | bae6a477b04f7a767678c88089e28dd9e5c5b879 (patch) | |
tree | eeb29337826fc89d5ad0179598fb99719faf5405 /src/elf.rs | |
parent | bd54f4f57a56de5b2d8b80949acfd499a62a0bbf (diff) |
cleaned up code a bit
Diffstat (limited to 'src/elf.rs')
-rw-r--r-- | src/elf.rs | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -31,7 +31,7 @@ pub const DT_SYMENT: u32 = 11; pub const DT_REL: u32 = 17; pub const DT_RELSZ: u32 = 18; pub const DT_RELENT: u32 = 19; - + pub const PT_DYNAMIC: u32 = 2; pub const PT_INTERP: u32 = 3; @@ -123,7 +123,7 @@ impl Ehdr32 { pub fn size_of() -> usize { mem::size_of::<Self>() } - + pub fn section_offset(&self, ndx: u16) -> u64 { ndx as u64 * self.shentsize as u64 + self.shoff as u64 } @@ -205,20 +205,19 @@ pub struct Rel32 { } macro_rules! impl_bytes { - ($r#type: ident, $n: literal) => { - impl FromBytes<$n> for $r#type { + ($type: ident, $n: literal) => { + impl FromBytes<$n> for $type { fn from_bytes(bytes: [u8; $n]) -> Self { unsafe { mem::transmute(bytes) } } } - - impl ToBytes<$n> for $r#type { + + impl ToBytes<$n> for $type { fn to_bytes(self) -> [u8; $n] { unsafe { mem::transmute(self) } } } - - } + }; } impl_bytes!(Ehdr32, 0x34); |