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)
| 64 | // getData returns a slice from the data based on the start and size and pads |
| 65 | // up to size with zero's. This function is overflow safe. |
| 66 | func getData(data []byte, start uint64, size uint64) []byte { |
| 67 | length := uint64(len(data)) |
| 68 | if start > length { |
| 69 | start = length |
| 70 | } |
| 71 | end := start + size |
| 72 | if end > length { |
| 73 | end = length |
| 74 | } |
| 75 | return common.RightPadBytes(data[start:end], int(size)) |
| 76 | } |
no outgoing calls