diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-11-29 19:49:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-11-29 19:49:38 +0300 |
commit | 1cb59394ae69148904de34a32d09319f02c86a09 (patch) | |
tree | 46938c37114753afda7dd9caa31a4943e7969ead /source/blender/blenlib | |
parent | 46d2b6cd0b11de899f13c1acf17d158eb8c192a6 (diff) |
Cleanup: use const, avoid float -> double in matrix invert
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 2da1f225034..8f9fcbc252c 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -848,9 +848,10 @@ bool invert_m4_m4(float inverse[4][4], float mat[4][4]) } } - temp = tempmat[i][i]; - if (temp == 0) - return 0; /* No non-zero pivot */ + if (UNLIKELY(tempmat[i][i] == 0.0f)) { + return false; /* No non-zero pivot */ + } + temp = (double)tempmat[i][i]; for (k = 0; k < 4; k++) { tempmat[i][k] = (float)((double)tempmat[i][k] / temp); inverse[i][k] = (float)((double)inverse[i][k] / temp); |