From: John Hodge Date: Sun, 9 Mar 2014 07:28:26 +0000 (+0800) Subject: Usermode/libm - Wrap builtin log X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=b0fc087fa1c73d0a36fd6130dbfba5e4c98ff617;p=tpg%2Facess2.git Usermode/libm - Wrap builtin log --- diff --git a/Usermode/Libraries/libm.so_src/include_exp/math.h b/Usermode/Libraries/libm.so_src/include_exp/math.h index 349547ed..d6d988f2 100644 --- a/Usermode/Libraries/libm.so_src/include_exp/math.h +++ b/Usermode/Libraries/libm.so_src/include_exp/math.h @@ -8,6 +8,16 @@ #ifndef _LIBM__MATH_H_ #define _LIBM__MATH_H_ +#ifdef __cplusplus +extern "C" { +#endif + extern double pow(double x, double y); +extern double exp(double x); +extern double log(double val); + +#ifdef __cplusplus +} +#endif #endif diff --git a/Usermode/Libraries/libm.so_src/pow.c b/Usermode/Libraries/libm.so_src/pow.c index f35d7c25..d968ca89 100644 --- a/Usermode/Libraries/libm.so_src/pow.c +++ b/Usermode/Libraries/libm.so_src/pow.c @@ -16,3 +16,17 @@ double pow(double x, double y) return 1.0f; return __builtin_pow(x,y); } + +double exp(double y) +{ + if( y == 0.0f ) + return 1.0f; + return __builtin_exp(y); +} + +double log(double n) +{ + if(n == 1.0f) + return 0.0f; + return __builtin_log(n); +}