From 7a1162acc70a1d8636e0662013ea4b4498bd8a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 5 Sep 2019 16:26:38 +0200 Subject: [PATCH] Math: one more needless operator[] call in scatter(). --- src/Magnum/Math/Swizzle.h | 2 +- src/Magnum/Math/Vector.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Math/Swizzle.h b/src/Magnum/Math/Swizzle.h index db31a02ae..16f0b28aa 100644 --- a/src/Magnum/Math/Swizzle.h +++ b/src/Magnum/Math/Swizzle.h @@ -97,7 +97,7 @@ namespace Implementation { } template constexpr T scatterRecursive(const T& vector, const Vector& values, std::size_t valueIndex) { return scatterRecursive( - scatterComponentOr(vector, values[valueIndex], typename GenerateSequence::Type{}), + scatterComponentOr(vector, values._data[valueIndex], typename GenerateSequence::Type{}), values, valueIndex + 1); } } diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index b948ad8f7..ae9476614 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -84,6 +84,7 @@ namespace Implementation { /* To make gather() / scatter() faster */ template struct GatherComponentAt; template struct ScatterComponentOr; + template constexpr T scatterRecursive(const T&, const Vector&, std::size_t); } /** @relatesalso Vector @@ -658,6 +659,7 @@ template class Vector { /* To make gather() / scatter() faster */ template friend struct Implementation::GatherComponentAt; template friend struct Implementation::ScatterComponentOr; + template friend constexpr T_ Implementation::scatterRecursive(const T_&, const Vector&, std::size_t); /* So the out-of-class comparators can access data directly to avoid function call overhead */