Diff of /blitz/array-impl.h [d421cd] .. [2b666a] Maximize Restore

  Switch to side-by-side view

--- a/blitz/array-impl.h
+++ b/blitz/array-impl.h
@@ -326,7 +326,7 @@
      */
     Array(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape,
         GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>())
-      : MemoryBlockReference<T_numtype>(product(shape), dataFirst, 
+      : MemoryBlockReference<T_numtype>(_bz_returntype<sizeType>::product(shape), dataFirst, 
           neverDeleteData),
         storage_(storage)
     {
@@ -343,9 +343,9 @@
      * block will not be freed by Blitz++).
      */
     Array(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape,
-        TinyVector<int, N_rank> stride, 
-        GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>())
-      : MemoryBlockReference<T_numtype>(product(shape), dataFirst, 
+        TinyVector<diffType, N_rank> stride, 
+        GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>())
+      : MemoryBlockReference<T_numtype>(_bz_returntype<sizeType>::product(shape), dataFirst, 
           neverDeleteData),
         storage_(storage)
     {
@@ -363,7 +363,7 @@
     Array(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape,
         preexistingMemoryPolicy deletionPolicy,
         GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>())
-      : MemoryBlockReference<T_numtype>(product(shape), dataFirst, 
+      : MemoryBlockReference<T_numtype>(_bz_returntype<sizeType>::product(shape), dataFirst, 
             deletionPolicy),
         storage_(storage)
     {
@@ -382,10 +382,10 @@
      * given set of strides.  
      */
     Array(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape,
-        TinyVector<int, N_rank> stride,
+        TinyVector<diffType, N_rank> stride,
         preexistingMemoryPolicy deletionPolicy,
         GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>())
-      : MemoryBlockReference<T_numtype>(product(shape), dataFirst, 
+      : MemoryBlockReference<T_numtype>(_bz_returntype<sizeType>::product(shape), dataFirst, 
           deletionPolicy),
         storage_(storage)
     {
@@ -865,8 +865,8 @@
     // element in the array (but note that it may not be
     // stored first in memory if some ranks are stored descending).
 
-    int                               dataOffset() const
-    { return dot(storage_.base(), stride_); }
+    diffType                               dataOffset() const
+  { return dot(storage_.base(), stride_); }
 
     const T_numtype* restrict         data() const
     { return data_ + dataOffset(); }
@@ -886,9 +886,9 @@
     // These dataFirst() routines refer to the element in the
     // array which falls first in memory.
 
-    int                               dataFirstOffset() const
-    {
-        int pos = 0;
+    diffType                               dataFirstOffset() const
+    {
+      diffType pos = 0;
 
         // Used to use tinyvector expressions:
         // return data_ + dot(storage_.base()
@@ -896,7 +896,7 @@
 
         for (int i=0; i < N_rank; ++i)
            pos += (storage_.base(i) + (1-storage_.isRankStoredAscending(i)) *
-              (length_(i)-1)) * stride_(i);
+		   (length_(i)-1)) * stride_(i);
 
         return pos;
     }
@@ -961,8 +961,8 @@
 
     void                              makeUnique();
 
-    int                               numElements() const 
-    { return product(length_); }
+    sizeType                               numElements() const 
+    { return _bz_returntype<sizeType>::product(length_); }
 
     // NEEDS_WORK -- Expose the numReferences() method
     // MemoryBlockReference<T_numtype>::numReferences;
@@ -1111,13 +1111,13 @@
     const TinyVector<int, N_rank>&    shape() const
     { return length_; }
 
-    int                               size() const
+    sizeType                               size() const
     { return numElements(); }
 
-    const TinyVector<int, N_rank>&    stride() const
+    const TinyVector<diffType, N_rank>&    stride() const
     { return stride_; }
 
-    int                               stride(int rank) const
+  diffType                               stride(int rank) const
     { return stride_[rank]; }
 
     bool                              threadLocal(bool disableLock = true) const
@@ -1429,161 +1429,179 @@
     const T_numtype& restrict operator()(TinyVector<int,2> index) const
     {
         assertInRange(index[0], index[1]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]];
+        return data_[index[0] * stride_[0] 
+		     + index[1] * stride_[1]];
     }
 
     T_numtype& operator()(TinyVector<int,2> index)
     {
         assertInRange(index[0], index[1]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]];
+        return data_[index[0] * stride_[0] 
+		     + index[1] * stride_[1]];
     }
 
     const T_numtype& restrict operator()(TinyVector<int,3> index) const
     {
         assertInRange(index[0], index[1], index[2]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2]];
+        return data_[(index[0]) * stride_[0] 
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2]];
     }
 
     T_numtype& operator()(TinyVector<int,3> index)
     {
         assertInRange(index[0], index[1], index[2]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2]];
+        return data_[(index[0]) * stride_[0]
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2]];
     }
 
     const T_numtype& restrict operator()(const TinyVector<int,4>& index) const
     {
         assertInRange(index[0], index[1], index[2], index[3]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]];
