diff options
author | iximeow <me@iximeow.net> | 2021-07-06 21:42:09 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2021-07-06 21:45:56 -0700 |
commit | 12bba22a456ed452efda8c951f61bdff1a516252 (patch) | |
tree | 410b22cf7a1253c83506651831dd7a9d91a8f96b /src | |
parent | f393fae8906a0bc9431743db09bf6268b8f3810c (diff) |
fix incorrect `offset` and `total_offset` counts for non-`u8` Word0.2.4
also update yaxpeax-arch to 0.2.4
Diffstat (limited to 'src')
-rw-r--r-- | src/reader.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/reader.rs b/src/reader.rs index db72b79..acb0146 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -6,6 +6,7 @@ impl From<ReadError> for StandardDecodeError { } } +#[derive(Debug, PartialEq, Eq, Copy, Clone)] pub enum ReadError { ExhaustedInput, IOError(&'static str), @@ -167,11 +168,13 @@ macro_rules! u8reader_reader_impl { } #[inline] fn offset(&mut self) -> $addr_size { - (self.data as usize - self.mark as usize) as $addr_size + (self.data as usize - self.mark as usize) as $addr_size / + (core::mem::size_of::<$word>() as $addr_size) } #[inline] fn total_offset(&mut self) -> $addr_size { - (self.data as usize - self.start as usize) as $addr_size + (self.data as usize - self.start as usize) as $addr_size / + (core::mem::size_of::<$word>() as $addr_size) } } |