At returns the element at the specified index, while checking that the index is in bounds
(index uintptr)
| 49 | |
| 50 | // At returns the element at the specified index, while checking that the index is in bounds |
| 51 | func (a *Slice) At(index uintptr) unsafe.Pointer { |
| 52 | if a.Cap() < index { |
| 53 | panic("out of bounds") |
| 54 | } |
| 55 | if a.Len() < index { |
| 56 | atomic.StoreUintptr(&a.len, index+1) |
| 57 | } |
| 58 | return a.Element(index) |
| 59 | } |
| 60 | |
| 61 | // Element returns the element at the specified index, without checking that the index is in bounds |
| 62 | func (a *Slice) Element(index uintptr) unsafe.Pointer { |