I don't get this. If you write your 2 byte struct
as 2 bytes, you shouldn't need to swap, the sequence
would be the same. (If you took a shortcut and wrote
it as a word (short int), then you might have byte
ordering problems....) I'd have to see the read/write
code, not just the struct, but you shouldn't have had
to do this in the first place.
--
-Richard M. Hartman
[EMAIL PROTECTED]
186,000 mi./sec ... not just a good idea, it's the LAW!
> -----Original Message-----
> From: Jason Freund [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 05, 2000 10:56 PM
> To: [EMAIL PROTECTED]
> Subject: Bitfield ordering
>
>
> Hi,
>
> I don't use linux for development anymore, but I used to have
> to reverse the
> order of bitfields when creating targets for PC(Linux) and
> PalmPilot, like
> so:
>
> struct {
> #ifdef i386
> uchar field1: 3;
> uchar field2: 5;
> #else
> uchar field2: 5;
> uchar field1: 3;
> #endif
> }
>
> Now I moved to Widows and use CW and VisualC++, and it seems
> like you no
> longer need to reverse the bitfields in order to make the
> data compatible.
>
> I use bitfields all over the place, and removing the ifdefs
> fixed the one
> case I looked at in my code. But as a sanity check, I'd like
> to know if
> anyone else has experienced the nuances of using bitfields on
> different
> platforms to know if this is the case.
>
> -Jason
>
>