comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: little and big endian -- once more
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: little and big endian -- once more [message #15339 is a reply to message #15338] Wed, 12 May 1999 00:00 Go to previous messageGo to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Martin Schultz wrote:
> took me a while to realize that it is the machine architecture not
> the OS that determines the byte swapping -- in fact I needed to have IDL
> on linux (after using it on an SGI and with Windows) to figure that out
> ... Anyway, I now devised the following test for byte swapping which is
> applied in my open_file routine and handles everything transparently.
> Please tell me if there are any other machine architectures that are big
> endian and what their !version.arch tag would be.

The way I usually handle this is to let the *data* tell me whether
byte-swapping is required. For example, my colleagues generate datafiles
in host order using the same code on SGI and Linux boxes. Rather than me
keeping track of what platform was used to create the data, when I open
the datafile in IDL my code interrogates the data itself to see if
appears to be swapped. There is usually some data item (e.g. a date
and/or time) that can be checked to see if it's in the correct range. If
it's in the correct range, then proceed. If not, check swap_endian(date)
to see if it's in the right range. If it looks ok, swap everything. If
it doesn't look ok, then the data is not in the expected format.

I usually only apply this method to files that others supply to me. If I
want to create platform-independent datafiles, I use netCDF or HDF.

---
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: coherence test implementation
Next Topic: Re: Making an array of structures containing pointers

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Dec 03 00:13:56 PST 2025

Total time taken to generate the page: 3.12430 seconds