aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h
diff options
context:
space:
mode:
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h b/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h
index 66ddfd554..0745b1742 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h
@@ -43,13 +43,24 @@ class compute_tensor_flags
enum { ret = packet_access_bit | aligned_bit};
};
+template<bool force32bit>
+struct compute_index_type {
+ typedef DenseIndex type;
+};
+
+template<>
+struct compute_index_type<true> {
+ typedef int type;
+};
+
+
template<typename Scalar_, std::size_t NumIndices_, int Options_>
struct traits<Tensor<Scalar_, NumIndices_, Options_> >
{
typedef Scalar_ Scalar;
typedef Dense StorageKind;
- typedef DenseIndex Index;
+ typedef typename compute_index_type<static_cast<bool>(Options_&Index32Bit)>::type Index;
static const int NumDimensions = NumIndices_;
static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor;
enum {
@@ -64,7 +75,7 @@ struct traits<TensorFixedSize<Scalar_, Dimensions, Options_> >
{
typedef Scalar_ Scalar;
typedef Dense StorageKind;
- typedef DenseIndex Index;
+ typedef typename compute_index_type<static_cast<bool>(Options_&Index32Bit)>::type Index;
static const int NumDimensions = array_size<Dimensions>::value;
static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor;
enum {