git-2.22.0/utf8.c
/* auxiliary function for binary search in interval table */
auxiliary function for binary search in interval table
auxiliary function for binary search in interval table
static int bisearch(ucs_char_t ucs, const struct interval *table, int max)
{
	int min = 0;
	int mid;
	if (ucs < table[0].first || ucs > table[max].last)
		return 0;
	while (max >= min) {
		mid = min + (max - min) / 2;
		if (ucs > table[mid].last)
			min = mid + 1;
		else if (ucs < table[mid].first)
			max = mid - 1;
		else
			return 1;
	}
	return 0;
}
static int bisearch ( ucs_char_t ucs , const struct interval * table , int max ) { int min = 0 ; int mid ; if ( ucs < table [ 0 ] . first || ucs > table [ max ] . last ) return 0 ; while ( max >= min ) { mid = min + ( max - min ) / 2 ; if ( ucs > table [ mid ] . last ) min = mid + 1 ; else if ( ucs < table [ mid ] . first ) max = mid - 1 ; else return 1 ; } return 0 ; }
auxiliary function for binary search in interval table
auxiliary function for binary search in interval table