fix: kprintf unsigned int

This commit is contained in:
Starnakin 2024-10-09 15:33:46 +02:00
parent 599de25eec
commit a4411b0581
2 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@
#include <stdarg.h>
#include <stdint.h>
int print_int_base(int32_t number, const char *prefix, const char *base);
int print_int_base(int64_t number, const char *prefix, const char *base);
static int get_level(const char *str)
{
@ -20,17 +20,17 @@ static int print_flag(char flag, va_list *ap)
case '%':
return terminal_putchar('%');
case 'i':
return print_int_base(va_arg(*ap, int), NULL, BASE_DECA);
return print_int_base(va_arg(*ap, int32_t), NULL, BASE_DECA);
case 'd':
return print_int_base(va_arg(*ap, int), NULL, BASE_DECA);
return print_int_base(va_arg(*ap, int32_t), NULL, BASE_DECA);
case 'c':
return terminal_putchar(va_arg(*ap, int));
case 's':
return terminal_writestring(va_arg(*ap, char *));
case 'p':
return print_int_base(va_arg(*ap, int), "0x", BASE_HEXA);
return print_int_base(va_arg(*ap, uint32_t), "0x", BASE_HEXA);
case 'x':
return print_int_base(va_arg(*ap, int), "0x", BASE_HEXA);
return print_int_base(va_arg(*ap, int32_t), "0x", BASE_HEXA);
case 'u':
return print_int_base(va_arg(*ap, uint32_t), NULL, BASE_DECA);
}

View File

@ -3,7 +3,7 @@
#include "string.h"
#include "terminal.h"
int print_int_base(int32_t number, const char *prefix, const char *base)
int print_int_base(int64_t number, const char *prefix, const char *base)
{
const int base_size = strlen(base);
uint64_t div = 1;