From d9443c7fdf756212bb52ffc934b1166038bc2ad3 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Wed, 21 Apr 2021 12:23:54 +0200 Subject: Refactoring --- src/libc/math.c | 32 -------------------------------- src/libc/math.h | 9 --------- src/libc/stdio.c | 25 ------------------------- src/libc/stdio.h | 21 --------------------- src/libc/string.c | 29 ----------------------------- src/libc/string.h | 9 --------- 6 files changed, 125 deletions(-) delete mode 100644 src/libc/math.c delete mode 100644 src/libc/math.h delete mode 100644 src/libc/stdio.c delete mode 100644 src/libc/stdio.h delete mode 100644 src/libc/string.c delete mode 100644 src/libc/string.h (limited to 'src/libc') diff --git a/src/libc/math.c b/src/libc/math.c deleted file mode 100644 index 80b1d3a..0000000 --- a/src/libc/math.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "math.h" - -int pow(int x,int n){ - if(n<0) - return -1; - else if(n==0) - return 1; - else if(n==1) - return x; - int ret=x; - for(int i=0;i<(n-1);i++) - ret*=x; - return ret; -} - -int max(int x,int y){ - if(x>y) - return x; - return y; -} - -int min(int x,int y){ - if(x=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 diff --git a/src/libc/string.h b/src/libc/string.h deleted file mode 100644 index c3d3614..0000000 --- a/src/libc/string.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef STRING_H -#define STRING_H - -/** - * Convert int to char - */ -void itoa(int i, char *a); - -#endif \ No newline at end of file -- cgit v1.2.3