Determining machine endian-ness [message #12161] |
Mon, 29 June 1998 00:00  |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
Is there a way to determine whether the machine on which IDL is executing is
big endian or little endian? I am trying to read a data file which I know
contains little-endian data. I need to byte swap this data if IDL is running
on a big-endian machine, but not byte-swap if it is running on a little-endian
machine.
It would be nice there were a field in !VERSION which contained this
information. Right now I am testing if !VERSION.ARCH eq 'x26', 'alpha', etc.
There must be a better way.
____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)
or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
|
|
|
Re: Determining machine endian-ness [message #12211 is a reply to message #12161] |
Wed, 08 July 1998 00:00  |
reuss
Messages: 3 Registered: June 1997
|
Junior Member |
|
|
In article <callen-0207982206350001@192.168.22.98>, callen@bga.com (Charles Allen) wrote:
>> With IDL 4.0+, !VERSION tells you if your operating system is UNIX or WIN32. I
>> would use this to determine if I need to byte-swap on some occassions.
>
> This can't be a good idea, as IDL runs under Linux and FreeBSD on Intel boxes.
What about !version.arch?
Matthias
|
|
|
Re: Determining machine endian-ness [message #12214 is a reply to message #12161] |
Tue, 07 July 1998 00:00  |
Mike Schienle
Messages: 37 Registered: May 1997
|
Member |
|
|
Is there a way to determine whether the machine on which
IDL is executing is
big endian or little endian? I am trying to read a data
file which I know
contains little-endian data. I need to byte swap this
data if IDL is running
on a big-endian machine, but not byte-swap if it is
running on a little-endian
machine.
Thanks to all the replies from someone who did not make the request. I
walked in today to a question in my inbox asking about the endian of my
system so some data could be generated. Good timing folks!
Mike Schienle
|
|
|
Re: Determining machine endian-ness [message #12218 is a reply to message #12161] |
Mon, 06 July 1998 00:00  |
Kelly Dean
Messages: 92 Registered: March 1997
|
Member |
|
|
That is why my prefer method is to check a number in the input data field. I only
use !VERSION if I know what machines and version of IDL I am writing for.
Kelly
Charles Allen wrote:
>> With IDL 4.0+, !VERSION tells you if your operating system is UNIX or WIN32. I
>> would use this to determine if I need to byte-swap on some occassions. However,
>
> This can't be a good idea, as IDL runs under Linux and FreeBSD on Intel boxes.
>
> -- Charles Allen -- callen@bga.com --
|
|
|