This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR fortran/23815: Add byte-swapping to gfortran


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]