From 9f16b032d38613ca95e321e1d1e652c43129c68b Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 15 Aug 2020 17:42:36 +0200 Subject: Added libgui --- libc/math.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 libc/math.c (limited to 'libc/math.c') diff --git a/libc/math.c b/libc/math.c new file mode 100644 index 0000000..9cd9cea --- /dev/null +++ b/libc/math.c @@ -0,0 +1,15 @@ +// MIT License, Copyright (c) 2020 Marvin Borner + +int pow(int base, int exp) +{ + if (exp < 0) + return 0; + + if (!exp) + return 1; + + int ret = base; + for (int i = 1; i < exp; i++) + ret *= base; + return ret; +} -- cgit v1.2.3