OSDN Git Service

2008-07-21 Thomas Koenig <tkoenig@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / libgfortran / generated / eoshift1_8.c
index 983e1bf..06d5532 100644 (file)
@@ -42,14 +42,14 @@ eoshift1 (gfc_array_char * const restrict ret,
        const gfc_array_i8 * const restrict h,
        const char * const restrict pbound, 
        const GFC_INTEGER_8 * const restrict pwhich, 
-       index_type size, char filler)
+       index_type size, const char * filler, index_type filler_len)
 {
   /* r.* indicates the return array.  */
   index_type rstride[GFC_MAX_DIMENSIONS];
   index_type rstride0;
   index_type roffset;
   char *rptr;
-  char *dest;
+  char * restrict dest;
   /* s.* indicates the source array.  */
   index_type sstride[GFC_MAX_DIMENSIONS];
   index_type sstride0;
@@ -102,6 +102,11 @@ eoshift1 (gfc_array_char * const restrict ret,
             ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
         }
     }
+  else
+    {
+      if (size0 ((array_t *) ret) == 0)
+       return;
+    }
 
   n = 0;
   for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
@@ -183,7 +188,14 @@ eoshift1 (gfc_array_char * const restrict ret,
       else
        while (n--)
          {
-           memset (dest, filler, size);
+           index_type i;
+
+           if (filler_len == 1)
+             memset (dest, filler[0], size);
+           else
+             for (i = 0; i < size; i += filler_len)
+               memcpy (&dest[i], filler, filler_len);
+
            dest += roffset;
          }
 
@@ -234,9 +246,11 @@ eoshift1_8 (gfc_array_char * const restrict ret,
        const char * const restrict pbound,
        const GFC_INTEGER_8 * const restrict pwhich)
 {
-  eoshift1 (ret, array, h, pbound, pwhich, GFC_DESCRIPTOR_SIZE (array), 0);
+  eoshift1 (ret, array, h, pbound, pwhich, GFC_DESCRIPTOR_SIZE (array),
+           "\0", 1);
 }
 
+
 void eoshift1_8_char (gfc_array_char * const restrict, 
        GFC_INTEGER_4,
        const gfc_array_char * const restrict, 
@@ -256,7 +270,32 @@ eoshift1_8_char (gfc_array_char * const restrict ret,
        GFC_INTEGER_4 array_length,
        GFC_INTEGER_4 bound_length __attribute__((unused)))
 {
-  eoshift1 (ret, array, h, pbound, pwhich, array_length, ' ');
+  eoshift1 (ret, array, h, pbound, pwhich, array_length, " ", 1);
+}
+
+
+void eoshift1_8_char4 (gfc_array_char * const restrict, 
+       GFC_INTEGER_4,
+       const gfc_array_char * const restrict, 
+       const gfc_array_i8 * const restrict,
+       const char * const restrict, 
+       const GFC_INTEGER_8 * const restrict,
+       GFC_INTEGER_4, GFC_INTEGER_4);
+export_proto(eoshift1_8_char4);
+
+void
+eoshift1_8_char4 (gfc_array_char * const restrict ret,
+       GFC_INTEGER_4 ret_length __attribute__((unused)),
+       const gfc_array_char * const restrict array, 
+       const gfc_array_i8 * const restrict h,
+       const char *  const restrict pbound, 
+       const GFC_INTEGER_8 * const restrict pwhich,
+       GFC_INTEGER_4 array_length,
+       GFC_INTEGER_4 bound_length __attribute__((unused)))
+{
+  static const gfc_char4_t space = (unsigned char) ' ';
+  eoshift1 (ret, array, h, pbound, pwhich, array_length * sizeof (gfc_char4_t),
+           (const char *) &space, sizeof (gfc_char4_t));
 }
 
 #endif