Add exp support with other bases

pull/475/head
Nikhil Parasaram 6 years ago
parent 8cfe19c8c7
commit ba904f9bf0
  1. 6
      mythril/laser/ethereum/instructions.py

@ -217,9 +217,8 @@ class Instruction:
@instruction
def exp_(self, global_state):
state = global_state.mstate
# we only implement 2 ** x
base, exponent = util.pop_bitvec(state), util.pop_bitvec(state)
base, exponent = util.pop_bitvec(state), util.pop_bitvec(state)
if (type(base) != BitVecNumRef) or (type(exponent) != BitVecNumRef):
state.stack.append(BitVec("(" + str(simplify(base)) + ")^(" + str(simplify(exponent)) + ")", 256))
elif base.as_long() == 2:
@ -228,7 +227,8 @@ class Instruction:
else:
state.stack.append(base << (exponent - 1))
else:
state.stack.append(base)
state.stack.append(base.as_long() ** exponent.as_long())
return [global_state]
@instruction

Loading…
Cancel
Save