replace MIN2 / MAX2 with minf / maxf to avoid calling functions multiple times.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 19 Feb 2012 05:11:24 +0000 (05:11 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 19 Feb 2012 05:11:24 +0000 (05:11 +0000)
source/blender/blenkernel/intern/seqeffects.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/transform/transform.c
source/blender/gpu/intern/gpu_material.c
source/blender/render/intern/source/pixelshading.c
source/blender/render/intern/source/shadeoutput.c
source/creator/creator.c

index 9edcc7a73e88dcaf4477b4cebab898e76b8c13f5..d88a5c26c2ce235728c149980b5257d20151ddb1 100644 (file)
@@ -1697,7 +1697,7 @@ float hyp3,hyp4,b4,b5
                                hyp2 = fabsf(angle*x+y+(-(yo-posy*0.5f)-angle*(xo-posx*0.5f)))*wipezone->pythangle;
                        }
 
-                       hwidth= MIN2(hwidth, fabsf(b3-b1)/2.0f);
+                       hwidth = minf(hwidth, fabsf(b3-b1)/2.0f);
 
                        if(b2 < b1 && b2 < b3 ){
                                output = in_band(hwidth,hyp,0,1);
index dbf03e34c32c0ec839fa8d2dbda778e8cfd882ea..ceba6755821e9dc312c2532194cfa2ca9c0f92e0 100644 (file)
@@ -3472,7 +3472,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
                view3d_operator_needs_opengl(C);
                selected= (short)count_selected_keys(scene, edit);
 
-               dmax = MAX2(fabs(dx), fabs(dy));
+               dmax = maxf(fabsf(dx), fabsf(dy));
                tot_steps = dmax/(0.2f * brush->size) + 1;
 
                dx /= (float)tot_steps;
index 9d368476f03ebb9d8cdd21d8fffa7ee78fb13eb5..8749328c4546ae52bcce32364fcb05715f1b3fd1 100644 (file)
@@ -4881,8 +4881,8 @@ static int doEdgeSlide(TransInfo *t, float perc)
        upVert = editedge_getOtherVert(tempsv->up, centerVert);
        downVert = editedge_getOtherVert(tempsv->down, centerVert);
 
-       len = MIN2(perc, len_v3v3(upVert->co,downVert->co));
-       len = MAX2(len, 0);
+       len = minf(perc, len_v3v3(upVert->co, downVert->co));
+       len = maxf(len, 0.0f);
 
        //Adjust Edgeloop
        if(prop) {
index ef2abb20cf3b1a199aae00c6dc3ee082977bb666..0ddaf07c67ee91bc28d9df4e93fbc8f29f40b1b1 100644 (file)
@@ -1071,7 +1071,7 @@ static void do_material_tex(GPUShadeInput *shi)
                                                else
                                                        newnor = tnor;
                                                
-                                               norfac = MIN2(fabsf(mtex->norfac), 1.0f);
+                                               norfac = minf(fabsf(mtex->norfac), 1.0f);
                                                
                                                if(norfac == 1.0f && !GPU_link_changed(stencil)) {
                                                        shi->vn = newnor;
index 24683ec57f77dff8e2e1eedab84877a25c0b841a..9746a6dbd86cd858cf9399a3f687abe4e45744f2 100644 (file)
@@ -161,7 +161,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
                                        copy_v3_v3(lvrot, lv);
                                        mul_m3_v3(lar->imat, lvrot);
                                        
-                                       x= MAX2(fabs(lvrot[0]/lvrot[2]) , fabs(lvrot[1]/lvrot[2]));
+                                       x = maxf(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
                                        /* 1.0/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */
                                        
                                        inpr= 1.0/(sqrt(1.0f+x*x));
index 2f620bb96d43692286f28f0d1d2bae95f79d6626..78420aa6ca8153f7f221ff31be8bb3121bf0673d 100644 (file)
@@ -1204,7 +1204,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
                                                        copy_v3_v3(lvrot, lv);
                                                        mul_m3_v3(lar->imat, lvrot);
                                                        
-                                                       x= MAX2(fabs(lvrot[0]/lvrot[2]) , fabs(lvrot[1]/lvrot[2]));
+                                                       x = maxf(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
                                                        /* 1.0f/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */
                                                        
                                                        inpr= 1.0f/(sqrt(1.0f+x*x));
index 68a7bc415a8e9fdaaad82044b92593056fd95527..0b67dfabf16fb74eaf48474834a9800c93d8f362 100644 (file)
@@ -727,7 +727,7 @@ static int render_frame(int argc, const char **argv, void *data)
 
                        BKE_reports_init(&reports, RPT_PRINT);
 
-                       frame = MIN2(MAXFRAME, MAX2(MINAFRAME, frame));
+                       frame = CLAMPIS(frame, MINAFRAME, MAXFRAME);
 
                        RE_SetReports(re, &reports);
                        RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, frame, frame, scene->r.frame_step);