|
IDL Reference Guide: Procedures and Functions |
|
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 The BYTEORDER procedure can be used to reverse the byte ordering of scalars and arrays (SWAP_ENDIAN also allows structures). |
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.
Result = SWAP_ENDIAN(Variable [, /SWAP_IF_BIG_ENDIAN] [, /SWAP_IF_LITTLE_ENDIAN])
SWAP_ENDIAN returns values of the same type and structure as the input value, with the pertinent bytes reversed.
The named variable—scalar, array, or structure—to be swapped.
If this keyword is set, the swap request will only be performed if the platform running IDL uses "big endian" byte ordering. On little endian machines, the SWAP_ENDIAN request quietly returns without doing anything. Note that this keyword does not refer to the byte ordering of the input data, but to the computer hardware.
If this keyword is set, the swap request will only be performed if the platform running IDL uses "little endian" byte ordering. On big endian machines, the SWAP_ENDIAN request quietly returns without doing anything. Note that this keyword does not refer to the byte ordering of the input data, but to the computer hardware.
; Reverse the byte order of A: A = SWAP_ENDIAN(A)
BYTEORDER, SWAP_ENDIAN_INPLACE
IDL Online Help (March 06, 2007)