12345678910111213141516171819202122232425262728293031323334353637 |
- #include "fs.h"
- #include "buf.h"
- #include "inode.h"
- #include "super.h"
- /*===========================================================================*
- * conv2 *
- *===========================================================================*/
- 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 *
- *===========================================================================*/
- long conv4(norm, x)
- int norm; /* TRUE if no swap, FALSE for byte swap */
- long x; /* 32-bit long to be byte swapped */
- {
- /* Possibly swap a 32-bit long between 8086 and 68000 byte order. */
- unsigned lo, hi;
- long l;
-
- if (norm) return(x); /* byte order was already ok */
- lo = conv2(FALSE, (int) x & 0xFFFF); /* low-order half, byte swapped */
- hi = conv2(FALSE, (int) (x>>16) & 0xFFFF); /* high-order half, swapped */
- l = ( (long) lo <<16) | hi;
- return(l);
- }
|