From 98f920527e2cd4e8d6f0c9ddb7ea9ebbf1d7843b Mon Sep 17 00:00:00 2001 From: Criss Date: Mon, 4 Sep 2017 22:13:50 +0200 Subject: [PATCH] Math: get rid of needless GenerateReverseSequence utility. --- src/Magnum/Math/BoolVector.h | 7 ------- src/Magnum/Math/RectangularMatrix.h | 4 ++-- src/Magnum/Math/Vector.h | 4 ++-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Magnum/Math/BoolVector.h b/src/Magnum/Math/BoolVector.h index 63924981e..2b2bf4195 100644 --- a/src/Magnum/Math/BoolVector.h +++ b/src/Magnum/Math/BoolVector.h @@ -49,13 +49,6 @@ namespace Implementation { template struct GenerateSequence<0, sequence...> { typedef Sequence Type; }; - - template struct GenerateReverseSequence: - GenerateReverseSequence {}; - - template struct GenerateReverseSequence<0, sequence...> { - typedef Sequence Type; - }; #endif template constexpr T repeat(T value, std::size_t) { return value; } diff --git a/src/Magnum/Math/RectangularMatrix.h b/src/Magnum/Math/RectangularMatrix.h index 4881246ea..43231c165 100644 --- a/src/Magnum/Math/RectangularMatrix.h +++ b/src/Magnum/Math/RectangularMatrix.h @@ -400,7 +400,7 @@ template class RectangularMatrix { * @see @ref transposed(), @ref flippedRows(), @ref Vector::flipped() */ constexpr RectangularMatrix flippedCols() const { - return flippedColsInternal(typename Implementation::GenerateReverseSequence::Type{}); + return flippedColsInternal(typename Implementation::GenerateSequence::Type{}); } /** @@ -454,7 +454,7 @@ template class RectangularMatrix { template constexpr explicit RectangularMatrix(Implementation::Sequence, U) noexcept: _data{Vector((static_cast(sequence), U{typename U::Init{}}))...} {} template constexpr RectangularMatrix flippedColsInternal(Implementation::Sequence) const { - return {(*this)[sequence]...}; + return {(*this)[cols - 1 - sequence]...}; } template constexpr RectangularMatrix flippedRowsInternal(Implementation::Sequence) const { diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index 0f17e44f5..c6ac19da8 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -537,7 +537,7 @@ template class Vector { * @ref RectangularMatrix::flippedRows() */ constexpr Vector flipped() const { - return flippedInternal(typename Implementation::GenerateReverseSequence::Type{}); + return flippedInternal(typename Implementation::GenerateSequence::Type{}); } /** @@ -587,7 +587,7 @@ template class Vector { } template constexpr Vector flippedInternal(Implementation::Sequence) const { - return {(*this)[sequence]...}; + return {(*this)[size - 1 - sequence]...}; } T _data[size];