From 6de4871c8c991c63601c211f35475225080352f1 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 27 Jun 2008 01:42:44 +0000 Subject: [PATCH] fix a couple of issues in the new Map.h --- Eigen/src/Core/Map.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index 8964681ea..92ac5f20b 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -50,8 +50,8 @@ struct ei_traits > MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, Flags = MatrixType::Flags - & (HereditaryBits | LinearAccessBit | DirectAccessBit) - & (Alignment == Aligned ? PacketAccessBit : 0), + & ( (HereditaryBits | LinearAccessBit | DirectAccessBit) + | (Alignment == Aligned ? PacketAccessBit : 0) ), CoeffReadCost = NumTraits::ReadCost }; }; @@ -89,7 +89,7 @@ template class Map inline Scalar& coeffRef(int index) { - return m_data[index]; + return *const_cast(m_data + index); } template @@ -111,7 +111,7 @@ template class Map inline void writePacket(int row, int col, const PacketScalar& x) { ei_pstoret - (m_data + (Flags & RowMajorBit + (const_cast(m_data) + (Flags & RowMajorBit ? col + row * m_cols.value() : row + col * m_rows.value()), x); } @@ -119,7 +119,8 @@ template class Map template inline void writePacket(int index, const PacketScalar& x) { - ei_pstoret(m_data + index, x); + ei_pstoret + (const_cast(m_data) + index, x); } inline Map(const Scalar* data) : m_data(data), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime)