about summary refs log tree commit diff stats
path: root/miasm2/core/interval.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2017-02-13 17:27:12 +0100
committerAjax <commial@gmail.com>2017-02-13 17:27:12 +0100
commita89ff77f5efeb33c2006eac06036b80c3999e401 (patch)
tree0dcfce60592a9e9d3cad19a4ea9334427a664b12 /miasm2/core/interval.py
parentd30ea3788133fffc294602ee6cce88b407caaf4a (diff)
downloadmiasm-a89ff77f5efeb33c2006eac06036b80c3999e401.tar.gz
miasm-a89ff77f5efeb33c2006eac06036b80c3999e401.zip
Interval: add .length computation
Diffstat (limited to 'miasm2/core/interval.py')
-rw-r--r--miasm2/core/interval.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/miasm2/core/interval.py b/miasm2/core/interval.py
index 66445674..019764d4 100644
--- a/miasm2/core/interval.py
+++ b/miasm2/core/interval.py
@@ -244,3 +244,11 @@ class interval(object):
 
         if dry_run is False:
             img.show()
+
+    @property
+    def length(self):
+        """
+        Return the cumulated length of intervals
+        """
+        # Do not use __len__ because we may return a value > 32 bits
+        return sum((stop - start + 1) for start, stop in self.intervals)