Architectural Support: x86_64 (#37)
[lunaix-os.git] / lunaix-os / libs / klibc / itoa.c
index cbffd520b1a6f2aac8352f663b67e23795bc82d6..9eaf55bf5c56f4992a373edcbaf066e133364ffd 100644 (file)
@@ -5,12 +5,12 @@
 char base_char[] = "0123456789abcdefghijklmnopqrstuvwxyz";
 
 static char*
-__uitoa_internal(unsigned int value, char* str, int base, unsigned int* size)
+__uitoa_internal(unsigned long value, char* str, int base, unsigned int* size)
 {
     unsigned int ptr = 0;
     do {
         str[ptr] = base_char[value % base];
-        value = value / base;
+        value = value / (unsigned long)base;
         ptr++;
     } while (value);
 
@@ -27,11 +27,11 @@ __uitoa_internal(unsigned int value, char* str, int base, unsigned int* size)
 }
 
 static char*
-__itoa_internal(int value, char* str, int base, unsigned int* size)
+__itoa_internal(long value, char* str, int base, unsigned int* size)
 {
     if (value < 0 && base == 10) {
         str[0] = '-';
-        unsigned int _v = (unsigned int)(-value);
+        unsigned long _v = (unsigned long)(-value);
         __uitoa_internal(_v, str + 1, base, size);
     } else {
         __uitoa_internal(value, str, base, size);
@@ -41,7 +41,7 @@ __itoa_internal(int value, char* str, int base, unsigned int* size)
 }
 
 char*
-itoa(int value, char* str, int base)
+itoa(long value, char* str, int base)
 {
     return __itoa_internal(value, str, base, NULL);
 }
\ No newline at end of file