Browse Source

Removed memcpy() from Matrix::set(), using Vector::from() in Matrix::at().

vectorfields
Vladimír Vondruš 14 years ago
parent
commit
3495738fc0
  1. 4
      src/Math/Matrix.h
  2. 2
      src/Math/Vector.h

4
src/Math/Matrix.h

@ -95,7 +95,7 @@ template<class T, size_t size> class Matrix {
/** @brief %Matrix column */
inline constexpr Vector<T, size> at(size_t col) const {
return *reinterpret_cast<const Vector<T, size>*>(_data+col*size);
return Vector<T, size>::from(_data+col*size);
}
/** @brief Set value at given position */
@ -105,7 +105,7 @@ template<class T, size_t size> class Matrix {
/** @brief Set matrix column */
inline void set(size_t col, const Vector<T, size>& value) {
memcpy(_data+col*size, value.data(), size*sizeof(T));
Vector<T, size>::from(_data+col*size) = value;
}
/** @brief Add value to given position */

2
src/Math/Vector.h

@ -50,7 +50,7 @@ template<class T, size_t size> class Vector {
/** @copydoc from(T*) */
inline constexpr static const Vector<T, size>& from(const T* data) {
return *reinterpret_cast<Vector<T, size>*>(data);
return *reinterpret_cast<const Vector<T, size>*>(data);
}
/** @brief Angle between vectors */

Loading…
Cancel
Save