MCPcopy Create free account
hub / github.com/chain/txvm / opJumpIf

Function opJumpIf

protocol/txvm/control.go:24–38  ·  view source on GitHub ↗
(vm *VM)

Source from the content-addressed store, hash-verified

22}
23
24func opJumpIf(vm *VM) {
25 offset := int64(vm.popInt())
26 cond := vm.popBool()
27 if !cond {
28 return
29 }
30 dest, ok := checked.AddInt64(vm.run.pc, offset)
31 if !ok {
32 panic(errors.Wrap(ErrIntOverflow, "computing jump destination"))
33 }
34 if dest < 0 || dest > int64(len(vm.run.prog)) {
35 panic(errors.WithData(ErrJump, "destination", dest, "len(prog)", len(vm.run.prog)))
36 }
37 vm.run.pc = dest
38}
39
40func opExec(vm *VM) {
41 prog := vm.popBytes()

Callers

nothing calls this directly

Calls 5

AddInt64Function · 0.92
WrapFunction · 0.92
WithDataFunction · 0.92
popIntMethod · 0.80
popBoolMethod · 0.80

Tested by

no test coverage detected