This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Byte swapping support


On 14/09/17 11:30, Eric Botcazou wrote:
>> 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."
> 

It is, as I say, a /long/ time since I looked at it.  I could easily be
remembering incorrectly - and it could also be a difference in the versions.

Being unable to take the address of a byte-swapped member is a
reasonable and understandable limitation when byte-swapping is expressed
this way.  It would be one of the advantages in using a named address
space - then you /could/ take a pointer, but it would be a pointer
qualified by the address space name, and incompatible with normal pointers.


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