X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



4349 Rate this article:
No rating

Byte ordering schemes used by IDL platforms


When reading data, created by a Sun Sparc machine, on a Windows XP machine it turns out to be nonsense? Why is this so?
This problem is the result of how machines store data. Sun Sparc machines are "Big Endian" machines, meaning that multiple byte integers are stored in memory beginning with the most significant byte. On the other hand, Windows XP machines are "Little Endian", meaning that multiple byte integers are stored in memory beginning with the least significant byte. To read data written by the Sun Sparc with the Windows XP machine or vice versa use the SWAP_ENDIAN function with either the SWAP_IF_LITTLE_ENDIAN or SWAP_IF_BIG_ENDIAN keyword.

Note
The keyword does not refer to the byte ordering of the input data, but to the byte ordering of the computer hardware.

If using the SWAP_ENDIAN function seems cumbersome then consider writing out the files using the XDR keyword. For example:
    ;Open a file for XDR output.
    OPENW, /XDR, 1, 'data.dat'

XDR is a machine independent format, that allows data written on one machine to be read transparently on any other machine.


PROCESSOR TYPE OPERATING SYSTEM BYTE ORDERING

Intel X86 Linux little-endian

Solaris X86 little-endian

Windows little-endian

Macintosh little-endian
Sun Sparc SunOS big-endian

Solaris big-endian


Another easy way to determine the byte ordering for your system from an IDL prompt is to issue the command:
    print,'This machine is: ', byte(1,0)?'little endian':'big endian'
Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »