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

Home » Public Forums » archive » Re: Determining machine endian-ness
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: Determining machine endian-ness [message #12144 is a reply to message #12143] Wed, 01 July 1998 00:00 Go to previous message
mallors is currently offline  mallors
Messages: 76
Registered: November 1997
Member
In article <EvBpCE.Hru@midway.uchicago.edu>,
rivers@cars3.uchicago.edu (Mark Rivers) writes:
>
> 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.
>

Hi,

I think this should do it:

LITTLE_ENDIAN = (BYTE (1, 0, 1))[0]

IF (LITTLE_ENDIAN) THEN $
PRINT, "I'm little endian"


--
Robert S. Mallozzi
http://cspar.uah.edu/~mallozzir/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Important object lesson
Next Topic: Re: Using ASSOC function

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

Current Time: Sun Oct 12 04:39:54 PDT 2025

Total time taken to generate the page: 1.04359 seconds