diff options
Diffstat (limited to 'src/libc')
| -rw-r--r-- | src/libc/math.c | 32 | ||||
| -rw-r--r-- | src/libc/math.h | 9 | ||||
| -rw-r--r-- | src/libc/stdio.c | 25 | ||||
| -rw-r--r-- | src/libc/stdio.h | 21 | ||||
| -rw-r--r-- | src/libc/string.c | 29 | ||||
| -rw-r--r-- | src/libc/string.h | 9 |
6 files changed, 0 insertions, 125 deletions
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<y) - return x; - return y; -} - -int abs(int x){ - if(x<0) - return -x; - return x; -}
\ No newline at end of file diff --git a/src/libc/math.h b/src/libc/math.h deleted file mode 100644 index 4cc37a9..0000000 --- a/src/libc/math.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef MATH_H -#define MATH_H - -int pow(int x,int n); -int max(int x,int y); -int min(int x,int y); -int abs(int x); - -#endif
\ No newline at end of file diff --git a/src/libc/stdio.c b/src/libc/stdio.c deleted file mode 100644 index 6e0063b..0000000 --- a/src/libc/stdio.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "stdio.h" -#include "string.h" - -extern VIDEO_STATE VS; - -void print(char *str){ - int i=0; - while(str[i]!='\0'){ - putchar(str[i]); - i++; - } -} - -void printc(char* str,VIDEO_COLORS c){ - VIDEO_COLORS backup=VS.fg; - VS.fg=c; - print(str); - VS.fg=backup; -} - -void printi(int i){ - char str[12]; - itoa(i,str); - print(str); -}
\ No newline at end of file diff --git a/src/libc/stdio.h b/src/libc/stdio.h deleted file mode 100644 index d4bd6b6..0000000 --- a/src/libc/stdio.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef STDIO_H -#define STDIO_H - -#include "drivers/framebuffer.h" - -/** - * Print a char* in the framebuffer - */ -void print(char*); - -/** - * Print a char in the framebuffer - */ -void printc(char*,VIDEO_COLORS c); - -/** - * Print an integer using itoa() - */ -void printi(int i); - -#endif
\ No newline at end of file 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 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 |
