summaryrefslogtreecommitdiff
path: root/libgfortran/runtime
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-11 19:39:13 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-11 19:39:13 +0000
commitf27ef64358c7b216ba0a11142364436a0aaebc33 (patch)
treeaad494096555f7a4cc32786401cfade71ce1dc21 /libgfortran/runtime
parente5897c9259ebb0cfbb7fc82e9eeb3a95adcd4842 (diff)
downloadgcc-f27ef64358c7b216ba0a11142364436a0aaebc33.tar.gz
2005-06-11 Thomas Koenig <Thomas.Koenig@onlinde.de>
PR libfortran/21333 * Makefile.am: Add in_pack_c4.c, in_pack_c8.c, in_unpack_c4.c and in_unpack_c8.c. * Makefile.in: Regenerate. * libgfortran.h: Declare internal_pack_c4, internal_pack_c8, internal_unpack_c4 and internal_unpack_c8. * m4/in_pack.m4: Use rtype_ccode insteald of rtype_kind in function name. Use sizeof (rtype_name) as size for memory allocation. * m4/in_unpack.m4: Use rtype_ccode insteald of rtype_kind in function name. Use sizeof (rtype_name) for calculation of sizes for memcpy. * runtime/in_pack_generic.c: For real, integer and logical call internal_pack_4 if size==4 and internal_pack_8 if size==8. For complex, call internal_pack_c4 if size==8 and internal_pack_c8 if size==16. * runtime/in_unpack_generic.c: For real, integer and logical call internal_unpack_4 if size==4 and internal_unpack_8 if size==8. For complex, call internal_unpack_c4 if size==8 and internal_unpack_c8 if size==16. * generated/in_pack_i4.c: Regenerated. * generated/in_pack_i8.c: Regenerated. * generated/in_unpack_i4.c: Regenerated. * generated/in_unpack_i8.c: Regenerated. * generated/in_pack_c4.c: New file. * generated/in_pack_c8.c: New file. * generated/in_unpack_c4.c: New file. * generated/in_unpack_c8.c: New file. 2005-05-11 Thomas Koenig <Thomas.Koenig@online.de> * gfortran.fortran-torture/execute/in-pack.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100842 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/runtime')
-rw-r--r--libgfortran/runtime/in_pack_generic.c35
-rw-r--r--libgfortran/runtime/in_unpack_generic.c39
2 files changed, 60 insertions, 14 deletions
diff --git a/libgfortran/runtime/in_pack_generic.c b/libgfortran/runtime/in_pack_generic.c
index 99fdb92436f..23810cf8320 100644
--- a/libgfortran/runtime/in_pack_generic.c
+++ b/libgfortran/runtime/in_pack_generic.c
@@ -52,6 +52,7 @@ internal_pack (gfc_array_char * source)
int n;
int packed;
index_type size;
+ int type;
if (source->dim[0].stride == 0)
{
@@ -59,14 +60,36 @@ internal_pack (gfc_array_char * source)
return source->data;
}
+ type = GFC_DESCRIPTOR_TYPE (source);
size = GFC_DESCRIPTOR_SIZE (source);
- switch (size)
+ switch (type)
{
- case 4:
- return internal_pack_4 ((gfc_array_i4 *)source);
-
- case 8:
- return internal_pack_8 ((gfc_array_i8 *)source);
+ case GFC_DTYPE_INTEGER:
+ case GFC_DTYPE_LOGICAL:
+ case GFC_DTYPE_REAL:
+ switch (size)
+ {
+ case 4:
+ return internal_pack_4 ((gfc_array_i4 *)source);
+
+ case 8:
+ return internal_pack_8 ((gfc_array_i8 *)source);
+ }
+ break;
+
+ case GFC_DTYPE_COMPLEX:
+ switch (size)
+ {
+ case 8:
+ return internal_pack_c4 ((gfc_array_c4 *)source);
+
+ case 16:
+ return internal_pack_c8 ((gfc_array_c8 *)source);
+ }
+ break;
+
+ default:
+ break;
}
dim = GFC_DESCRIPTOR_RANK (source);
diff --git a/libgfortran/runtime/in_unpack_generic.c b/libgfortran/runtime/in_unpack_generic.c
index 42f3b5d67a2..1e8ac6b7a47 100644
--- a/libgfortran/runtime/in_unpack_generic.c
+++ b/libgfortran/runtime/in_unpack_generic.c
@@ -50,22 +50,45 @@ internal_unpack (gfc_array_char * d, const void * s)
const char *src;
int n;
int size;
+ int type;
dest = d->data;
/* This check may be redundant, but do it anyway. */
if (s == dest || !s)
return;
+ type = GFC_DESCRIPTOR_TYPE (d);
size = GFC_DESCRIPTOR_SIZE (d);
- switch (size)
+ switch (type)
{
- case 4:
- internal_unpack_4 ((gfc_array_i4 *)d, (const GFC_INTEGER_4 *)s);
- return;
-
- case 8:
- internal_unpack_8 ((gfc_array_i8 *)d, (const GFC_INTEGER_8 *)s);
- return;
+ case GFC_DTYPE_INTEGER:
+ case GFC_DTYPE_LOGICAL:
+ case GFC_DTYPE_REAL:
+ switch (size)
+ {
+ case 4:
+ internal_unpack_4 ((gfc_array_i4 *)d, (const GFC_INTEGER_4 *)s);
+ return;
+
+ case 8:
+ internal_unpack_8 ((gfc_array_i8 *)d, (const GFC_INTEGER_8 *)s);
+ return;
+ }
+ break;
+
+ case GFC_DTYPE_COMPLEX:
+ switch (size)
+ {
+ case 8:
+ internal_unpack_c4 ((gfc_array_c4 *)d, (const GFC_COMPLEX_4 *)s);
+ return;
+
+ case 16:
+ internal_unpack_c8 ((gfc_array_c8 *)d, (const GFC_COMPLEX_8 *)s);
+ return;
+ }
+ default:
+ break;
}
if (d->dim[0].stride == 0)