opcode0NotEqual treats the top item on the data stack as an integer and replaces it with either a 0 if it is zero, or a 1 if it is not zero. Stack transformation (x2==0): [... x1 0] -> [... x1 0] Stack transformation (x2!=0): [... x1 1] -> [... x1 1] Stack transformation (x2!=0): [... x1 17] -> [..
(op *opcode, data []byte, vm *Engine)
| 1515 | // Stack transformation (x2!=0): [... x1 1] -> [... x1 1] |
| 1516 | // Stack transformation (x2!=0): [... x1 17] -> [... x1 1] |
| 1517 | func opcode0NotEqual(op *opcode, data []byte, vm *Engine) error { |
| 1518 | m, err := vm.dstack.PopInt() |
| 1519 | if err != nil { |
| 1520 | return err |
| 1521 | } |
| 1522 | |
| 1523 | if m != 0 { |
| 1524 | m = 1 |
| 1525 | } |
| 1526 | vm.dstack.PushInt(m) |
| 1527 | return nil |
| 1528 | } |
| 1529 | |
| 1530 | // opcodeAdd treats the top two items on the data stack as integers and replaces |
| 1531 | // them with their sum. |