This is the mail archive of the 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]

Endian swapping with C code

  Just a small idea, a bit late and not even backed up
 with some real patch:
 instead of having an inline function to byte-swap (and so
 finnishing in a real application to do
 " byte_swapped (byte_swapped (byte_swapped (X)))"
 " if (byte_swapped (X) == byte_swapped (Y)) "
 " byte_swapped (X) = byte_swapped (Y) | byte_swapped (0xFF) "

 Then "simply" add a variable attribute:
int ethernet_integer __attribute__((bigendian));
int intel_integer __attribute__((littleendian));
const short int intel_const __attribute__((littleendian)) = 0xFF;

 It opens optimisation opportunities, warnings if passing a pointer
 of the wrong endianness, does not clash with integer promotion on
 function parameters...

  Probably not an easy task anyways...


Vous manquez d?espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur

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