opcodeNegate treats the top item on the data stack as an integer and replaces it with its negation. Stack transformation: [... x1 x2] -> [... x1 -x2]
(op *opcode, data []byte, vm *Engine)
| 1456 | // |
| 1457 | // Stack transformation: [... x1 x2] -> [... x1 -x2] |
| 1458 | func opcodeNegate(op *opcode, data []byte, vm *Engine) error { |
| 1459 | m, err := vm.dstack.PopInt() |
| 1460 | if err != nil { |
| 1461 | return err |
| 1462 | } |
| 1463 | |
| 1464 | vm.dstack.PushInt(-m) |
| 1465 | return nil |
| 1466 | } |
| 1467 | |
| 1468 | // opcodeAbs treats the top item on the data stack as an integer and replaces it |
| 1469 | // it with its absolute value. |