Thread: Bitfields, Bit/Little Endian

  1. #1
    Registered User
    Join Date
    May 2008

    Bitfields, Bit/Little Endian

    <<split from >>
    C gives no guarantee of the ordering of fields within machine words, so if you do use them for the latter reason, you program will not only be non-portable, it will be compiler-dependent too. The Standard says that fields are packed into ‘storage units’, which are typically machine words. The packing order, and whether or not a bitfield may cross a storage unit boundary, are implementation defined.
    Sorry for bringing back an old thread, but I just want to be clarified.

    So, does this mean that it is not possible to convert the bitfields endianness, by lets say htonl(), etc.? And do I have to reorder it bit by bit??
    Last edited by Salem; 05-26-2008 at 10:32 AM. Reason: Split

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitfields, Bit/Little Endian
    By plan7 in forum C Programming
    Replies: 17
    Last Post: 11-08-2007, 01:48 AM
  2. Big Endian & Little Endian
    By swaugh in forum C Programming
    Replies: 18
    Last Post: 06-06-2007, 11:25 PM
  3. Big Endian Little Endian Complex- Converting Characters
    By bd02eagle in forum C Programming
    Replies: 3
    Last Post: 07-11-2006, 01:01 AM
  4. Big and little endian
    By Cactus_Hugger in forum C Programming
    Replies: 4
    Last Post: 10-12-2005, 07:07 PM
  5. Replies: 10
    Last Post: 06-26-2005, 11:27 AM