Fix all integral type checks that forget long (#555)
This commit is contained in:
@@ -530,7 +530,7 @@ class UnsignedGreaterOrEqual(BoolOperation):
|
||||
class Array(Expression):
|
||||
def __init__(self, index_bits, index_max, *operands, **kwargs):
|
||||
assert index_bits in (32, 64, 256)
|
||||
assert index_max is None or isinstance(index_max, int)
|
||||
assert index_max is None or isinstance(index_max, (int, long))
|
||||
assert index_max is None or index_max > 0 and index_max < 2 ** index_bits
|
||||
self._index_bits = index_bits
|
||||
self._index_max = index_max
|
||||
@@ -699,7 +699,7 @@ class ArraySelect(BitVec, Operation):
|
||||
class BitVecSignExtend(BitVecOperation):
|
||||
def __init__(self, operand, size_dest, *args, **kwargs):
|
||||
assert isinstance(operand, BitVec)
|
||||
assert isinstance(size_dest, int)
|
||||
assert isinstance(size_dest, (int, long))
|
||||
assert size_dest >= operand.size
|
||||
super(BitVecSignExtend, self).__init__(size_dest, operand, *args, **kwargs)
|
||||
self.extend = size_dest - operand.size
|
||||
@@ -726,7 +726,7 @@ class BitVecExtract(BitVecOperation):
|
||||
|
||||
class BitVecConcat(BitVecOperation):
|
||||
def __init__(self, size_dest, *operands, **kwargs):
|
||||
assert isinstance(size_dest, int)
|
||||
assert isinstance(size_dest, (int, long))
|
||||
assert all(map(lambda x: isinstance(x, BitVec), operands))
|
||||
assert size_dest == sum(map(lambda x: x.size, operands))
|
||||
super(BitVecConcat, self).__init__(size_dest, *operands, **kwargs)
|
||||
|
||||
@@ -9,7 +9,7 @@ def ORD(s):
|
||||
return s
|
||||
else:
|
||||
return BitVecExtract(s, 0, 7)
|
||||
elif isinstance(s, int):
|
||||
elif isinstance(s, (int, long)):
|
||||
return s & 0xff
|
||||
else:
|
||||
return ord(s)
|
||||
@@ -254,7 +254,7 @@ def simplify(value):
|
||||
|
||||
|
||||
def SAR(size, a, b):
|
||||
assert isinstance(size, int)
|
||||
assert isinstance(size, (int, long))
|
||||
if isinstance(b, BitVec) and b.size != size:
|
||||
b = ZEXTEND(b, size)
|
||||
if isinstance(a, BitVec):
|
||||
|
||||
@@ -16,7 +16,7 @@ class ContextFilter(logging.Filter):
|
||||
return '{}.{}'.format(prefix, components[-1])
|
||||
|
||||
def filter(self, record):
|
||||
if hasattr(self, 'stateid') and isinstance(self.stateid, int):
|
||||
if hasattr(self, 'stateid') and isinstance(self.stateid, (int, long)):
|
||||
record.stateid = '[%d]' % self.stateid
|
||||
else:
|
||||
record.stateid = ''
|
||||
|
||||
@@ -72,7 +72,7 @@ elif args.bbs:
|
||||
break
|
||||
|
||||
def p(x):
|
||||
return isinstance(x, int) and hex(x) or x
|
||||
return isinstance(x, (int, long)) and hex(x) or x
|
||||
|
||||
print '%s -> [%s]'%(p(origin), ', '.join(map(p, targets)) )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user