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

Function getData

core/vm/common.go:37–47  ·  view source on GitHub ↗

getData returns a slice from the data based on the start and size and pads up to size with zero's. This function is overflow safe.

(data []byte, start uint64, size uint64)

Source from the content-addressed store, hash-verified

35// getData returns a slice from the data based on the start and size and pads
36// up to size with zero's. This function is overflow safe.
37func getData(data []byte, start uint64, size uint64) []byte {
38 length := uint64(len(data))
39 if start > length {
40 start = length
41 }
42 end := start + size
43 if end > length {
44 end = length
45 }
46 return common.RightPadBytes(data[start:end], int(size))
47}
48
49// getDataBig returns a slice from the data based on the start and size and pads
50// up to size with zero's. This function is overflow safe.

Callers 4

RequiredGasMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected