Intel machines store numbers with LSByte in the left position. Motorola (and PA_RISC) machines use the opposite byte ordering.
This code is written so that: a) it will compile and run on EITHER machine type AND b) the program (on either machine) will process tiff file written in either Motorola or Intel format.
The code is compiled with a __NATIVE__ define which is either MOTO or INTEL. MOTO and INTEL are defined (above) to be the value of the first two bytes of a tiff file in either format. (This identifies the filetype).
Subsequent reads and writes normally just reverse the byte order if the machine type (__NATIVE__) is not equal to the filetype determined from the first two bytes of the tiff file.
A special case is the "value" field of the tag structure. This can contain EITHER a 16bit or a 32bit value. According to the "type" field. The 4 cases of machine type / file type combinations need to be treated differently in the case of 16 bit values