MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / lastStartingBefore

Function lastStartingBefore

src/extraction/objcpp-extractor.ts:38–52  ·  view source on GitHub ↗

The index of the last range starting at or before `offset`, or -1.

(starts: ArrayLike<number>, offset: number)

Source from the content-addressed store, hash-verified

36
37/** The index of the last range starting at or before `offset`, or -1. */
38function 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

Callers 3

checkCppPassFunction · 0.85
inKeptFunction · 0.85
extractObjcppFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected