From b61f8262e970fafa332ac426644f34d5366af8b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 3 Apr 2019 16:14:14 +0200 Subject: [PATCH] Math: inline a helper function. --- src/Magnum/Math/Matrix.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Magnum/Math/Matrix.h b/src/Magnum/Math/Matrix.h index ac63b2c07..5a9d8681b 100644 --- a/src/Magnum/Math/Matrix.h +++ b/src/Magnum/Math/Matrix.h @@ -294,19 +294,17 @@ MAGNUM_MATRIX_OPERATOR_IMPLEMENTATION(Matrix) namespace Implementation { template struct MatrixDeterminant { - T operator()(const Matrix& m); -}; - -template inline T MatrixDeterminant::operator()(const Matrix& m) { - T out(0); + T operator()(const Matrix& m) { + T out(0); - /* Using ._data[] instead of [] to avoid function call indirection on debug - builds (saves a lot, yet doesn't obfuscate too much) */ - for(std::size_t col = 0; col != size; ++col) - out += ((col & 1) ? -1 : 1)*m._data[col]._data[0]*m.ij(col, 0).determinant(); + /* Using ._data[] instead of [] to avoid function call indirection on + debug builds (saves a lot, yet doesn't obfuscate too much) */ + for(std::size_t col = 0; col != size; ++col) + out += ((col & 1) ? -1 : 1)*m._data[col]._data[0]*m.ij(col, 0).determinant(); - return out; -} + return out; + } +}; /* This is not *critically* needed here (the specializations for 2x2 and 1x1 are technically enough to make things work), but together with the raw data