Please advise on bitfield endian swapping
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