aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/lib/stdlib/itoa.c
diff options
context:
space:
mode:
authorMarvin Borner2020-05-29 23:47:29 +0200
committerMarvin Borner2020-05-29 23:47:29 +0200
commit45a5ecc72d8e700614a0751f0e7ec68199885b77 (patch)
tree7da3053bd5a2b5ced5a4605e18ab4e921f65bc70 /src/kernel/lib/stdlib/itoa.c
parentdf7637951f705fb2e2192510ab276e2289fd6cec (diff)
Added more printf features
Diffstat (limited to 'src/kernel/lib/stdlib/itoa.c')
-rw-r--r--src/kernel/lib/stdlib/itoa.c4
1 files changed, 2 insertions, 2 deletions
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) {