getIndex returns the index of the container with key `x` if no such container exists a negative value is returned
(x uint16)
| 356 | // getIndex returns the index of the container with key `x` |
| 357 | // if no such container exists a negative value is returned |
| 358 | func (ra *roaringArray) getIndex(x uint16) int { |
| 359 | // Todo : test |
| 360 | // before the binary search, we optimize for frequent cases |
| 361 | size := len(ra.keys) |
| 362 | if (size == 0) || (ra.keys[size-1] == x) { |
| 363 | return size - 1 |
| 364 | } |
| 365 | return ra.binarySearch(0, int64(size), x) |
| 366 | } |
| 367 | |
| 368 | func (ra *roaringArray) getKeyAtIndex(i int) uint16 { |
| 369 | return ra.keys[i] |
no test coverage detected