diff options
-rw-r--r-- | src/common.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/common.c b/src/common.c index 7cbdc3e..81f5641 100644 --- a/src/common.c +++ b/src/common.c @@ -64,27 +64,8 @@ int itoc(int num, char* out) { while(count >= 0) { int n = num%10; - if(n == 0) { - out[count] = '0'; - } else if(n == 1) { - out[count] = '1'; - } else if(n == 2) { - out[count] = '2'; - } else if(n == 3) { - out[count] = '3'; - } else if(n == 4) { - out[count] = '4'; - } else if(n == 5) { - out[count] = '5'; - } else if(n == 6) { - out[count] = '6'; - } else if(n == 7) { - out[count] = '7'; - } else if(n == 8) { - out[count] = '8'; - } else if(n == 9) { - out[count] = '9'; - } + // Add 48 to the int to get its char equivelant ascii index + out[count] = n + 48; num /= 10; count--; |