SWAPBYTES - SWAP the BYTES of various data types
swapbytes <stdin [optional parameters] >stdout
Required parameters:
none
Optional parameters:
in=float input
type (float)
=double (double)
=short (short)
=ushort (unsigned short)
=long (long)
=ulong (unsigned long)
=int (int)
outpar=/dev/tty output parameter file, contains the
number
of values (n1=)
Notes:
The byte order of the mantissa of binary data
values on PC's and DEC's
is the
reverse of so called "big endian" machines (IBM RS6000,
SUN,etc.)
hence the need for
byte-swapping capability. The subroutines in this code
have been tested for swapping between PCs and big endian machines, but
have not been tested for DEC products.
Caveat:
2 byte short, 4 byte long, 4 byte float, 4
byte int,
and 8 bit double assumed.
Credits:
CWP: John Stockwell (Jan 1994)
Institut fur Geophysik, Hamburg: Jens Hartmann supplied byte
swapping
subroutines