public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rrr6399 at futuretek dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/23815] New: Add -byteswapio flag Date: Sun, 11 Sep 2005 05:14:00 -0000 [thread overview] Message-ID: <20050911051424.23815.rrr6399@futuretek.com> (raw) It is pretty typical that aero engineers involved in CFD (computational fluid dynamics) need to ship around large (50-1000 MB) binary files between various big-endian and little-endian machines without having to reformat them. Typically they generate files that are all big-endian using a compiler switch to avoid having to byte swap as well. So it'd be great to have a compiler switch that reversed the byte order of integers (2, 4, 8 byte) and floating point numbers (4, 8 byte) when they are read from or written to an unformatted file. For instance if you had an 4 byte int stored as an array of chars, you might swap it using this simple approach: for (i = 0; i < 4; i++ ) { swappedBytes[i] = bytes[3-i]; } or if you want to do the bit shifting thing, you do do it this way: return (((buf [ 3 ] & 0xff) << 24) | ((buf [ 2 ] & 0xff) << 16) | ((buf [ 1 ] & 0xff) << 8) | (buf [ 0 ] & 0xff)); (I grabbed this code from converToInt() in: gcc-4.1-20050909/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java) -- Summary: Add -byteswapio flag Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: enhancement Priority: P1 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rrr6399 at futuretek dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23815
next reply other threads:[~2005-09-11 5:14 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-09-11 5:14 rrr6399 at futuretek dot com [this message] 2005-09-12 14:29 ` [Bug fortran/23815] " pinskia at gcc dot gnu dot org 2005-09-12 19:22 ` falk at debian dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20050911051424.23815.rrr6399@futuretek.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).