[return, *hi): the declarations of class `cls` among arr[0, n), which is * sorted by class first. */
| 2823 | /* [return, *hi): the declarations of class `cls` among arr[0, n), which is |
| 2824 | * sorted by class first. */ |
| 2825 | static 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 |
no outgoing calls
no test coverage detected