diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-13 18:09:43 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-13 18:09:43 +0200 |
| commit | e1e75aa387b1bc2b80df1895131fa9d446bba9ac (patch) | |
| tree | 12b5a3b412ab4d4c6a24ea894025d6dbf65b8ac1 /src/libc | |
| parent | 5a9a57177f730d1c00ab2b47f91e5ea2660a4f77 (diff) | |
Cleaning code
Diffstat (limited to 'src/libc')
| -rw-r--r-- | src/libc/math.c | 18 | ||||
| -rw-r--r-- | src/libc/math.h | 4 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/libc/math.c b/src/libc/math.c index 2051dc1..80b1d3a 100644 --- a/src/libc/math.c +++ b/src/libc/math.c @@ -11,4 +11,22 @@ int pow(int x,int n){ 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 index 56f1788..9f9bd58 100644 --- a/src/libc/math.h +++ b/src/libc/math.h @@ -2,5 +2,7 @@ #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 |
