MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / class_range

Function class_range

src/pipeline/doc_links_cs.c:2825–2848  ·  view source on GitHub ↗

[return, *hi): the declarations of class `cls` among arr[0, n), which is * sorted by class first. */

Source from the content-addressed store, hash-verified

2823/* [return, *hi): the declarations of class `cls` among arr[0, n), which is
2824 * sorted by class first. */
2825static int class_range(const cs_bind_t *arr, int n, unsigned char cls, int *out_hi) {
2826 int a = 0;
2827 int b = n;
2828 while (a < b) {
2829 int mid = a + ((b - a) / PAIR_LEN);
2830 if (arr[mid].cls < cls) {
2831 a = mid + SKIP_ONE;
2832 } else {
2833 b = mid;
2834 }
2835 }
2836 int first = a;
2837 b = n;
2838 while (a < b) {
2839 int mid = a + ((b - a) / PAIR_LEN);
2840 if (arr[mid].cls <= cls) {
2841 a = mid + SKIP_ONE;
2842 } else {
2843 b = mid;
2844 }
2845 }
2846 *out_hi = a;
2847 return first;
2848}
2849
2850/* True when a declaration in file `fa` is the better one to bind than one in
2851 * `fb`, for a reference written in `src`: its own file, then the longer

Callers 2

class_nodeFunction · 0.85
declared_in_viewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected