about summary refs log tree commit diff stats
path: root/miasm2/expression/expression_helper.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2018-02-09 15:30:26 +0100
committerAjax <commial@gmail.com>2018-02-14 12:14:07 +0100
commit68bacc75b53a77296980a58d5051b696ffe1c219 (patch)
tree1cb29b1c0f0148b7fe7aff6f70b6e711ecce73b9 /miasm2/expression/expression_helper.py
parentdcfadb31685d428618b88f19fcc96dd70cecfc8f (diff)
downloadmiasm-68bacc75b53a77296980a58d5051b696ffe1c219.tar.gz
miasm-68bacc75b53a77296980a58d5051b696ffe1c219.zip
Deprecate expr_cmps/expr_cmpu for a more verbose / understandable API
Diffstat (limited to '')
-rw-r--r--miasm2/expression/expression_helper.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/miasm2/expression/expression_helper.py b/miasm2/expression/expression_helper.py
index 1e718faa..722d169d 100644
--- a/miasm2/expression/expression_helper.py
+++ b/miasm2/expression/expression_helper.py
@@ -21,6 +21,7 @@ import itertools
 import collections
 import random
 import string
+import warnings
 
 import miasm2.expression.expression as m2_expr
 
@@ -468,16 +469,14 @@ class ExprRandom(object):
 
         return got
 
-def _expr_cmp_gen(arg1, arg2):
-    return (arg2 - arg1) ^ ((arg2 ^ arg1) & ((arg2 - arg1) ^ arg2))
-
 def expr_cmpu(arg1, arg2):
     """
     Returns a one bit long Expression:
     * 1 if @arg1 is strictly greater than @arg2 (unsigned)
     * 0 otherwise.
     """
-    return (_expr_cmp_gen(arg1, arg2) ^ arg2 ^ arg1).msb()
+    warnings.warn('DEPRECATION WARNING: use "expr_is_unsigned_greater" instead"')
+    return m2_expr.expr_is_unsigned_greater(arg1, arg2)
 
 def expr_cmps(arg1, arg2):
     """
@@ -485,7 +484,8 @@ def expr_cmps(arg1, arg2):
     * 1 if @arg1 is strictly greater than @arg2 (signed)
     * 0 otherwise.
     """
-    return _expr_cmp_gen(arg1, arg2).msb()
+    warnings.warn('DEPRECATION WARNING: use "expr_is_signed_greater" instead"')
+    return m2_expr.expr_is_signed_greater(arg1, arg2)
 
 
 class CondConstraint(object):