MCPcopy Create free account
hub / github.com/CPChain/chain / opSdiv

Function opSdiv

core/vm/instructions.go:76–93  ·  view source on GitHub ↗
(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack)

Source from the content-addressed store, hash-verified

74}
75
76func opSdiv(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
77 x, y := math.S256(stack.pop()), math.S256(stack.pop())
78 res := evm.interpreter.intPool.getZero()
79
80 if y.Sign() == 0 || x.Sign() == 0 {
81 stack.push(res)
82 } else {
83 if x.Sign() != y.Sign() {
84 res.Div(x.Abs(x), y.Abs(y))
85 res.Neg(res)
86 } else {
87 res.Div(x.Abs(x), y.Abs(y))
88 }
89 stack.push(math.U256(res))
90 }
91 evm.interpreter.intPool.put(x, y)
92 return nil, nil
93}
94
95func opMod(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
96 x, y := stack.pop(), stack.pop()

Callers

nothing calls this directly

Calls 5

popMethod · 0.80
getZeroMethod · 0.80
SignMethod · 0.45
pushMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected