]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/libgfortran/lib/contrib/generated/maxval_i8.c
Update
[l4.git] / l4 / pkg / libgfortran / lib / contrib / generated / maxval_i8.c
index 74aca03cf1b2dac087f67fea00e032aec8725517..56587826cc35c089a5cdf9301f5f832ca22652c6 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementation of the MAXVAL intrinsic
-   Copyright 2002, 2007, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2002-2015 Free Software Foundation, Inc.
    Contributed by Paul Brook <paul@nowt.org>
 
 This file is part of the GNU Fortran runtime library (libgfortran).
@@ -79,7 +79,7 @@ maxval_i8 (gfc_array_i8 * const restrict retarray,
        extent[n] = 0;
     }
 
-  if (retarray->data == NULL)
+  if (retarray->base_addr == NULL)
     {
       size_t alloc_size, str;
 
@@ -97,10 +97,9 @@ maxval_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->data = internal_malloc_size (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -130,8 +129,8 @@ maxval_i8 (gfc_array_i8 * const restrict retarray,
        return;
     }
 
-  base = array->data;
-  dest = retarray->data;
+  base = array->base_addr;
+  dest = retarray->base_addr;
 
   continue_loop = 1;
   while (continue_loop)
@@ -235,7 +234,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
   if (len <= 0)
     return;
 
-  mbase = mask->data;
+  mbase = mask->base_addr;
 
   mask_kind = GFC_DESCRIPTOR_SIZE (mask);
 
@@ -271,7 +270,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
        extent[n] = 0;
     }
 
-  if (retarray->data == NULL)
+  if (retarray->base_addr == NULL)
     {
       size_t alloc_size, str;
 
@@ -286,8 +285,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->data = internal_malloc_size (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -324,8 +322,8 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
        return;
     }
 
-  dest = retarray->data;
-  base = array->data;
+  dest = retarray->base_addr;
+  base = array->base_addr;
 
   while (base)
     {
@@ -344,12 +342,8 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
 #if defined (GFC_INTEGER_8_QUIET_NAN)
        int non_empty_p = 0;
 #endif
-       if (len <= 0)
-         *dest = (-GFC_INTEGER_8_HUGE-1);
-       else
+       for (n = 0; n < len; n++, src += delta, msrc += mdelta)
          {
-           for (n = 0; n < len; n++, src += delta, msrc += mdelta)
-             {
 
 #if defined (GFC_INTEGER_8_INFINITY) || defined (GFC_INTEGER_8_QUIET_NAN)
                if (*msrc)
@@ -374,9 +368,8 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
 #endif
                if (*msrc && *src > result)
                  result = *src;
-             }
-           *dest = result;
          }
+       *dest = result;
       }
       /* Advance to the next element.  */
       count[0]++;
@@ -459,7 +452,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray,
        extent[n] = 0;
     }
 
-  if (retarray->data == NULL)
+  if (retarray->base_addr == NULL)
     {
       size_t alloc_size, str;
 
@@ -477,8 +470,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -487,7 +479,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->data = internal_malloc_size (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -519,7 +511,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray,
       dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
     }
 
-  dest = retarray->data;
+  dest = retarray->base_addr;
 
   while(1)
     {