* remove ei_block_direct_access_status

* remove HasDirectAccess / NoDirectAccess constants
This commit is contained in:
Benoit Jacob
2010-04-23 11:36:22 -04:00
parent 58e7297859
commit a16ba80bfa
9 changed files with 25 additions and 33 deletions

View File

@@ -158,14 +158,14 @@ template<typename XprType> struct ei_blas_traits
IsComplex = NumTraits<Scalar>::IsComplex,
IsTransposed = false,
NeedToConjugate = false,
ActualAccess = ( (int(XprType::Flags)&DirectAccessBit)
HasUsableDirectAccess = ( (int(XprType::Flags)&DirectAccessBit)
&& ( /* Uncomment this when the low-level matrix-vector product functions support strided vectors
bool(XprType::IsVectorAtCompileTime)
|| */
int(ei_inner_stride_at_compile_time<XprType>::ret) == 1)
) ? HasDirectAccess : NoDirectAccess
) ? 1 : 0
};
typedef typename ei_meta_if<int(ActualAccess)==HasDirectAccess,
typedef typename ei_meta_if<bool(HasUsableDirectAccess),
ExtractType,
typename _ExtractType::PlainObject
>::ret DirectLinearAccessType;
@@ -226,7 +226,7 @@ struct ei_blas_traits<Transpose<NestedXpr> >
typedef Transpose<NestedXpr> XprType;
typedef Transpose<typename Base::_ExtractType> ExtractType;
typedef Transpose<typename Base::_ExtractType> _ExtractType;
typedef typename ei_meta_if<int(Base::ActualAccess)==HasDirectAccess,
typedef typename ei_meta_if<bool(Base::HasUsableDirectAccess),
ExtractType,
typename ExtractType::PlainObject
>::ret DirectLinearAccessType;
@@ -237,7 +237,7 @@ struct ei_blas_traits<Transpose<NestedXpr> >
static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x.nestedExpression()); }
};
template<typename T, int Access=ei_blas_traits<T>::ActualAccess>
template<typename T, bool HasUsableDirectAccess=ei_blas_traits<T>::HasUsableDirectAccess>
struct ei_extract_data_selector {
static const typename T::Scalar* run(const T& m)
{
@@ -246,7 +246,7 @@ struct ei_extract_data_selector {
};
template<typename T>
struct ei_extract_data_selector<T,NoDirectAccess> {
struct ei_extract_data_selector<T,false> {
static typename T::Scalar* run(const T&) { return 0; }
};

View File

@@ -241,9 +241,7 @@ namespace {
enum {
IsDense = 0,
IsSparse,
NoDirectAccess = 0,
HasDirectAccess = DirectAccessBit
IsSparse
};
enum TransformTraits {

View File

@@ -49,17 +49,16 @@ template<typename ExpressionType> class NestByValue;
template<typename ExpressionType> class ForceAlignedAccess;
template<typename ExpressionType> class SwapWrapper;
// MSVC has a big bug: when the expression ei_traits<MatrixType>::Flags&DirectAccessBit ? HasDirectAccess : NoDirectAccess
// MSVC has a big bug: when the expression ei_traits<MatrixType>::Flags&DirectAccessBit ? 1 : 0
// is used as default template parameter value here, it gets mis-evaluated as just ei_traits<MatrixType>::Flags
// Moreover, adding brackets tends to give compilation errors with MSVC.
// Solution: defer that to a helper struct.
template<typename XprType>
struct ei_block_direct_access_status
template<typename Derived> struct ei_has_direct_access
{
enum { ret = ei_traits<XprType>::Flags&DirectAccessBit ? HasDirectAccess : NoDirectAccess };
enum { ret = (ei_traits<Derived>::Flags & DirectAccessBit) ? 1 : 0 };
};
template<typename XprType, int BlockRows=Dynamic, int BlockCols=Dynamic,
int _DirectAccessStatus = ei_block_direct_access_status<XprType>::ret> class Block;
bool HasDirectAccess = ei_has_direct_access<XprType>::ret> class Block;
template<typename MatrixType, int Size=Dynamic> class VectorBlock;
template<typename MatrixType> class Transpose;