diff options
| author | Rusty Wagner <rusty@vector35.com> | 2020-07-22 16:49:08 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2020-07-22 16:49:08 -0400 |
| commit | 630824de49fcde2f61701ac2019834bda079a341 (patch) | |
| tree | aca9478e264f15a897657e9df736c2b4b6dad44f /python/highlevelil.py | |
| parent | cf7851dee087e939ae10c0befe7ffa854885d41c (diff) | |
Expose C++ HLIL instruction comparison operators to Python
Diffstat (limited to 'python/highlevelil.py')
| -rw-r--r-- | python/highlevelil.py | 24 |
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)) |
