From f3d13bec6dbacbf2ddfba034776175cf78d628b0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 4 Dec 2013 09:23:29 +1100 Subject: Code Cleanup: correct fabsf/fabs/abs use --- source/blender/blenlib/BLI_math_vector.h | 1 + source/blender/blenlib/intern/math_matrix.c | 4 ++-- source/blender/blenlib/intern/math_vector_inline.c | 5 +++++ source/blender/editors/screen/area.c | 4 ++-- source/blender/render/intern/source/shadeoutput.c | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 14445173ae6..21bafef8678 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -144,6 +144,7 @@ MINLINE void negate_v3_short(short r[3]); MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT; +MINLINE float dot_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT; MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]); diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 1f52caac8e9..5b1f924fd92 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -988,7 +988,7 @@ bool is_orthogonal_m4(float m[4][4]) for (i = 0; i < 4; i++) { for (j = 0; j < i; j++) { - if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON) + if (fabsf(dot_v4v4(m[i], m[j])) > 1.5f * FLT_EPSILON) return 0; } @@ -1018,7 +1018,7 @@ bool is_orthonormal_m4(float m[4][4]) int i; for (i = 0; i < 4; i++) - if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON) + if (fabsf(dot_v4v4(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON) return 0; return 1; diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index cdbbcc5e025..05be8bda709 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -595,6 +595,11 @@ MINLINE float dot_v3v3(const float a[3], const float b[3]) return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } +MINLINE float dot_v4v4(const float a[4], const float b[4]) +{ + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; +} + MINLINE float cross_v2v2(const float a[2], const float b[2]) { return a[0] * b[1] - a[1] * b[0]; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 8b89c2f0553..2caf318379b 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -160,8 +160,8 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) int dx = x2 - x1; int dy = y2 - y1; - dx = copysign(ceilf(0.3f * fabsf(dx)), dx); - dy = copysign(ceilf(0.3f * fabsf(dy)), dy); + dx = copysign(ceilf(0.3f * abs(dx)), dx); + dy = copysign(ceilf(0.3f * abs(dy)), dy); glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 40a5a5d9a05..6cb34a67f45 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -228,7 +228,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) maxz*= lar->sh_zfac; maxy= lar->imat[0][1]*p1[0]+lar->imat[1][1]*p1[1]+lar->imat[2][1]*p1[2]; - if (fabsf(nray[2]) < FLT_EPSILON) { + if (fabs(nray[2]) < FLT_EPSILON) { use_yco = TRUE; } } -- cgit v1.2.3