This commit is contained in:
Paweł Bylica 2016-10-28 20:06:18 +00:00 committed by GitHub
commit db21b0bccb

View file

@ -192,8 +192,16 @@ func opSmod(instr instruction, pc *uint64, env Environment, contract *Contract,
} }
func opExp(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { func opExp(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) {
x, y := stack.pop(), stack.pop() base, exponent := stack.pop(), stack.pop()
stack.push(U256(x.Exp(x, y, Pow256))) result := big.NewInt(1)
for exponent.Cmp(common.Big0) != 0 {
if exponent.Bit(0) == 1 {
U256(result.Mul(result, base))
}
U256(base.Mul(base, base))
exponent.Rsh(exponent, 1)
}
stack.push(result)
} }
func opSignExtend(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) { func opSignExtend(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *Stack) {