I'm porting some of my palmos code over to a little-endian device (RIM950). 
It uses the MS Visual C++ compiler for the SDK.  The problem I am having is
with structures that use bit packing:

typedef struct {
    Word year  :7;
    Word month :4;
    Word day   :5;
} DateType;

On Codewarrior and GCC the bits are packed starting with msb.  In VC++ they
start at lsb.  So in VC++ I have to use:

typedef struct {
    Word day   :5;
    Word month :4;
    Word year  :7;
} DateType;

I realize that Word (an unsigned short) is LSB versus MSB and though I
already take that into account, the position of the bit components is
opposite.  For example on the palm compilers year is the most significant 7
bits of the Word, but in VC++ (using the top structure) year is the least
significant 7 bits.

Just wondering if there is a compiler directive to tell VC++ to pack those
bits starting at the msb.  It doesn't really seem like an endianess issue but
rather a compiler preference issue.


/* Chris Faherty <[EMAIL PROTECTED]>                 */
/* Your Stock has crashed - you must now restart your system */


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to