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

Function opSlice

protocol/txvm/strings.go:18–28  ·  view source on GitHub ↗
(vm *VM)

Source from the content-addressed store, hash-verified

16}
17
18func opSlice(vm *VM) {
19 end := int64(vm.popInt())
20 start := int64(vm.popInt())
21 str := vm.popBytes()
22 if start < 0 || end < start || end > int64(len(str)) {
23 panic(errors.WithData(ErrSliceRange, "start", start, "end", end, "len(bytes)", len(str)))
24 }
25 str2 := append(Bytes{}, str[start:end]...)
26 vm.chargeCreate(str2)
27 vm.push(str2)
28}

Callers

nothing calls this directly

Calls 5

WithDataFunction · 0.92
popIntMethod · 0.80
popBytesMethod · 0.80
chargeCreateMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected