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

Function opAddmod

core/vm/instructions.go:288–299  ·  view source on GitHub ↗

opAddmod Multiplexed verification memory algorithm if z equals max uint

(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack)

Source from the content-addressed store, hash-verified

286
287// opAddmod Multiplexed verification memory algorithm if z equals max uint
288func opAddmod(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
289 x, y, z := stack.pop(), stack.pop(), stack.pop()
290 if z.Cmp(bigZero) > 0 {
291 x.Add(x, y)
292 x.Mod(x, z)
293 stack.push(math.U256(x))
294 } else {
295 stack.push(x.SetUint64(0))
296 }
297 evm.interpreter.intPool.put(y, z)
298 return nil, nil
299}
300
301func opMulmod(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
302 x, y, z := stack.pop(), stack.pop(), stack.pop()

Callers

nothing calls this directly

Calls 5

popMethod · 0.80
CmpMethod · 0.80
AddMethod · 0.65
pushMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected