Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-29 22:14:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-29 22:14:20 +0400
commit7217927414407f8929a02c610fb06e61c0bff930 (patch)
treee1b473aa26d01cdf9f0f7597c8ac255be56362de /source/blender/blenlib
parentf608b3c44402ef5c58217481d93e7fa83c9cd7cf (diff)
add inline functions for max/min ints, good to use when the arguments are function calls (we had a few of these).
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c2
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c10
-rw-r--r--source/blender/blenlib/intern/pbvh.c2
3 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 9a2b94b2c7e..2b3c314131b 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -648,7 +648,7 @@ static int implicit_leafs_index(BVHBuildHelper *data, int depth, int child_index
// This functions returns the number of branches needed to have the requested number of leafs.
static int implicit_needed_branches(int tree_type, int leafs)
{
- return MAX2(1, (leafs + tree_type - 3) / (tree_type - 1) );
+ return maxi(1, (leafs + tree_type - 3) / (tree_type - 1) );
}
/*
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index b2d5392c596..97fc431d8fa 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -143,12 +143,20 @@ MINLINE float minf(float a, float b)
{
return (a < b) ? a : b;
}
-
MINLINE float maxf(float a, float b)
{
return (a > b) ? a : b;
}
+MINLINE int mini(int a, int b)
+{
+ return (a < b) ? a : b;
+}
+MINLINE int maxi(int a, int b)
+{
+ return (b < a) ? a : b;
+}
+
MINLINE float signf(float f)
{
return (f < 0.f) ? -1.f : 1.f;
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index 9b05f0fc976..b4b546d9167 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -663,7 +663,7 @@ void BLI_pbvh_build_grids(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj,
bvh->totgrid = totgrid;
bvh->gridkey = *key;
bvh->grid_hidden = grid_hidden;
- bvh->leaf_limit = MAX2(LEAF_LIMIT / ((gridsize - 1) * (gridsize - 1)), 1);
+ bvh->leaf_limit = maxi(LEAF_LIMIT / ((gridsize - 1) * (gridsize - 1)), 1);
BB_reset(&cb);