From 3495738fc00bc81ccf2c0c884b7ad20ffa978704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 3 Apr 2012 22:39:22 +0200 Subject: [PATCH] Removed memcpy() from Matrix::set(), using Vector::from() in Matrix::at(). --- src/Math/Matrix.h | 4 ++-- src/Math/Vector.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index 930508014..8210035d8 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -95,7 +95,7 @@ template class Matrix { /** @brief %Matrix column */ inline constexpr Vector at(size_t col) const { - return *reinterpret_cast*>(_data+col*size); + return Vector::from(_data+col*size); } /** @brief Set value at given position */ @@ -105,7 +105,7 @@ template class Matrix { /** @brief Set matrix column */ inline void set(size_t col, const Vector& value) { - memcpy(_data+col*size, value.data(), size*sizeof(T)); + Vector::from(_data+col*size) = value; } /** @brief Add value to given position */ diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 1a700a6d6..3e781883b 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -50,7 +50,7 @@ template class Vector { /** @copydoc from(T*) */ inline constexpr static const Vector& from(const T* data) { - return *reinterpret_cast*>(data); + return *reinterpret_cast*>(data); } /** @brief Angle between vectors */