summaryrefslogtreecommitdiff
path: root/python/highlevelil.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2020-07-22 16:49:08 -0400
committerRusty Wagner <rusty@vector35.com>2020-07-22 16:49:08 -0400
commit630824de49fcde2f61701ac2019834bda079a341 (patch)
treeaca9478e264f15a897657e9df736c2b4b6dad44f /python/highlevelil.py
parentcf7851dee087e939ae10c0befe7ffa854885d41c (diff)
Expose C++ HLIL instruction comparison operators to Python
Diffstat (limited to 'python/highlevelil.py')
-rw-r--r--python/highlevelil.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/python/highlevelil.py b/python/highlevelil.py
index 6b197fac..e815df48 100644
--- a/python/highlevelil.py
+++ b/python/highlevelil.py
@@ -344,12 +344,32 @@ class HighLevelILInstruction(object):
def __eq__(self, other):
if not isinstance(other, self.__class__):
return NotImplemented
- return (self._function, self._expr_index) == (other._function, other._expr_index)
+ return core.BNHighLevelILExprEqual(self._function.handle, self._expr_index, other._function.handle, other._expr_index)
def __ne__(self, other):
if not isinstance(other, self.__class__):
return NotImplemented
- return not (self == other)
+ return not core.BNHighLevelILExprEqual(self._function.handle, self._expr_index, other._function.handle, other._expr_index)
+
+ def __lt__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return core.BNHighLevelILExprLessThan(self._function.handle, self._expr_index, other._function.handle, other._expr_index)
+
+ def __le__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return not core.BNHighLevelILExprLessThan(other._function.handle, other._expr_index, self._function.handle, self._expr_index)
+
+ def __gt__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return core.BNHighLevelILExprLessThan(other._function.handle, other._expr_index, self._function.handle, self._expr_index)
+
+ def __ge__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return not core.BNHighLevelILExprLessThan(self._function.handle, self._expr_index, other._function, other._expr_index)
def __hash__(self):
return hash((self._function, self._expr_index))