MCPcopy Create free account
hub / github.com/KTH-RPL/dufomap / bisearch

Function bisearch

src/indicators.hpp:1423–1440  ·  view source on GitHub ↗

auxiliary function for binary search in interval table */

Source from the content-addressed store, hash-verified

1421
1422/* auxiliary function for binary search in interval table */
1423static inline int bisearch(wchar_t ucs, const struct interval *table, int max) {
1424 int min = 0;
1425 int mid;
1426
1427 if (ucs < table[0].first || ucs > table[max].last)
1428 return 0;
1429 while (max >= min) {
1430 mid = (min + max) / 2;
1431 if (ucs > table[mid].last)
1432 min = mid + 1;
1433 else if (ucs < table[mid].first)
1434 max = mid - 1;
1435 else
1436 return 1;
1437 }
1438
1439 return 0;
1440}
1441
1442/* The following two functions define the column width of an ISO 10646
1443 * character as follows:

Callers 2

mk_wcwidthFunction · 0.85
mk_wcwidth_cjkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected