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

Function opcodeBoolOr

txscript/opcode.go:1603–1621  ·  view source on GitHub ↗

opcodeBoolOr treats the top two items on the data stack as integers. When either of them are not zero, they are replaced with a 1, otherwise a 0. Stack transformation (x1==0, x2==0): [... 0 0] -> [... 0] Stack transformation (x1!=0, x2==0): [... 5 0] -> [... 1] Stack transformation (x1==0, x2!=0):

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

Source from the content-addressed store, hash-verified

1601// Stack transformation (x1==0, x2!=0): [... 0 7] -> [... 1]
1602// Stack transformation (x1!=0, x2!=0): [... 4 8] -> [... 1]
1603func opcodeBoolOr(op *opcode, data []byte, vm *Engine) error {
1604 v0, err := vm.dstack.PopInt()
1605 if err != nil {
1606 return err
1607 }
1608
1609 v1, err := vm.dstack.PopInt()
1610 if err != nil {
1611 return err
1612 }
1613
1614 if v0 != 0 || v1 != 0 {
1615 vm.dstack.PushInt(scriptNum(1))
1616 } else {
1617 vm.dstack.PushInt(scriptNum(0))
1618 }
1619
1620 return nil
1621}
1622
1623// opcodeNumEqual treats the top two items on the data stack as integers. When
1624// they are equal, they are replaced with a 1, otherwise a 0.

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…