cw_value(int c)
{
    int mid, bot, top;

    if (cw_table == NULL)
	return 0;

    // first quick check for Latin1 etc. characters
    if (c < cw_table[0].first)
	return 0;

    // binary search in table
    bot = 0;
    top = (int)cw_table_size - 1;
    while (top >= bot)
    {
	mid = (bot + top) / 2;
	if (cw_table[mid].last < c)
	    bot = mid + 1;
	else if (cw_table[mid].first > c)
	    top = mid - 1;
	else
	    return cw_table[mid].width;
    }
    return 0;
}
cw_value(int c)
{
    int mid, bot, top;

    if (cw_table == NULL)
	return 0;

     
    if (c < cw_table[0].first)
	return 0;

     
    bot = 0;
    top = (int)cw_table_size - 1;
    while (top >= bot)
    {
	mid = (bot + top) / 2;
	if (cw_table[mid].last < c)
	    bot = mid + 1;
	else if (cw_table[mid].first > c)
	    top = mid - 1;
	else
	    return cw_table[mid].width;
    }
    return 0;
}