diff options
Diffstat (limited to 'libgfortran/m4/eoshift3.m4')
-rw-r--r-- | libgfortran/m4/eoshift3.m4 | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4 index 050f5277822..081ff927277 100644 --- a/libgfortran/m4/eoshift3.m4 +++ b/libgfortran/m4/eoshift3.m4 @@ -43,7 +43,7 @@ eoshift3 (gfc_array_char * const restrict ret, const 'atype` * const restrict h, const gfc_array_char * const restrict bound, const 'atype_name` * 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]; @@ -199,7 +199,14 @@ eoshift3 (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; } @@ -254,9 +261,11 @@ eoshift3_'atype_kind` (gfc_array_char * const restrict ret, const gfc_array_char * const restrict bound, const 'atype_name` * const restrict pwhich) { - eoshift3 (ret, array, h, bound, pwhich, GFC_DESCRIPTOR_SIZE (array), 0); + eoshift3 (ret, array, h, bound, pwhich, GFC_DESCRIPTOR_SIZE (array), + "\0", 1); } + extern void eoshift3_'atype_kind`_char (gfc_array_char * const restrict, GFC_INTEGER_4, const gfc_array_char * const restrict, @@ -276,7 +285,32 @@ eoshift3_'atype_kind`_char (gfc_array_char * const restrict ret, GFC_INTEGER_4 array_length, GFC_INTEGER_4 bound_length __attribute__((unused))) { - eoshift3 (ret, array, h, bound, pwhich, array_length, ''` ''`); + eoshift3 (ret, array, h, bound, pwhich, array_length, " ", 1); +} + + +extern void eoshift3_'atype_kind`_char4 (gfc_array_char * const restrict, + GFC_INTEGER_4, + const gfc_array_char * const restrict, + const 'atype` * const restrict, + const gfc_array_char * const restrict, + const 'atype_name` * const restrict, + GFC_INTEGER_4, GFC_INTEGER_4); +export_proto(eoshift3_'atype_kind`_char4); + +void +eoshift3_'atype_kind`_char4 (gfc_array_char * const restrict ret, + GFC_INTEGER_4 ret_length __attribute__((unused)), + const gfc_array_char * const restrict array, + const 'atype` * const restrict h, + const gfc_array_char * const restrict bound, + const 'atype_name` * const restrict pwhich, + GFC_INTEGER_4 array_length, + GFC_INTEGER_4 bound_length __attribute__((unused))) +{ + static const gfc_char4_t space = (unsigned char) ''` ''`; + eoshift3 (ret, array, h, bound, pwhich, array_length * sizeof (gfc_char4_t), + (const char *) &space, sizeof (gfc_char4_t)); } #endif' |