slice returns the slice of index data starting at the given byte offset. If n >= 0, the slice must have length at least n and is truncated to length n.
(off uint32, n int)
| 114 | // slice returns the slice of index data starting at the given byte offset. |
| 115 | // If n >= 0, the slice must have length at least n and is truncated to length n. |
| 116 | func (ix *Index) slice(off uint32, n int) []byte { |
| 117 | o := int(off) |
| 118 | if uint32(o) != off || n >= 0 && o+n > len(ix.data.d) { |
| 119 | corrupt() |
| 120 | } |
| 121 | if n < 0 { |
| 122 | return ix.data.d[o:] |
| 123 | } |
| 124 | return ix.data.d[o : o+n] |
| 125 | } |
| 126 | |
| 127 | // uint32 returns the uint32 value at the given offset in the index data. |
| 128 | func (ix *Index) uint32(off uint32) uint32 { |