From 45a5ecc72d8e700614a0751f0e7ec68199885b77 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 29 May 2020 23:47:29 +0200 Subject: Added more printf features --- src/kernel/lib/stdlib/itoa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/kernel/lib/stdlib') diff --git a/src/kernel/lib/stdlib/itoa.c b/src/kernel/lib/stdlib/itoa.c index 2d2243a..b15befd 100644 --- a/src/kernel/lib/stdlib/itoa.c +++ b/src/kernel/lib/stdlib/itoa.c @@ -44,7 +44,7 @@ char *itoa(int n) } // TODO: Rename itoa_base -char *itoa_base(int value, char *result, int base) +char *itoa_base(int value, char *result, int base, int is_signed) { if (base < 2 || base > 36) { *result = '\0'; @@ -61,7 +61,7 @@ char *itoa_base(int value, char *result, int base) [35 + (tmp_value - value * base)]; } while (value); - if (tmp_value < 0) + if (is_signed && tmp_value < 0) *ptr++ = '-'; *ptr-- = '\0'; while (ptr1 < ptr) { -- cgit v1.2.3