This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Byte swapping support
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: David Brown <david at westcontrol dot com>
- Cc: gcc at gcc dot gnu dot org, Jim Wilson <jim dot wilson at linaro dot org>, Jürg Billeter <juerg dot billeter at codethink dot co dot uk>
- Date: Thu, 14 Sep 2017 11:30:30 +0200
- Subject: Re: Byte swapping support
- Authentication-results: sourceware.org; auth=none
- References: <1505208772.3423.7.camel@codethink.co.uk> <6407936.qTSUNFDvMC@polaris> <59BA46F1.4080802@westcontrol.com>
> I seem to remember it being able to attach a big-endian or little-endian
> label to any individual variable (rather than a type), which could be a
> scaler rather than a struct. So it was a bit more flexible than gcc.
Well, the only thing I see in the documentation for "Byte Ordering" is the
reference to pragma Pack and the __packed__ keyword for structures, which can
toggle byte ordering by means of the byte-swap argument:
"#pragma pack
[ ([[max_member_alignment] , [min_structure_alignment][, byte-swap ]] ) ]
The pack directive specifies that all subsequent structures..."
with the same limitation as GCC about taking the address:
"It is not possible to take the address of a byte-swapped member."
--
Eric Botcazou