This is the mail archive of the gcc@gcc.gnu.org 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]

Re: Reversing bitfields on solaris


Samaresh Pradhan wrote:
I am porting an app from Windows (Visual C++) to Solaris (g++). This
application has encryption and decryption algorithm based on bit position
for given values.

x86 Windows is little-endian, and sparc Solaris is big-endian, so yes the bit positions for bit-fields are reversed.


We don't have any support for reversing bit-fields. It might be reasonable to add an attribute for this, but it is unlikely anyone will volunteer to do the work for you.

A common way of doing this is to have two structure definitions with their bitfields reversed, and then use #ifdef to choose the right one for the target.

Jim




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