The SWAP_ENDIAN function reverses the byte ordering of arbitrary scalars, arrays or structures. It can make " big endian" number " little endian" and vice-versa. Note that the BYTEORDER procedure can be used to reverse the byte ordering of scalars and arrays (SWAP_ENDIAN also allows structures).

SWAP_ENDIAN returns values of the same type and structure as the input value, with the pertinent bytes reversed.

This routine is written in the IDL language. Its source code can be found in the file swap_endian.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

Result = SWAP_ENDIAN( Variable )



The named variable--scalar, array, or structure--to be swapped.


A = SWAP_ENDIAN(A) ; Reverse the byte order of A

See Also