From e319e92dc54f3dae18b87c2ba53c503b80ad7354 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Fri, 8 Oct 2021 17:26:12 -0400 Subject: Add __contains__ to AddressRange --- python/variable.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'python/variable.py') diff --git a/python/variable.py b/python/variable.py index 3af779a5..d345e4b0 100644 --- a/python/variable.py +++ b/python/variable.py @@ -798,4 +798,7 @@ class AddressRange: end:int # Exclusive ending address def __repr__(self): - return f"<{self.start:#x}-{self.end:#x}>" \ No newline at end of file + return f"<{self.start:#x}-{self.end:#x}>" + + def __contains__(self, i:int): + return i >= self.start and i < self.end \ No newline at end of file -- cgit v1.3.1