diff options
Diffstat (limited to 'lib/string')
-rw-r--r-- | lib/string/itoa.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/string/itoa.c b/lib/string/itoa.c index 3708be2..2db9768 100644 --- a/lib/string/itoa.c +++ b/lib/string/itoa.c @@ -4,18 +4,6 @@ static const char *numbers = "0123456789abcdef"; char * -itoa(char *p, int x, int base) -{ - const bool is_negative = (x < 0); - if (is_negative) x = -x; - - p = utoa(p, x, base); - - if (is_negative) *--p = '-'; - return p; -} - -char * utoa(char *p, unsigned x, int base) { p += 3 * sizeof(unsigned); @@ -28,3 +16,15 @@ utoa(char *p, unsigned x, int base) return p; } + +char * +itoa(char *p, int x, int base) +{ + const bool is_negative = (x < 0); + if (is_negative) x = -x; + + p = utoa(p, x, base); + + if (is_negative) *--p = '-'; + return p; +} |