next up previous contents
Next: SUSWAPBYTES - Swap the Up: Byte Swapping Previous: Byte Swapping   Contents

SWAPBYTES - Swap the Bytes of Binary (non-SU) Data

If you transport binary data (data without SU headers) between platforms of a different ``endian'' (that is to say, the IEEE byte-order), from the one you are working on, then you will have to swap the bytes to make use of that data.

This problem arises because the order of the mantissa and exponent of binary data comes in two different possible order under the IEEE data standard. The so-called ``big-endian'' or high-byte IEEE format is found on SGI, SUN, IBM RS6000, and all Motorola chip-based systems. The ``little-endian'' or low-byte systems are systems that are based on Intel and Dec chips.

The program swapbytes is provided to do this for a variety of data format types, but not SU data. For example,

% swapbytes < data.bin in=float  >data.swap
will swap the bytes in a file of containing C-style floating point numbers.



John Stockwell 2007-04-10