Browse Source

Math: one more needless operator[] call in scatter().

pull/326/merge
Vladimír Vondruš 7 years ago
parent
commit
7a1162acc7
  1. 2
      src/Magnum/Math/Swizzle.h
  2. 2
      src/Magnum/Math/Vector.h

2
src/Magnum/Math/Swizzle.h

@ -97,7 +97,7 @@ namespace Implementation {
}
template<class T, std::size_t valueSize, char component, char ...next> constexpr T scatterRecursive(const T& vector, const Vector<valueSize, typename T::Type>& values, std::size_t valueIndex) {
return scatterRecursive<T, valueSize, next...>(
scatterComponentOr<T, component>(vector, values[valueIndex], typename GenerateSequence<T::Size>::Type{}),
scatterComponentOr<T, component>(vector, values._data[valueIndex], typename GenerateSequence<T::Size>::Type{}),
values, valueIndex + 1);
}
}

2
src/Magnum/Math/Vector.h

@ -84,6 +84,7 @@ namespace Implementation {
/* To make gather() / scatter() faster */
template<std::size_t, std::size_t> struct GatherComponentAt;
template<std::size_t, std::size_t, bool> struct ScatterComponentOr;
template<class T, std::size_t valueSize, char, char...> constexpr T scatterRecursive(const T&, const Vector<valueSize, typename T::Type>&, std::size_t);
}
/** @relatesalso Vector
@ -658,6 +659,7 @@ template<std::size_t size, class T> class Vector {
/* To make gather() / scatter() faster */
template<std::size_t, std::size_t> friend struct Implementation::GatherComponentAt;
template<std::size_t, std::size_t, bool> friend struct Implementation::ScatterComponentOr;
template<class T_, std::size_t valueSize, char, char...> friend constexpr T_ Implementation::scatterRecursive(const T_&, const Vector<valueSize, typename T_::Type>&, std::size_t);
/* So the out-of-class comparators can access data directly to avoid
function call overhead */

Loading…
Cancel
Save