diff --git a/kinclude/io.c b/kinclude/io.c index 67fce87..1de3eed 100644 --- a/kinclude/io.c +++ b/kinclude/io.c @@ -28,7 +28,7 @@ void dbgln(char* text, int len) /* alphabet for itoa */ char alpha[16] = "0123456789abcdef"; -char* itoa (int value, char* str, int base) +char* itoa(int value, char* str, int base) { if (base > 16 || base < 2) { *str++ = '?'; @@ -42,6 +42,7 @@ char* itoa (int value, char* str, int base) int digits = 0; int num = 0; + // reverse number do { num = num * base; @@ -56,8 +57,7 @@ char* itoa (int value, char* str, int base) value = value / base; *str++ = alpha[num]; digits--; - } - while (digits > 0); + }while (digits > 0); return str; } diff --git a/kinclude/io.h b/kinclude/io.h index 35fe968..c3f0c6d 100644 --- a/kinclude/io.h +++ b/kinclude/io.h @@ -15,7 +15,7 @@ void dbgln(char* text, int len); /* alphabet for itoa */ -char* itoa (int value, char* str, int base); +char* itoa(int value, char* str, int base); // if we don't have a textIO module for debugging #else @@ -24,9 +24,9 @@ char* itoa (int value, char* str, int base); // if we don't have textio, dbgln becomes an empty macro to save on cycles -#define dbgln(a,b) +#define dbgln(a, b) // itoa just evaluates to the passes pointer -#define itoa(a,b,c) b +#define itoa(a, b, c) b #endif #endif