From bae6a477b04f7a767678c88089e28dd9e5c5b879 Mon Sep 17 00:00:00 2001 From: pommicket Date: Sat, 5 Nov 2022 11:43:27 -0400 Subject: cleaned up code a bit --- src/elf.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/elf.rs') diff --git a/src/elf.rs b/src/elf.rs index 1f9f0dd..23dd246 100644 --- a/src/elf.rs +++ b/src/elf.rs @@ -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::() } - + 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); -- cgit v1.2.3