+        return data_[(index[0]) * stride_[0] 
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]];
     }
 
     T_numtype& operator()(const TinyVector<int,4>& index)
     {
         assertInRange(index[0], index[1], index[2], index[3]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]];
+        return data_[(index[0]) * stride_[0] 
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]];
     }
 
     const T_numtype& restrict operator()(const TinyVector<int,5>& index) const
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4]];
+        return data_[(index[0]) * stride_[0] 
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4]];
     }
 
     T_numtype& operator()(const TinyVector<int,5>& index)
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4]];
+        return data_[(index[0]) * stride_[0]
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4]];
     }
 
     const T_numtype& restrict operator()(const TinyVector<int,6>& index) const
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]];
+        return data_[(index[0]) * stride_[0]
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]];
     }
 
     T_numtype& operator()(const TinyVector<int,6>& index)
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]];
+        return data_[(index[0]) * stride_[0]
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]];
     }
 
     const T_numtype& restrict operator()(const TinyVector<int,7>& index) const
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5], index[6]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]
-            + index[6] * stride_[6]];
+        return data_[(index[0]) * stride_[0] 
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]
+		     + index[6] * stride_[6]];
     }
 
     T_numtype& operator()(const TinyVector<int,7>& index)
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5], index[6]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]
-            + index[6] * stride_[6]];
+        return data_[(index[0]) * stride_[0] 
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]
+		     + index[6] * stride_[6]];
     }
 
     const T_numtype& restrict operator()(const TinyVector<int,8>& index) const
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5], index[6], index[7]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]
-            + index[6] * stride_[6] + index[7] * stride_[7]];
+        return data_[(index[0]) * stride_[0]
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]
+		     + index[6] * stride_[6] + index[7] * stride_[7]];
     }
 
     T_numtype& operator()(const TinyVector<int,8>& index)
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5], index[6], index[7]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]
-            + index[6] * stride_[6] + index[7] * stride_[7]];
+        return data_[(index[0]) * stride_[0] 
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]
+		     + index[6] * stride_[6] + index[7] * stride_[7]];
     }
 
     const T_numtype& restrict operator()(const TinyVector<int,9>& index) const
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5], index[6], index[7], index[8]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]
-            + index[6] * stride_[6] + index[7] * stride_[7]
-            + index[8] * stride_[8]];
+        return data_[(index[0]) * stride_[0]
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]
+		     + index[6] * stride_[6] + index[7] * stride_[7]
+		     + index[8] * stride_[8]];
     }
 
     T_numtype& operator()(const TinyVector<int,9>& index)
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5], index[6], index[7], index[8]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]
-            + index[6] * stride_[6] + index[7] * stride_[7]
-            + index[8] * stride_[8]];
+        return data_[(index[0]) * stride_[0]
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]
+		     + index[6] * stride_[6] + index[7] * stride_[7]
+		     + index[8] * stride_[8]];
     }
 
     const T_numtype& restrict operator()(const TinyVector<int,10>& index) const
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5], index[6], index[7], index[8], index[9]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]
-            + index[6] * stride_[6] + index[7] * stride_[7]
-            + index[8] * stride_[8] + index[9] * stride_[9]];
+        return data_[(index[0]) * stride_[0]
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]
+		     + index[6] * stride_[6] + index[7] * stride_[7]
+		     + index[8] * stride_[8] + index[9] * stride_[9]];
     }
 
     T_numtype& operator()(const TinyVector<int,10>& index)
     {
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5], index[6], index[7], index[8], index[9]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]
-            + index[6] * stride_[6] + index[7] * stride_[7]
-            + index[8] * stride_[8] + index[9] * stride_[9]];
+        return data_[(index[0]) * stride_[0]
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]
+		     + index[6] * stride_[6] + index[7] * stride_[7]
+		     + index[8] * stride_[8] + index[9] * stride_[9]];
     }
 
     const T_numtype& restrict operator()(const TinyVector<int,11>& index) const
