aboutsummaryrefslogtreecommitdiff
path: root/src/libc/string.c
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-04-21 12:23:54 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-04-21 12:23:54 +0200
commitd9443c7fdf756212bb52ffc934b1166038bc2ad3 (patch)
treecf31082457e159a7de9a5bb04f15edc598afddf5 /src/libc/string.c
parentca1e725b0dc9b10997897dd2ac6d44028601d9bb (diff)
Refactoring
Diffstat (limited to 'src/libc/string.c')
-rw-r--r--src/libc/string.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/libc/string.c b/src/libc/string.c
deleted file mode 100644
index 93a9e63..0000000
--- a/src/libc/string.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "string.h"
-#include "math.h"
-
-void itoa(int i, char *a){
- // Check if lower than 0
- char neg=0;
- if(i<0){
- neg=1;
- i=-i;
- a[0]='-';
- }
-
- // Count number of digits
- int len=1;
- while(i/pow(10,len)>=1)
- {
- len++;
- }
-
- // Build string
- int max_pow=len-1;
- for(int j=0;j<=max_pow;j++){
- int cur_pow=pow(10,max_pow-j);
- char digit=i/cur_pow;
- a[j+neg]='0'+digit;
- i=i-digit*cur_pow; // Remove first digits (most significant)
- }
- a[len+neg]='\0';
-} \ No newline at end of file