diff --git a/include/osg/Matrixd b/include/osg/Matrixd index 80b0540fc..6b4dfc426 100644 --- a/include/osg/Matrixd +++ b/include/osg/Matrixd @@ -200,10 +200,8 @@ class OSG_EXPORT Matrixd /** invert the matrix rhs, automatically select invert_4x3 or invert_4x4. */ inline bool invert( const Matrixd& rhs) { - if (rhs._mat[0][3]==0.0 && rhs._mat[1][3]==0.0 && rhs._mat[2][3]==0.0 && rhs._mat[3][3]==1.0) - return invert_4x3(rhs); - else - return invert_4x4(rhs); + bool is_4x3 = (rhs._mat[0][3]==0.0 && rhs._mat[1][3]==0.0 && rhs._mat[2][3]==0.0 && rhs._mat[3][3]==1.0); + return is_4x3 ? invert_4x3(rhs) : invert_4x4(rhs); } /** 4x3 matrix invert, not right hand column is assumed to be 0,0,0,1. */ diff --git a/include/osg/Matrixf b/include/osg/Matrixf index 19342948d..b68f5301a 100644 --- a/include/osg/Matrixf +++ b/include/osg/Matrixf @@ -200,10 +200,8 @@ class OSG_EXPORT Matrixf /** invert the matrix rhs, automatically select invert_4x3 or invert_4x4. */ inline bool invert( const Matrixf& rhs) { - if (rhs._mat[0][3]==0.0 && rhs._mat[1][3]==0.0 && rhs._mat[2][3]==0.0 && rhs._mat[3][3]==1.0) - return invert_4x3(rhs); - else - return invert_4x4(rhs); + bool is_4x3 = (rhs._mat[0][3]==0.0f && rhs._mat[1][3]==0.0f && rhs._mat[2][3]==0.0f && rhs._mat[3][3]==1.0f); + return is_4x3 ? invert_4x3(rhs) : invert_4x4(rhs); } /** 4x3 matrix invert, not right hand column is assumed to be 0,0,0,1. */