OSDN Git Service

2009-06-21 Thomas Koenig <tkoenig@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / libgfortran / generated / pack_i2.c
index b510231..149e9f6 100644 (file)
@@ -122,11 +122,11 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array,
   for (n = 0; n < dim; n++)
     {
       count[n] = 0;
-      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
       if (extent[n] <= 0)
        zero_sized = 1;
-      sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride * mask_kind;
+      sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
+      mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
     }
   if (sstride[0] == 0)
     sstride[0] = 1;
@@ -147,7 +147,7 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array,
        {
          /* The return array will have as many
             elements as there are in VECTOR.  */
-         total = vector->dim[0].ubound + 1 - vector->dim[0].lbound;
+         total = GFC_DESCRIPTOR_EXTENT(vector,0);
          if (total < 0)
            {
              total = 0;
@@ -215,9 +215,7 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array,
       if (ret->data == NULL)
        {
          /* Setup the array descriptor.  */
-         ret->dim[0].lbound = 0;
-         ret->dim[0].ubound = total - 1;
-         ret->dim[0].stride = 1;
+         GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
 
          ret->offset = 0;
          if (total == 0)
@@ -234,7 +232,7 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array,
          /* We come here because of range checking.  */
          index_type ret_extent;
 
-         ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound;
+         ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0);
          if (total != ret_extent)
            runtime_error ("Incorrect extent in return value of PACK intrinsic;"
                           " is %ld, should be %ld", (long int) total,
@@ -242,7 +240,7 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array,
        }
     }
 
-  rstride0 = ret->dim[0].stride;
+  rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0);
   if (rstride0 == 0)
     rstride0 = 1;
   sstride0 = sstride[0];
@@ -291,11 +289,11 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array,
   /* Add any remaining elements from VECTOR.  */
   if (vector)
     {
-      n = vector->dim[0].ubound + 1 - vector->dim[0].lbound;
+      n = GFC_DESCRIPTOR_EXTENT(vector,0);
       nelem = ((rptr - ret->data) / rstride0);
       if (n > nelem)
         {
-          sstride0 = vector->dim[0].stride;
+          sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0);
           if (sstride0 == 0)
             sstride0 = 1;