MCPcopy Index your code
hub / github.com/btcsuite/btcd / opcode0NotEqual

Function opcode0NotEqual

txscript/opcode.go:1517–1528  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1515// Stack transformation (x2!=0): [... x1 1] -> [... x1 1]
1516// Stack transformation (x2!=0): [... x1 17] -> [... x1 1]
1517func 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.

Callers

nothing calls this directly

Calls 2

PopIntMethod · 0.80
PushIntMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…