• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Please advise on bitfield endian swapping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Please advise on bitfield endian swapping


  • Subject: Please advise on bitfield endian swapping
  • From: Jeremy Sagan <email@hidden>
  • Date: Tue, 24 Jan 2006 15:17:49 -0500

Hello,

I have read through the guide on converting endianness when converting to the intel architecture.

I am converting a library written by a third person who is using extensive bit fields for their data structure and I was wondering if anyone has a generalized solution to swapping the endianness of bit fields where a file originated on powerpc.

Things like this:

typedef struct test
{
	Byte needsrepair  : 1;
	Byte isMute 		: 1;
	Byte track		:6;
};

I am thinking that one solution would be to have a conditional compilation for little endian so that it first reverses the structure so that in the above case for little endian the structure would be:

typedef struct test
{
	Byte track		:6;
	Byte isMute 		: 1;
	Byte needsrepair  : 1;
};

Then the endian code would still, correct me if I am wrong, have to go through and swap the bitfields that are more than one bit. In the above case the field 'track' would be a 6 bit value from 0-63 but the bits are still reversed.

Jeremy

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Please advise on bitfield endian swapping
      • From: Eric Albert <email@hidden>
  • Prev by Date: [SOLVED] Re: Upgrading to Native Target
  • Next by Date: Re: Please advise on bitfield endian swapping
  • Previous by thread: [SOLVED] Re: Upgrading to Native Target
  • Next by thread: Re: Please advise on bitfield endian swapping
  • Index(es):
    • Date
    • Thread