replace log() calls with constants
This commit is contained in:
@@ -1020,7 +1020,7 @@ static void old_mdisps_rotate(int S, int UNUSED(newside), int oldside, int x, in
|
||||
|
||||
static void old_mdisps_convert(MFace *mface, MDisps *mdisp)
|
||||
{
|
||||
int newlvl = log(sqrt(mdisp->totdisp)-1)/log(2);
|
||||
int newlvl = log(sqrt(mdisp->totdisp)-1)/M_LN2;
|
||||
int oldlvl = newlvl+1;
|
||||
int oldside = multires_side_tot[oldlvl];
|
||||
int newside = multires_side_tot[newlvl];
|
||||
|
||||
@@ -1582,7 +1582,7 @@ typedef struct WipeZone {
|
||||
static void precalc_wipe_zone(WipeZone *wipezone, WipeVars *wipe, int xo, int yo)
|
||||
{
|
||||
wipezone->flip = (wipe->angle < 0);
|
||||
wipezone->angle = pow(fabsf(wipe->angle)/45.0f, log(xo)/log(2.0f));
|
||||
wipezone->angle = pow(fabsf(wipe->angle)/45.0f, log(xo)/M_LN2);
|
||||
wipezone->xo = xo;
|
||||
wipezone->yo = yo;
|
||||
wipezone->width = (int)(wipe->edgeWidth*((xo+yo)/2.0f));
|
||||
|
||||
@@ -114,7 +114,7 @@ MINLINE float shell_angle_to_dist(const float angle)
|
||||
/* used for zoom values*/
|
||||
MINLINE float power_of_2(float val)
|
||||
{
|
||||
return (float)pow(2.0, ceil(log((double)val) / log(2.0)));
|
||||
return (float)pow(2.0, ceil(log((double)val) / M_LN2));
|
||||
}
|
||||
|
||||
MINLINE float minf(float a, float b)
|
||||
|
||||
@@ -1733,7 +1733,7 @@ void ui_set_but_default(bContext *C, short all)
|
||||
static double soft_range_round_up(double value, double max)
|
||||
{
|
||||
/* round up to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, .. */
|
||||
double newmax= pow(10.0, ceil(log(value)/log(10.0)));
|
||||
double newmax= pow(10.0, ceil(log(value)/M_LN10));
|
||||
|
||||
if(newmax*0.2 >= max && newmax*0.2 >= value)
|
||||
return newmax*0.2;
|
||||
@@ -1746,7 +1746,7 @@ static double soft_range_round_up(double value, double max)
|
||||
static double soft_range_round_down(double value, double max)
|
||||
{
|
||||
/* round down to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, .. */
|
||||
double newmax= pow(10.0, floor(log(value)/log(10.0)));
|
||||
double newmax= pow(10.0, floor(log(value)/M_LN10));
|
||||
|
||||
if(newmax*5.0 <= max && newmax*5.0 <= value)
|
||||
return newmax*5.0;
|
||||
|
||||
@@ -436,7 +436,7 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb)
|
||||
static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
|
||||
TreeElement *parent, short type, short index);
|
||||
|
||||
#define LOG2I(x) (int)(log(x)/log(2.0))
|
||||
#define LOG2I(x) (int)(log(x)/M_LN2)
|
||||
|
||||
static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, SceneRenderLayer *srl)
|
||||
{
|
||||
|
||||
@@ -460,7 +460,7 @@ void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float
|
||||
vec3opv(sunSky->atm_BetaRM, sunSky->atm_BetaRay, +, sunSky->atm_BetaMie);
|
||||
|
||||
//e^(-(beta_1 + beta_2) * s) = E1
|
||||
vec3opf(E1, sunSky->atm_BetaRM, *, -s/log(2));
|
||||
vec3opf(E1, sunSky->atm_BetaRM, *, -s/M_LN2);
|
||||
E1[0] = exp(E1[0]);
|
||||
E1[1] = exp(E1[1]);
|
||||
E1[2] = exp(E1[2]);
|
||||
|
||||
@@ -397,7 +397,7 @@ void BL_ConvertActuators(char* maggiename,
|
||||
new KX_SoundActuator(gameobj,
|
||||
snd_sound,
|
||||
soundact->volume,
|
||||
(float)(exp((soundact->pitch / 12.0) * log(2.0))),
|
||||
(float)(exp((soundact->pitch / 12.0) * M_LN2)),
|
||||
is3d,
|
||||
settings,
|
||||
soundActuatorType);
|
||||
|
||||
Reference in New Issue
Block a user