56,7 → 56,7 |
* @param width Count of digits to print. |
* |
*/ |
static void print_fixed_hex(const __u64 num, const int width) |
static void print_fixed_hex(const uint64_t num, const int width) |
{ |
int i; |
|
75,17 → 75,17 |
* be in range 2 .. 16). |
* |
*/ |
static void print_number(const __native num, const unsigned int base) |
static void print_number(const unative_t num, const unsigned int base) |
{ |
int val = num; |
char d[sizeof(__native) * 8 + 1]; /* this is good enough even for base == 2 */ |
int i = sizeof(__native) * 8 - 1; |
char d[sizeof(unative_t) * 8 + 1]; /* this is good enough even for base == 2 */ |
int i = sizeof(unative_t) * 8 - 1; |
|
do { |
d[i--] = digits[val % base]; |
} while (val /= base); |
|
d[sizeof(__native) * 8] = 0; |
d[sizeof(unative_t) * 8] = 0; |
puts(&d[i + 1]); |
} |
|
182,31 → 182,31 |
case 'P': |
puts("0x"); |
case 'p': |
print_fixed_hex(va_arg(ap, __native), sizeof(__native)); |
print_fixed_hex(va_arg(ap, unative_t), sizeof(unative_t)); |
goto loop; |
|
case 'Q': |
puts("0x"); |
case 'q': |
print_fixed_hex(va_arg(ap, __u64), INT64); |
print_fixed_hex(va_arg(ap, uint64_t), INT64); |
goto loop; |
|
case 'L': |
puts("0x"); |
case 'l': |
print_fixed_hex(va_arg(ap, __native), INT32); |
print_fixed_hex(va_arg(ap, unative_t), INT32); |
goto loop; |
|
case 'W': |
puts("0x"); |
case 'w': |
print_fixed_hex(va_arg(ap, __native), INT16); |
print_fixed_hex(va_arg(ap, unative_t), INT16); |
goto loop; |
|
case 'B': |
puts("0x"); |
case 'b': |
print_fixed_hex(va_arg(ap, __native), INT8); |
print_fixed_hex(va_arg(ap, unative_t), INT8); |
goto loop; |
|
/* |
213,13 → 213,13 |
* Decimal and hexadecimal conversions. |
*/ |
case 'd': |
print_number(va_arg(ap, __native), 10); |
print_number(va_arg(ap, unative_t), 10); |
goto loop; |
|
case 'X': |
puts("0x"); |
case 'x': |
print_number(va_arg(ap, __native), 16); |
print_number(va_arg(ap, unative_t), 16); |
goto loop; |
|
/* |