Subversion Repositories HelenOS-historic

Rev

Rev 66 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 66 Rev 68
Line 44... Line 44...
44
 * @param str Characters to print.
44
 * @param str Characters to print.
45
 *
45
 *
46
 */
46
 */
47
void print_str(const char *str)
47
void print_str(const char *str)
48
{
48
{
49
        int i = 0;
49
    int i = 0;
50
    char c;
50
    char c;
51
   
51
   
52
    while (c = str[i++])
52
    while (c = str[i++])
53
        putchar(c);
53
        putchar(c);
54
}
54
}
55
 
55
 
56
 
56
 
57
/** Print hexadecimal digits
57
/** Print hexadecimal digits
58
 *
58
 *
Line 82... Line 82...
82
 * @param num  Number to print.
82
 * @param num  Number to print.
83
 * @param base Base to print the number in (should
83
 * @param base Base to print the number in (should
84
 *             be in range 2 .. 16).
84
 *             be in range 2 .. 16).
85
 *
85
 *
86
 */
86
 */
87
void print_number(const __native num, const int base)
87
void print_number(const __native num, const unsigned int base)
88
{
88
{
89
    int val = num;
89
    int val = num;
90
    char d[sizeof(__native)*8+1];       /* this is good enough even for base == 2 */
90
    char d[sizeof(__native)*8+1];       /* this is good enough even for base == 2 */
91
        int i = sizeof(__native)*8-1;
91
    int i = sizeof(__native)*8-1;
92
   
92
   
93
    do {
93
    do {
94
        d[i--] = digits[val % base];
94
        d[i--] = digits[val % base];
95
    } while (val /= base);
95
    } while (val /= base);
96
   
96
   
97
    d[sizeof(__native)*8] = 0; 
97
    d[sizeof(__native)*8] = 0;