opcodeAdd treats the top two items on the data stack as integers and replaces them with their sum. Stack transformation: [... x1 x2] -> [... x1+x2]
(op *opcode, data []byte, vm *Engine)
| 1532 | // |
| 1533 | // Stack transformation: [... x1 x2] -> [... x1+x2] |
| 1534 | func opcodeAdd(op *opcode, data []byte, vm *Engine) error { |
| 1535 | v0, err := vm.dstack.PopInt() |
| 1536 | if err != nil { |
| 1537 | return err |
| 1538 | } |
| 1539 | |
| 1540 | v1, err := vm.dstack.PopInt() |
| 1541 | if err != nil { |
| 1542 | return err |
| 1543 | } |
| 1544 | |
| 1545 | vm.dstack.PushInt(v0 + v1) |
| 1546 | return nil |
| 1547 | } |
| 1548 | |
| 1549 | // opcodeSub treats the top two items on the data stack as integers and replaces |
| 1550 | // them with the result of subtracting the top entry from the second-to-top |