From f0c263b588bfda52f7c791e84dba0ea79f927c09 Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Thu, 18 May 2017 22:12:21 -0700 Subject: [PATCH] Added convenience function get_raw_index_from_address --- atrcopy/segments.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/atrcopy/segments.py b/atrcopy/segments.py index b648b51..c9a5f0d 100644 --- a/atrcopy/segments.py +++ b/atrcopy/segments.py @@ -582,6 +582,12 @@ class DefaultSegment(object): """ return self.rawdata.get_raw_index(i) + def get_raw_index_from_address(self, addr): + """Get index into base array's raw data, given the address of a byte + into this segment + """ + return self.get_raw_index(addr - self.start_addr) + def get_index_from_base_index(self, base_index): """Get index into this array's data given the index into the base array """