auxiliary function for binary search in interval table */
| 68 | |
| 69 | /* auxiliary function for binary search in interval table */ |
| 70 | static int |
| 71 | xo_bisearch (wchar_t ucs, const struct interval *table, int max) |
| 72 | { |
| 73 | int min = 0; |
| 74 | int mid; |
| 75 | |
| 76 | if (ucs < table[0].first || ucs > table[max].last) |
| 77 | return 0; |
| 78 | while (max >= min) { |
| 79 | mid = (min + max) / 2; |
| 80 | if (ucs > table[mid].last) |
| 81 | min = mid + 1; |
| 82 | else if (ucs < table[mid].first) |
| 83 | max = mid - 1; |
| 84 | else |
| 85 | return 1; |
| 86 | } |
| 87 | |
| 88 | return 0; |
| 89 | } |
| 90 | |
| 91 | |
| 92 | /* The following two functions define the column width of an ISO 10646 |
no outgoing calls
no test coverage detected