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

Function opSmod

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

Source from the content-addressed store, hash-verified

104}
105
106func opSmod(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
107 x, y := math.S256(stack.pop()), math.S256(stack.pop())
108 res := evm.interpreter.intPool.getZero()
109
110 if y.Sign() == 0 {
111 stack.push(res)
112 } else {
113 if x.Sign() < 0 {
114 res.Mod(x.Abs(x), y.Abs(y))
115 res.Neg(res)
116 } else {
117 res.Mod(x.Abs(x), y.Abs(y))
118 }
119 stack.push(math.U256(res))
120 }
121 evm.interpreter.intPool.put(x, y)
122 return nil, nil
123}
124
125func opExp(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
126 base, exponent := 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