This is the mail archive of the
mailing list for the GCC project.
Re: Byte swapping support
> On Sep 13, 2017, at 5:51 AM, Jürg Billeter <firstname.lastname@example.org> wrote:
> On Tue, 2017-09-12 at 08:52 -0700, H.J. Lu wrote:
>> Can you use __attribute__ ((scalar_storage_order)) in GCC 7?
> To support existing large code bases, the goal is to reverse storage
> order for all scalars, not just (selected) structs/unions. Also need to
> support taking the address of a scalar field, for example. C++ support
> will be required as well.
I wonder about that. It's inefficient to do byte swapping on local data; it is only useful and needed on external data. Data that goes to files for use by other-byte-order applications, or data that goes across a bus or network to consumers that have the other byte order. A byte swapped local variable only consumes cycles and instruction space to no purpose.
My experience is that byte order marking of data is very useful, but it always is applied selectively just to those spots where it is needed.