7 /*===========================================================================*
9 *===========================================================================*/
10 unsigned conv2(norm
, w
)
11 int norm
; /* TRUE if no swap, FALSE for byte swap */
12 int w
; /* promotion of 16-bit word to be swapped */
14 /* Possibly swap a 16-bit word between 8086 and 68000 byte order. */
15 if (norm
) return( (unsigned) w
& 0xFFFF);
16 return( ((w
&BYTE
) << 8) | ( (w
>>8) & BYTE
));
20 /*===========================================================================*
22 *===========================================================================*/
24 int norm
; /* TRUE if no swap, FALSE for byte swap */
25 long x
; /* 32-bit long to be byte swapped */
27 /* Possibly swap a 32-bit long between 8086 and 68000 byte order. */
31 if (norm
) return(x
); /* byte order was already ok */
32 lo
= conv2(FALSE
, (int) x
& 0xFFFF); /* low-order half, byte swapped */
33 hi
= conv2(FALSE
, (int) (x
>>16) & 0xFFFF); /* high-order half, swapped */
34 l
= ( (long) lo
<<16) | hi
;