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 <stdarg.h>
#include <stdint.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) static int get_level(const char *str)
{ {
@ -20,17 +20,17 @@ static int print_flag(char flag, va_list *ap)
case '%': case '%':
return terminal_putchar('%'); return terminal_putchar('%');
case 'i': 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': 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': case 'c':
return terminal_putchar(va_arg(*ap, int)); return terminal_putchar(va_arg(*ap, int));
case 's': case 's':
return terminal_writestring(va_arg(*ap, char *)); return terminal_writestring(va_arg(*ap, char *));
case 'p': 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': 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': case 'u':
return print_int_base(va_arg(*ap, uint32_t), NULL, BASE_DECA); return print_int_base(va_arg(*ap, uint32_t), NULL, BASE_DECA);
} }

View File

@ -3,7 +3,7 @@
#include "string.h" #include "string.h"
#include "terminal.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); const int base_size = strlen(base);
uint64_t div = 1; uint64_t div = 1;