opcodeSub treats the top two items on the data stack as integers and replaces them with the result of subtracting the top entry from the second-to-top entry. Stack transformation: [... x1 x2] -> [... x1-x2]
(op *opcode, data []byte, vm *Engine)
| 1552 | // |
| 1553 | // Stack transformation: [... x1 x2] -> [... x1-x2] |
| 1554 | func opcodeSub(op *opcode, data []byte, vm *Engine) error { |
| 1555 | v0, err := vm.dstack.PopInt() |
| 1556 | if err != nil { |
| 1557 | return err |
| 1558 | } |
| 1559 | |
| 1560 | v1, err := vm.dstack.PopInt() |
| 1561 | if err != nil { |
| 1562 | return err |
| 1563 | } |
| 1564 | |
| 1565 | vm.dstack.PushInt(v1 - v0) |
| 1566 | return nil |
| 1567 | } |
| 1568 | |
| 1569 | // opcodeBoolAnd treats the top two items on the data stack as integers. When |
| 1570 | // both of them are not zero, they are replaced with a 1, otherwise a 0. |