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

Function opcodeNumNotEqual

txscript/opcode.go:1669–1687  ·  view source on GitHub ↗

opcodeNumNotEqual treats the top two items on the data stack as integers. When they are NOT equal, they are replaced with a 1, otherwise a 0. Stack transformation (x1==x2): [... 5 5] -> [... 0] Stack transformation (x1!=x2): [... 5 7] -> [... 1]

(op *opcode, data []byte, vm *Engine)

Source from the content-addressed store, hash-verified

1667// Stack transformation (x1==x2): [... 5 5] -> [... 0]
1668// Stack transformation (x1!=x2): [... 5 7] -> [... 1]
1669func opcodeNumNotEqual(op *opcode, data []byte, vm *Engine) error {
1670 v0, err := vm.dstack.PopInt()
1671 if err != nil {
1672 return err
1673 }
1674
1675 v1, err := vm.dstack.PopInt()
1676 if err != nil {
1677 return err
1678 }
1679
1680 if v0 != v1 {
1681 vm.dstack.PushInt(scriptNum(1))
1682 } else {
1683 vm.dstack.PushInt(scriptNum(0))
1684 }
1685
1686 return nil
1687}
1688
1689// opcodeLessThan treats the top two items on the data stack as integers. When
1690// the second-to-top item is less than the top item, they are replaced with a 1,

Callers

nothing calls this directly

Calls 3

scriptNumTypeAlias · 0.85
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…