From f6323421e22c3585c58b54658a11e1e4706cc8fa Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 9 Apr 2021 10:29:23 +0200 Subject: Cleaning code and provide minimal libc --- src/libc/math.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/libc/math.c (limited to 'src/libc/math.c') diff --git a/src/libc/math.c b/src/libc/math.c new file mode 100644 index 0000000..2051dc1 --- /dev/null +++ b/src/libc/math.c @@ -0,0 +1,14 @@ +#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; +} \ No newline at end of file -- cgit v1.2.3