/* bigend.h * * big-endian support functions. * */ #include #if BYTE_ORDER == BIG_ENDIAN # define BIGENDIAN /* This is a big-endian machine MSB is the first Byte */ #elif BYTE_ORDER == LITTLE_ENDIAN # define LITTLEENDIAN /* This is a little-endian machine MSB is the last Byte */ #else # error Endianness undefined #endif typedef struct { BYTE b1, b2; } LEWORD; /* Little-Endian 16-Bit Word */ typedef struct { BYTE d1, d2, d3, d4; } LEDWORD; /* Little-Endian 32-Bit DWord */ #define leword(val) ((val).b1+((val).b2<<8)) #define ledword(val) ((val).d1+((val).d2<<8)+((val).d3<<16)+((val).d4<<24))