Cleanup: use swap math funcs
authorCampbell Barton <ideasman42@gmail.com>
Wed, 1 Jul 2015 06:02:30 +0000 (16:02 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 1 Jul 2015 06:02:30 +0000 (16:02 +1000)
source/blender/blenkernel/intern/fcurve.c
source/blender/editors/armature/armature_edit.c
source/blender/render/intern/source/occlusion.c

index 6e58513e38ef2e375f2f3878ba07d09883f73fe1..09fbf392590ae18c266b575262fb0439982fec6e 100644 (file)
@@ -986,15 +986,12 @@ void sort_time_fcurve(FCurve *fcu)
                                        /* if either one of both of the points exceeds crosses over the keyframe time... */
                                        if ( (bezt->vec[0][0] > bezt->vec[1][0]) && (bezt->vec[2][0] < bezt->vec[1][0]) ) {
                                                /* swap handles if they have switched sides for some reason */
-                                               SWAP(float, bezt->vec[0][0], bezt->vec[2][0]);
-                                               SWAP(float, bezt->vec[0][1], bezt->vec[2][1]);
+                                               swap_v2_v2(bezt->vec[0], bezt->vec[2]);
                                        }
                                        else {
                                                /* clamp handles */
-                                               if (bezt->vec[0][0] > bezt->vec[1][0]) 
-                                                       bezt->vec[0][0] = bezt->vec[1][0];
-                                               if (bezt->vec[2][0] < bezt->vec[1][0]) 
-                                                       bezt->vec[2][0] = bezt->vec[1][0];
+                                               CLAMP_MAX(bezt->vec[0][0], bezt->vec[1][0]);
+                                               CLAMP_MIN(bezt->vec[2][0], bezt->vec[1][0]);
                                        }
                                }
                        }
index b3297db61763bb20c99ae7122ad6a0b49f4a49ec..1b9a09bd2c552e6076476884840bf3bfa2925ab2 100644 (file)
@@ -988,9 +988,7 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
                                /* only if selected and editable */
                                if (EBONE_VISIBLE(arm, ebo) && EBONE_EDITABLE(ebo)) {
                                        /* swap head and tail coordinates */
-                                       SWAP(float, ebo->head[0], ebo->tail[0]);
-                                       SWAP(float, ebo->head[1], ebo->tail[1]);
-                                       SWAP(float, ebo->head[2], ebo->tail[2]);
+                                       swap_v3_v3(ebo->head, ebo->tail);
                                        
                                        /* do parent swapping:
                                         *      - use 'child' as new parent
index f55dde588cb43594a88f9ecde67fe7cee512e14c..d5a45bd1126562120517c345e3431de21d63b56b 100644 (file)
@@ -474,9 +474,7 @@ static void occ_build_split(OcclusionTree *tree, int begin, int end, int *split)
                if (tree->co[a][axis] > mid) {
                        enda--;
                        SWAP(OccFace, tree->face[a], tree->face[enda]);
-                       SWAP(float, tree->co[a][0], tree->co[enda][0]);
-                       SWAP(float, tree->co[a][1], tree->co[enda][1]);
-                       SWAP(float, tree->co[a][2], tree->co[enda][2]);
+                       swap_v3_v3(tree->co[a], tree->co[enda]);
                }
                else
                        a++;