From c5f841bb96b3b60a705a2a83ed8ffdfd7951a9e0 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 22 Mar 2006 13:15:08 +0000 Subject: [PATCH] * Got rid of cucul_powf(), too complex to implement and no longer used. --- cucul/cucul.h | 1 - cucul/math.c | 35 ++--------------------------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/cucul/cucul.h b/cucul/cucul.h index fda0a90..693d641 100644 --- a/cucul/cucul.h +++ b/cucul/cucul.h @@ -176,7 +176,6 @@ void cucul_fill_triangle(cucul_t *, int, int, int, int, int, int, char); * @{ */ int cucul_rand(int, int); unsigned int cucul_sqrt(unsigned int); -float cucul_powf(float x, float y); /* @} */ /** \defgroup sprite Sprite handling diff --git a/cucul/math.c b/cucul/math.c index 3bedccb..fd51c1b 100644 --- a/cucul/math.c +++ b/cucul/math.c @@ -26,6 +26,8 @@ #include "cucul.h" #include "cucul_internals.h" +static float powf_internal(float x, float y); + /** * \brief Generate a random integer within a range. * @@ -70,36 +72,3 @@ unsigned int cucul_sqrt(unsigned int a) return 2 * cucul_sqrt(a / 4); } -/** - * \brief powf substitute (x^y) - * \param x The value to be raised - * \param y The power to raise x to (only works with integers) - * \return \p x raised to the power of \p y - */ -float cucul_powf(float x, float y) -{ -#ifdef __i386__ - /* FIXME: this can be optimised by directly calling fyl2x for x and y */ - register double logx; - register long double v, e; - - asm volatile("fldln2; fxch; fyl2x" - : "=t" (logx) : "0" (x) : "st(1)"); - - asm volatile("fldl2e\n\t" - "fmul %%st(1)\n\t" - "fst %%st(1)\n\t" - "frndint\n\t" - "fxch\n\t" - "fsub %%st(1)\n\t" - "f2xm1\n\t" - : "=t" (v), "=u" (e) : "0" (y * logx)); - v += 1.0; - asm volatile("fscale" - : "=t" (v) : "0" (v), "u" (e)); - - return v; -#else - return x; /* HAHAHA VIEUX PORC */ -#endif -}