conv2()函数根据机器类型交换大小端数据。
PUBLIC unsigned conv2(norm, w) int norm; /* TRUE if no swap, FALSE for byte swap */ int w; /* promotion of 16-bit word to be swapped */ { /* Possibly swap a 16-bit word between 8086 and 68000 byte order. */ if (norm) return( (unsigned) w & 0xFFFF); return( ((w&BYTE) << 8) | ( (w>>8) & BYTE)); }
另有conv4()函数,有类似功能,定义为
21360 _PROTOTYPE( unsigned conv2, (int norm, int w) ); 21361 _PROTOTYPE( long conv4, (int norm, long x) );
有宏定义,标示需不需要交换
21056 #define BYTE_SWAP 0 /* tells conv2/conv4 to swap bytes */