From: John Hodge Date: Sat, 8 Jun 2013 09:37:33 +0000 (+0800) Subject: Usermode/libm - Stubbed up a quick libm (using gcc builtins) X-Git-Tag: rel0.15~447 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=e5624832d0c6535be32fb0452c4ce8e8637b0ad4;p=tpg%2Facess2.git Usermode/libm - Stubbed up a quick libm (using gcc builtins) --- diff --git a/Usermode/Libraries/libm.so_src/Makefile b/Usermode/Libraries/libm.so_src/Makefile new file mode 100644 index 00000000..1c6df334 --- /dev/null +++ b/Usermode/Libraries/libm.so_src/Makefile @@ -0,0 +1,17 @@ +# +# Acess2 C Library (Math) +# - By John Hodge (thePowersGang) +# + +-include ../Makefile.cfg + +CPPFLAGS += +CFLAGS += -Werror -Wextra +ASFLAGS += +LDFLAGS += + +OBJ = stub.o pow.o +BIN := libm.so + +include ../Makefile.tpl + diff --git a/Usermode/Libraries/libm.so_src/include_exp/math.h b/Usermode/Libraries/libm.so_src/include_exp/math.h new file mode 100644 index 00000000..349547ed --- /dev/null +++ b/Usermode/Libraries/libm.so_src/include_exp/math.h @@ -0,0 +1,13 @@ +/* + * Acess2 C Library (Maths) + * - By John Hodge (thePowersGang) + * + * math.h + * - C99 Header + */ +#ifndef _LIBM__MATH_H_ +#define _LIBM__MATH_H_ + +extern double pow(double x, double y); + +#endif diff --git a/Usermode/Libraries/libm.so_src/pow.c b/Usermode/Libraries/libm.so_src/pow.c new file mode 100644 index 00000000..f35d7c25 --- /dev/null +++ b/Usermode/Libraries/libm.so_src/pow.c @@ -0,0 +1,18 @@ +/* + * Acess2 C Library (Maths) + * - By John Hodge (thePowersGang) + * + * pow.c + * - pow(), powf() and powl() + */ +#include + +// === CODE === +double pow(double x, double y) +{ + if( x == 1.0f ) + return 1.0f; + if( y == 0.0f ) + return 1.0f; + return __builtin_pow(x,y); +} diff --git a/Usermode/Libraries/libm.so_src/stub.c b/Usermode/Libraries/libm.so_src/stub.c new file mode 100644 index 00000000..1c6c52a8 --- /dev/null +++ b/Usermode/Libraries/libm.so_src/stub.c @@ -0,0 +1,14 @@ +/* + * Acess2 C Library (Maths) + * - By John Hodge (thePowersGang) + * + * stub.c + * - Provides SoMain (unused) + */ + +// === CODE === +int SoMain(void) +{ + return 0; +} +