auxiliary function for binary search in interval table */
| 32 | |
| 33 | /* auxiliary function for binary search in interval table */ |
| 34 | static 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: |