@@ -1591,12 +1609,13 @@
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5], index[6], index[7], index[8], index[9],
             index[10]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]
-            + index[6] * stride_[6] + index[7] * stride_[7]
-            + index[8] * stride_[8] + index[9] * stride_[9]
-            + index[10] * stride_[10]];
+        return data_[(index[0]) * stride_[0] 
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]
+		     + index[6] * stride_[6] + index[7] * stride_[7]
+		     + index[8] * stride_[8] + index[9] * stride_[9]
+		     + index[10] * stride_[10]];
     }
 
     T_numtype& operator()(const TinyVector<int,11>& index)
@@ -1604,105 +1623,106 @@
         assertInRange(index[0], index[1], index[2], index[3],
             index[4], index[5], index[6], index[7], index[8], index[9],
             index[10]);
-        return data_[index[0] * stride_[0] + index[1] * stride_[1]
-            + index[2] * stride_[2] + index[3] * stride_[3]
-            + index[4] * stride_[4] + index[5] * stride_[5]
-            + index[6] * stride_[6] + index[7] * stride_[7]
-            + index[8] * stride_[8] + index[9] * stride_[9]
-            + index[10] * stride_[10]];
+        return data_[(index[0]) * stride_[0]
+		     + index[1] * stride_[1]
+		     + index[2] * stride_[2] + index[3] * stride_[3]
+		     + index[4] * stride_[4] + index[5] * stride_[5]
+		     + index[6] * stride_[6] + index[7] * stride_[7]
+		     + index[8] * stride_[8] + index[9] * stride_[9]
+		     + index[10] * stride_[10]];
     }
 
     const T_numtype& restrict operator()(int i0) const
     { 
         assertInRange(i0);
-        return data_[i0 * stride_[0]]; 
+        return data_[(i0) * stride_[0]]; 
     }
 
     T_numtype& restrict operator()(int i0) 
     {
         assertInRange(i0);
-        return data_[i0 * stride_[0]];
+        return data_[(i0) * stride_[0]];
     }
 
     const T_numtype& restrict operator()(int i0, int i1) const
     { 
         assertInRange(i0, i1);
-        return data_[i0 * stride_[0] + i1 * stride_[1]];
+        return data_[(i0) * stride_[0] + i1 * stride_[1]];
     }
 
     T_numtype& restrict operator()(int i0, int i1)
     {
         assertInRange(i0, i1);
-        return data_[i0 * stride_[0] + i1 * stride_[1]];
+        return data_[(i0) * stride_[0] + i1 * stride_[1]];
     }
 
     const T_numtype& restrict operator()(int i0, int i1, int i2) const
     {
         assertInRange(i0, i1, i2);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
-            + i2 * stride_[2]];
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
+		     + i2 * stride_[2]];
     }
 
     T_numtype& restrict operator()(int i0, int i1, int i2) 
     {
         assertInRange(i0, i1, i2);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
-            + i2 * stride_[2]];
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
+		     + i2 * stride_[2]];
     }
 
     const T_numtype& restrict operator()(int i0, int i1, int i2, int i3) const
     {
         assertInRange(i0, i1, i2, i3);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
-            + i2 * stride_[2] + i3 * stride_[3]];
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
+		     + i2 * stride_[2] + i3 * stride_[3]];
     }
 
     T_numtype& restrict operator()(int i0, int i1, int i2, int i3)
     {
         assertInRange(i0, i1, i2, i3);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
-            + i2 * stride_[2] + i3 * stride_[3]];
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
+		     + i2 * stride_[2] + i3 * stride_[3]];
     }
 
     const T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
         int i4) const
     {
         assertInRange(i0, i1, i2, i3, i4);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
-            + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]];
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
+		     + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]];
     }
 
     T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
         int i4)
     {
         assertInRange(i0, i1, i2, i3, i4);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
-            + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]];
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
+		     + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]];
     }
 
     const T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
         int i4, int i5) const
     {
         assertInRange(i0, i1, i2, i3, i4, i5);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
+		     + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+		     + i5 * stride_[5]];
+    }
+
+    T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
+        int i4, int i5)
+    {
+        assertInRange(i0, i1, i2, i3, i4, i5);
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5]];
     }
 
