kernels/linux-2.4.0/drivers/isdn/eicon/kprintf.c
/*
 * convert a number to hex ASCII
 */
convert a number to hex ASCII
convert a number to hex ASCII
static
void    do_hex( char            *temp,
                unsigned int    value,
                char            *s)
{
    int     i;
    static
    char    *dec_to_hex = "0123456789abcdef";
    temp[0] = '\0';
    for (i = 1; i <= 8; i++)
    {
        temp[i] = dec_to_hex[value & 0x0f];
        value >>= 4;
    }
    for (i = 8; temp[i] == '0'; i--)
    {
        ;
    }
    if (i == 0)
    {
        i++;
    }
    while (i >= 0)
    {
        *s++ = temp[i--];
    }
    return;
}
static void do_hex ( char * temp , unsigned int value , char * s ) { int i ; static char * dec_to_hex = " " ; temp [ 0 ] = ' \0 ' ; for ( i = 1 ; i <= 8 ; i ++ ) { temp [ i ] = dec_to_hex [ value & 0x0f ] ; value >>= 4 ; } for ( i = 8 ; temp [ i ] == ' ' ; i -- ) { ; } if ( i == 0 ) { i ++ ; } while ( i >= 0 ) { * s ++ = temp [ i -- ] ; } return ; }
convert a number to hex ASCII
convert a number to hex ASCII