static int convert_char_to_hex()

in src/uhttp.c [431:463]


static int convert_char_to_hex(const unsigned char* hexText, size_t len)
{
    int result = 0;
    for (size_t index = 0; index < len; index++)
    {
        if (hexText[index] == ';')
        {
            break;
        }
        else
        {
            int accumulator = 0;
            if (hexText[index] >= 48 && hexText[index] <= 57)
            {
                accumulator = hexText[index] - 48;
            }
            else if (hexText[index] >= 65 && hexText[index] <= 70)
            {
                accumulator = hexText[index] - 55;
            }
            else if (hexText[index] >= 97 && hexText[index] <= 102)
            {
                accumulator = hexText[index] - 87;
            }
            if (index > 0)
            {
                result = result << 4;
            }
            result += accumulator;
        }
    }
    return result;
}