PR fortran/23815: Add byte-swapping to gfortran
Bernhard Fischer
rep.nop@aon.at
Mon Nov 14 12:42:00 GMT 2005
On Mon, Nov 14, 2005 at 12:19:03AM +0100, Thomas Koenig wrote:
>--- gcc/fortran/gfortran.texi (revision 106756)
>+++ gcc/fortran/gfortran.texi (working copy)
>@@ -930,6 +931,35 @@
[]
>+Using the option could look like this:
>+@smallexample
>+ open(file='big.dat',form='unformatted',access='sequential', &
>+ convert='big_endian')
>+@end smallexample
>+
>+The value of the conversion can be queired by using
s/queired/queried/
>--- libgfortran/io/transfer.c (revision 106756)
>+++ libgfortran/io/transfer.c (working copy)
>@@ -2075,3 +2137,19 @@
> nml->dim[n].lbound = (ssize_t)lbound;
> nml->dim[n].ubound = (ssize_t)ubound;
> }
>+
>+/* Reverse memcpy - used for byte swapping. */
>+
>+void reverse_memcpy (void *dest, const void *src, size_t n)
>+{
>+ char *d, *s;
>+ size_t i;
>+
>+ d = (char *) dest;
>+ s = (char *) src + n - 1;
>+
>+ /* Write with ascendig order - this is likely faster because
s/faster because/faster/
>+ on modern architectures because of write combining. */
>+ for (i=0; i<n; i++)
>+ *(d++) = *(s--);
>+}
cheers,
Bernhard
More information about the Fortran
mailing list