aboutsummaryrefslogtreecommitdiff
path: root/src/reader.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2021-07-06 21:42:09 -0700
committeriximeow <me@iximeow.net>2021-07-06 21:45:56 -0700
commit12bba22a456ed452efda8c951f61bdff1a516252 (patch)
tree410b22cf7a1253c83506651831dd7a9d91a8f96b /src/reader.rs
parentf393fae8906a0bc9431743db09bf6268b8f3810c (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/reader.rs')
-rw-r--r--src/reader.rs7
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)
}
}