Changeset 495


Ignore:
Timestamp:
Jul 13, 2005, 7:45:47 PM (16 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • src/math.c src/bitmap.c src/caca.h Removed powf call, added caca_powf, to remove libm depencies and problems on old compilers/linkers.
Location:
libcaca/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/src/bitmap.c

    r464 r495  
    4646#include <limits.h>
    4747#include <string.h>
    48 #include <math.h>
    4948
    5049#include "caca.h"
     
    339338
    340339    for(i = 0; i < 4096; i++)
    341         bitmap->gammatab[i] = 4096.0 * powf((float)i / 4096.0, 1.0 / gammaval);
     340        bitmap->gammatab[i] = 4096.0 * caca_powf((float)i / 4096.0, 1.0 / gammaval);
    342341}
    343342
  • libcaca/trunk/src/caca.h

    r487 r495  
    318318int caca_rand(int, int);
    319319unsigned int caca_sqrt(unsigned int);
     320float caca_powf(float x, float y);
    320321/*  @} */
    321322
  • libcaca/trunk/src/math.c

    r298 r495  
    7979}
    8080
     81
     82/**
     83 * \brief powf substitute (x^y)
     84 * \param x The value to be raised
     85 * \param y The power to raise x of.
     86 * \return \p x raised to the power of \p y
     87 */
     88
     89float caca_powf(float x, float y)
     90{
     91    int i=((int)y);
     92    float r=x;
     93
     94    if(((int)y)==1 || ((int)x)==1)
     95        return x;
     96
     97    i--;
     98    while(i--)
     99    {
     100        r*=x;
     101    }
     102    return r;
     103}
Note: See TracChangeset for help on using the changeset viewer.