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:
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_base.h7
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c2
-rw-r--r--source/blender/blenlib/intern/boxpack2d.c10
-rw-r--r--source/blender/blenlib/intern/freetypefont.c2
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c8
-rw-r--r--source/blender/blenlib/intern/math_geom.c4
-rw-r--r--source/blender/blenlib/intern/math_matrix.c12
-rw-r--r--source/blender/blenlib/intern/pbvh.c10
-rw-r--r--source/blender/blenlib/intern/scanfill.c4
-rw-r--r--source/blender/blenlib/intern/voronoi.c4
10 files changed, 33 insertions, 30 deletions
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 6ee1498c855..2b513cbec41 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -188,8 +188,11 @@ MINLINE float sasqrt(float fac);
MINLINE float interpf(float a, float b, float t);
-MINLINE float minf(float a, float b);
-MINLINE float maxf(float a, float b);
+MINLINE float min_ff(float a, float b);
+MINLINE float max_ff(float a, float b);
+
+MINLINE int min_ii(int a, int b);
+MINLINE int max_ii(int a, int b);
MINLINE float signf(float f);
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 414612dcce5..4dea8022083 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 maxi(1, (leafs + tree_type - 3) / (tree_type - 1) );
+ return max_ii(1, (leafs + tree_type - 3) / (tree_type - 1) );
}
/*
diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c
index 2e9f5c151c5..8a97fdcab67 100644
--- a/source/blender/blenlib/intern/boxpack2d.c
+++ b/source/blender/blenlib/intern/boxpack2d.c
@@ -96,7 +96,7 @@ typedef struct BoxVert {
BOXTOP(b1) - EPSILON <= BOXBOTTOM(b2))
/* compiler should inline */
-static float maxf(const float a, const float b) { return b > a ? b : a; }
+static float max_ff(const float a, const float b) { return b > a ? b : a; }
#if 0
#define BOXDEBUG(b) \
@@ -133,8 +133,8 @@ static int vertex_sort(const void *p1, const void *p2)
v1 = vertarray + ((int *)p1)[0];
v2 = vertarray + ((int *)p2)[0];
- a1 = maxf(v1->x + box_width, v1->y + box_height);
- a2 = maxf(v2->x + box_width, v2->y + box_height);
+ a1 = max_ff(v1->x + box_width, v1->y + box_height);
+ a2 = max_ff(v2->x + box_width, v2->y + box_height);
/* sort largest to smallest */
if (a1 > a2) return 1;
@@ -314,8 +314,8 @@ void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float *
if (!isect) {
/* maintain the total width and height */
- (*tot_width) = maxf(BOXRIGHT(box), (*tot_width));
- (*tot_height) = maxf(BOXTOP(box), (*tot_height));
+ (*tot_width) = max_ff(BOXRIGHT(box), (*tot_width));
+ (*tot_height) = max_ff(BOXTOP(box), (*tot_height));
/* Place the box */
vert->free &= ~quad_flags[j];
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index 018d64b86a7..0a87316aa81 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -271,7 +271,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
(len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001f * 0.0001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002f * 0.0001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) >
- maxf(len_squared_v2v2(bezt->vec[0], bezt->vec[1]),
+ max_ff(len_squared_v2v2(bezt->vec[0], bezt->vec[1]),
len_squared_v2v2(bezt->vec[1], bezt->vec[2]))))
{
bezt->h1 = bezt->h2 = HD_ALIGN;
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 21ecfccf9d9..f27da759482 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -139,20 +139,20 @@ MINLINE int power_of_2_min_i(int n)
return n;
}
-MINLINE float minf(float a, float b)
+MINLINE float min_ff(float a, float b)
{
return (a < b) ? a : b;
}
-MINLINE float maxf(float a, float b)
+MINLINE float max_ff(float a, float b)
{
return (a > b) ? a : b;
}
-MINLINE int mini(int a, int b)
+MINLINE int min_ii(int a, int b)
{
return (a < b) ? a : b;
}
-MINLINE int maxi(int a, int b)
+MINLINE int max_ii(int a, int b)
{
return (b < a) ? a : b;
}
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 122fc8e9f4a..1d59f55a04b 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -404,8 +404,8 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[
if (u > u2) SWAP(float, u, u2);
if (u > 1.0f + eps || u2 < -eps) return -1; /* non-ovlerlapping segments */
- else if (maxf(0.0f, u) == minf(1.0f, u2)) { /* one common point: can return result */
- interp_v2_v2v2(vi, v1, v2, maxf(0, u));
+ else if (max_ff(0.0f, u) == min_ff(1.0f, u2)) { /* one common point: can return result */
+ interp_v2_v2v2(vi, v1, v2, max_ff(0, u));
return 1;
}
}
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 3e19ea4f999..f4a65564fd4 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -1400,7 +1400,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
int m = 4;
int n = 4;
int maxiter = 200;
- int nu = minf(m, n);
+ int nu = min_ff(m, n);
float *work = work1;
float *e = work2;
@@ -1411,14 +1411,14 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
/* Reduce A to bidiagonal form, storing the diagonal elements
* in s and the super-diagonal elements in e. */
- int nct = minf(m - 1, n);
- int nrt = maxf(0, minf(n - 2, m));
+ int nct = min_ff(m - 1, n);
+ int nrt = max_ff(0, min_ff(n - 2, m));
copy_m4_m4(A, A_);
zero_m4(U);
zero_v4(s);
- for (k = 0; k < maxf(nct, nrt); k++) {
+ for (k = 0; k < max_ff(nct, nrt); k++) {
if (k < nct) {
/* Compute the transformation for the k-th column and
@@ -1522,7 +1522,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
/* Set up the final bidiagonal matrix or order p. */
- p = minf(n, m + 1);
+ p = min_ff(n, m + 1);
if (nct < n) {
s[nct] = A[nct][nct];
}
@@ -1714,7 +1714,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
/* Calculate the shift. */
- float scale = maxf(maxf(maxf(maxf(
+ float scale = max_ff(max_ff(max_ff(max_ff(
fabsf(s[p - 1]), fabsf(s[p - 2])), fabsf(e[p - 2])),
fabsf(s[k])), fabsf(e[k]));
float invscale = 1.0f / scale;
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index 2ac84062d0c..7637c60ec16 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -191,8 +191,8 @@ static void BB_expand(BB *bb, float co[3])
{
int i;
for (i = 0; i < 3; ++i) {
- bb->bmin[i] = minf(bb->bmin[i], co[i]);
- bb->bmax[i] = maxf(bb->bmax[i], co[i]);
+ bb->bmin[i] = min_ff(bb->bmin[i], co[i]);
+ bb->bmax[i] = max_ff(bb->bmax[i], co[i]);
}
}
@@ -201,8 +201,8 @@ static void BB_expand_with_bb(BB *bb, BB *bb2)
{
int i;
for (i = 0; i < 3; ++i) {
- bb->bmin[i] = minf(bb->bmin[i], bb2->bmin[i]);
- bb->bmax[i] = maxf(bb->bmax[i], bb2->bmax[i]);
+ bb->bmin[i] = min_ff(bb->bmin[i], bb2->bmin[i]);
+ bb->bmax[i] = max_ff(bb->bmax[i], bb2->bmax[i]);
}
}
@@ -665,7 +665,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 = maxi(LEAF_LIMIT / ((gridsize - 1) * (gridsize - 1)), 1);
+ bvh->leaf_limit = max_ii(LEAF_LIMIT / ((gridsize - 1) * (gridsize - 1)), 1);
BB_reset(&cb);
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 2c5e05197ed..8a5e8c292e4 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -661,8 +661,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
/* this happens with a serial of overlapping edges */
if (v1 == v2 || v2 == v3) break;
/* printf("test verts %x %x %x\n",v1,v2,v3); */
- miny = minf(v1->xy[1], v3->xy[1]);
- /* miny = minf(v1->xy[1],v3->xy[1]); */
+ miny = min_ff(v1->xy[1], v3->xy[1]);
+ /* miny = min_ff(v1->xy[1],v3->xy[1]); */
sc1 = sc + 1;
test = 0;
diff --git a/source/blender/blenlib/intern/voronoi.c b/source/blender/blenlib/intern/voronoi.c
index 3030e54eb78..1a55dd26ce0 100644
--- a/source/blender/blenlib/intern/voronoi.c
+++ b/source/blender/blenlib/intern/voronoi.c
@@ -259,9 +259,9 @@ static float voronoi_getXOfEdge(VoronoiProcess *process, VoronoiParabola *par, f
x2 = (-b - sqrtf(disc)) / (2 * a);
if (p[1] < r[1])
- ry = maxf(x1, x2);
+ ry = max_ff(x1, x2);
else
- ry = minf(x1, x2);
+ ry = min_ff(x1, x2);
return ry;
}