Changeset 658 for libcaca/trunk


Ignore:
Timestamp:
Mar 22, 2006, 2:15:08 PM (15 years ago)
Author:
Sam Hocevar
Message:
  • Got rid of cucul_powf(), too complex to implement and no longer used.
Location:
libcaca/trunk/cucul
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cucul/cucul.h

    r653 r658  
    177177int cucul_rand(int, int);
    178178unsigned int cucul_sqrt(unsigned int);
    179 float cucul_powf(float x, float y);
    180179/*  @} */
    181180
  • libcaca/trunk/cucul/math.c

    r656 r658  
    2626#include "cucul.h"
    2727#include "cucul_internals.h"
     28
     29static float powf_internal(float x, float y);
    2830
    2931/**
     
    7173}
    7274
    73 /**
    74  * \brief powf substitute (x^y)
    75  * \param x The value to be raised
    76  * \param y The power to raise x to (only works with integers)
    77  * \return \p x raised to the power of \p y
    78  */
    79 float cucul_powf(float x, float y)
    80 {
    81 #ifdef __i386__
    82     /* FIXME: this can be optimised by directly calling fyl2x for x and y */
    83     register double logx;
    84     register long double v, e;
    85 
    86     asm volatile("fldln2; fxch; fyl2x"
    87                  : "=t" (logx) : "0" (x) : "st(1)");
    88 
    89     asm volatile("fldl2e\n\t"
    90                  "fmul %%st(1)\n\t"
    91                  "fst %%st(1)\n\t"
    92                  "frndint\n\t"
    93                  "fxch\n\t"
    94                  "fsub %%st(1)\n\t"
    95                  "f2xm1\n\t"
    96                  : "=t" (v), "=u" (e) : "0" (y * logx));
    97     v += 1.0;
    98     asm volatile("fscale"
    99                  : "=t" (v) : "0" (v), "u" (e));
    100 
    101     return v;
    102 #else
    103     return x; /* HAHAHA VIEUX PORC */
    104 #endif
    105 }
Note: See TracChangeset for help on using the changeset viewer.