OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / libgfortran / generated / unpack_c4.c
index 472ce48..116f213 100644 (file)
@@ -1,5 +1,5 @@
 /* Specific implementation of the UNPACK intrinsic
-   Copyright 2008 Free Software Foundation, Inc.
+   Copyright 2008, 2009 Free Software Foundation, Inc.
    Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>, based on
    unpack_generic.c by Paul Brook <paul@nowt.org>.
 
@@ -8,26 +8,21 @@ This file is part of the GNU Fortran 95 runtime library (libgfortran).
 Libgfortran is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public
 License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file into combinations with other programs,
-and to distribute those combinations without any restriction coming
-from the use of this file.  (The General Public License restrictions
-do apply in other respects; for example, they cover modification of
-the file, and distribution when not linked into a combine
-executable.)
+version 3 of the License, or (at your option) any later version.
 
 Ligbfortran is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public
-License along with libgfortran; see the file COPYING.  If not,
-write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
 
 #include "libgfortran.h"
 #include <stdlib.h>
@@ -45,7 +40,7 @@ unpack0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector,
   index_type rstride[GFC_MAX_DIMENSIONS];
   index_type rstride0;
   index_type rs;
-  GFC_COMPLEX_4 *rptr;
+  GFC_COMPLEX_4 * restrict rptr;
   /* v.* indicates the vector array.  */
   index_type vstride0;
   GFC_COMPLEX_4 *vptr;
@@ -95,13 +90,12 @@ unpack0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector,
       for (n = 0; n < dim; n++)
        {
          count[n] = 0;
-         ret->dim[n].stride = rs;
-         ret->dim[n].lbound = 0;
-         ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound;
-         extent[n] = ret->dim[n].ubound + 1;
+         GFC_DIMENSION_SET(ret->dim[n], 0,
+                           GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs);
+         extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n);
          empty = empty || extent[n] <= 0;
-         rstride[n] = ret->dim[n].stride;
-         mstride[n] = mask->dim[n].stride * mask_kind;
+         rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n);
+         mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
          rs *= extent[n];
        }
       ret->offset = 0;
@@ -113,10 +107,10 @@ unpack0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector,
       for (n = 0; n < dim; n++)
        {
          count[n] = 0;
-         extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound;
+         extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n);
          empty = empty || extent[n] <= 0;
-         rstride[n] = ret->dim[n].stride;
-         mstride[n] = mask->dim[n].stride * mask_kind;
+         rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n);
+         mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
        }
       if (rstride[0] == 0)
        rstride[0] = 1;
@@ -128,7 +122,7 @@ unpack0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector,
   if (mstride[0] == 0)
     mstride[0] = 1;
 
-  vstride0 = vector->dim[0].stride;
+  vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0);
   if (vstride0 == 0)
     vstride0 = 1;
   rstride0 = rstride[0];
@@ -188,7 +182,7 @@ unpack1_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector,
   index_type rstride[GFC_MAX_DIMENSIONS];
   index_type rstride0;
   index_type rs;
-  GFC_COMPLEX_4 *rptr;
+  GFC_COMPLEX_4 * restrict rptr;
   /* v.* indicates the vector array.  */
   index_type vstride0;
   GFC_COMPLEX_4 *vptr;
@@ -240,14 +234,13 @@ unpack1_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector,
       for (n = 0; n < dim; n++)
        {
          count[n] = 0;
-         ret->dim[n].stride = rs;
-         ret->dim[n].lbound = 0;
-         ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound;
-         extent[n] = ret->dim[n].ubound + 1;
+         GFC_DIMENSION_SET(ret->dim[n], 0,
+                           GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs);
+         extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n);
          empty = empty || extent[n] <= 0;
-         rstride[n] = ret->dim[n].stride;
-         fstride[n] = field->dim[n].stride;
-         mstride[n] = mask->dim[n].stride * mask_kind;
+         rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n);
+         fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n);
+         mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
          rs *= extent[n];
        }
       ret->offset = 0;
@@ -259,11 +252,11 @@ unpack1_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector,
       for (n = 0; n < dim; n++)
        {
          count[n] = 0;
-         extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound;
+         extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n);
          empty = empty || extent[n] <= 0;
-         rstride[n] = ret->dim[n].stride;
-         fstride[n] = field->dim[n].stride;
-         mstride[n] = mask->dim[n].stride * mask_kind;
+         rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n);
+         fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n);
+         mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
        }
       if (rstride[0] == 0)
        rstride[0] = 1;
@@ -277,7 +270,7 @@ unpack1_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector,
   if (mstride[0] == 0)
     mstride[0] = 1;
 
-  vstride0 = vector->dim[0].stride;
+  vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0);
   if (vstride0 == 0)
     vstride0 = 1;
   rstride0 = rstride[0];