MCPcopy Index your code
hub / github.com/git/git / bisearch

Function bisearch

utf8.c:34–52  ·  view source on GitHub ↗

auxiliary function for binary search in interval table */

Source from the content-addressed store, hash-verified

32
33/* auxiliary function for binary search in interval table */
34static int bisearch(ucs_char_t ucs, const struct interval *table, int max)
35{
36 int min = 0;
37 int mid;
38
39 if (ucs < table[0].first || ucs > table[max].last)
40 return 0;
41 while (max >= min) {
42 mid = min + (max - min) / 2;
43 if (ucs > table[mid].last)
44 min = mid + 1;
45 else if (ucs < table[mid].first)
46 max = mid - 1;
47 else
48 return 1;
49 }
50
51 return 0;
52}
53
54/* The following two functions define the column width of an ISO 10646
55 * character as follows:

Callers 1

git_wcwidthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected