opcodeAbs treats the top item on the data stack as an integer and replaces it it with its absolute value. Stack transformation: [... x1 x2] -> [... x1 abs(x2)]
(op *opcode, data []byte, vm *Engine)
| 1470 | // |
| 1471 | // Stack transformation: [... x1 x2] -> [... x1 abs(x2)] |
| 1472 | func opcodeAbs(op *opcode, data []byte, vm *Engine) error { |
| 1473 | m, err := vm.dstack.PopInt() |
| 1474 | if err != nil { |
| 1475 | return err |
| 1476 | } |
| 1477 | |
| 1478 | if m < 0 { |
| 1479 | m = -m |
| 1480 | } |
| 1481 | vm.dstack.PushInt(m) |
| 1482 | return nil |
| 1483 | } |
| 1484 | |
| 1485 | // opcodeNot treats the top item on the data stack as an integer and replaces |
| 1486 | // it with its "inverted" value (0 becomes 1, non-zero becomes 0). |