2015年3月31日 星期二

[C] Hexadecimal to decimal


static unsigned char hexadecimal2decimal(unsigned char c)
{
    if (c >= 'A' && c <= 'F')
    {
        return(c - 'A' + 10);
    } else if (c >= 'a' && c <= 'f')
    {
        return(c - 'a' + 10);
    }
    return c - '0';
}

0 意見:

張貼留言