The index of the last range starting at or before `offset`, or -1.
(starts: ArrayLike<number>, offset: number)
| 36 | |
| 37 | /** The index of the last range starting at or before `offset`, or -1. */ |
| 38 | function lastStartingBefore(starts: ArrayLike<number>, offset: number): number { |
| 39 | let lo = 0; |
| 40 | let hi = starts.length - 1; |
| 41 | let found = -1; |
| 42 | while (lo <= hi) { |
| 43 | const mid = (lo + hi) >> 1; |
| 44 | if (starts[mid]! <= offset) { |
| 45 | found = mid; |
| 46 | lo = mid + 1; |
| 47 | } else { |
| 48 | hi = mid - 1; |
| 49 | } |
| 50 | } |
| 51 | return found; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * What the C++ pass made of each C++ item: `misread`, the items the grammar |
no outgoing calls
no test coverage detected