-    T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
-        int i4, int i5)
-    {
-        assertInRange(i0, i1, i2, i3, i4, i5);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
-            + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
-            + i5 * stride_[5]];
-    }
-
     const T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
         int i4, int i5, int i6) const
     {
         assertInRange(i0, i1, i2, i3, i4, i5, i6);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5] + i6 * stride_[6]];
     }
@@ -1711,7 +1731,7 @@
         int i4, int i5, int i6)
     {
         assertInRange(i0, i1, i2, i3, i4, i5, i6);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5] + i6 * stride_[6]];
     }
@@ -1720,7 +1740,7 @@
         int i4, int i5, int i6, int i7) const
     {
         assertInRange(i0, i1, i2, i3, i4, i5, i6, i7);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]];
     }
@@ -1729,7 +1749,7 @@
         int i4, int i5, int i6, int i7)
     {
         assertInRange(i0, i1, i2, i3, i4, i5, i6, i7);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]];
     }
@@ -1738,7 +1758,7 @@
         int i4, int i5, int i6, int i7, int i8) const
     {
         assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
             + i8 * stride_[8]];
@@ -1748,7 +1768,7 @@
         int i4, int i5, int i6, int i7, int i8)
     {
         assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
             + i8 * stride_[8]];
@@ -1758,7 +1778,7 @@
         int i4, int i5, int i6, int i7, int i8, int i9) const
     {
         assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
             + i8 * stride_[8] + i9 * stride_[9]];
@@ -1768,7 +1788,7 @@
         int i4, int i5, int i6, int i7, int i8, int i9)
     {
         assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
             + i8 * stride_[8] + i9 * stride_[9]];
@@ -1779,7 +1799,7 @@
     {
         assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8, 
             i9, i10);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
             + i8 * stride_[8] + i9 * stride_[9] + i10 * stride_[10]];
@@ -1790,7 +1810,7 @@
     {
         assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8, 
             i9, i10);
-        return data_[i0 * stride_[0] + i1 * stride_[1]
+        return data_[(i0) * stride_[0] + i1 * stride_[1]
             + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
             + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
             + i8 * stride_[8] + i9 * stride_[9] + i10 * stride_[10]];
@@ -2407,8 +2427,8 @@
      */
     GeneralArrayStorage<N_rank> storage_;
     TinyVector<int, N_rank> length_;
-    TinyVector<int, N_rank> stride_;
-    int zeroOffset_;
+    TinyVector<diffType, N_rank> stride_;
+    diffType zeroOffset_;
 };
 
 /*