"Forward byte and reverse bit" ordering will be used for all integer values. This is the same as used in the MC680x0 and SPARC processors, but the reverse of the byte ordering used on the Intel 80x86 processors.
Off+0 Off+1 +-------+-------+ uint_2 | MSB | LSB | +-------+-------+ Off+0 Off+1 Off+2 Off+3 +-------+-------+-------+-------+ uint_4 | MSB | ... | ... | LSB | +-------+-------+-------+-------+
To read integers on systems with any byte order use something like this:
uint_2 read_uint_2(FILE *fp) { unsigned char buf[sizeof(uint_2)]; fread(buf, sizeof(buf), 1, fp); return (uint_2) (((uint_2)buf[1]) + ((uint_2)buf[0]<<8)); } uint_4 read_uint_4(FILE *fp) { unsigned char buf[sizeof(uint_4)]; fread(buf, sizeof(buf), 1, fp); return (uint_4) (((unsigned uint_4)buf[3]) + ((unsigned uint_4)buf[2]<<8) + ((unsigned uint_4)buf[1]<<16) + ((unsigned uint_4)buf[0]<<24)); }