[Patch, libfortran] Improve performance of byte swapped IO
Andreas Schwab
schwab@linux-m68k.org
Fri Jan 4 22:35:00 GMT 2013
Janne Blomqvist <blomqvist.janne@gmail.com> writes:
> diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
> index c8ecc3a..bf2250a 100644
> --- a/libgfortran/io/file_pos.c
> +++ b/libgfortran/io/file_pos.c
> @@ -140,15 +140,21 @@ unformatted_backspace (st_parameter_filepos *fpp, gfc_unit *u)
> }
> else
> {
> + uint32_t u32;
> + uint64_t u64;
> switch (length)
> {
> case sizeof(GFC_INTEGER_4):
> - reverse_memcpy (&m4, p, sizeof (m4));
> + memcpy (&u32, p, sizeof (u32));
> + u32 = __builtin_bswap32 (u32);
> + m4 = *(GFC_INTEGER_4*)&u32;
Isn't that an aliasing violation?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Fortran
mailing list