/* This file is part of the Simba project.  */
static int to_nibble(int ch)
/* This file is part of the Simba project.  */
static int to_nibble(int ch)
{
    ch = tolower(ch);
    if ((ch >= '0') && (ch <= '9')) {
        return (ch - '0');
    } else if ((ch >= 'a') && (ch <= 'f')) {
        return (ch - 'a' + 10);
    } else {
        return (-EINVAL);
    }
}