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

Function opcodeNegate

txscript/opcode.go:1458–1466  ·  view source on GitHub ↗

opcodeNegate treats the top item on the data stack as an integer and replaces it with its negation. Stack transformation: [... x1 x2] -> [... x1 -x2]

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

Source from the content-addressed store, hash-verified

1456//
1457// Stack transformation: [... x1 x2] -> [... x1 -x2]
1458func opcodeNegate(op *opcode, data []byte, vm *Engine) error {
1459 m, err := vm.dstack.PopInt()
1460 if err != nil {
1461 return err
1462 }
1463
1464 vm.dstack.PushInt(-m)
1465 return nil
1466}
1467
1468// opcodeAbs treats the top item on the data stack as an integer and replaces it
1469// it with its absolute value.

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…