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 #15340 is a reply to message #15338] Wed, 12 May 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Martin Schultz (mgs@io.harvard.edu) writes:

> 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.

Here is a little function, Martin, that will make sure
your code works without having to track every machine
architecture down. Found it on my web page. :-)

Cheers,

David

*****************************************************
FUNCTION Little_Endian

; Returns 1 if Little-Endian, returns 0 if Big-Endian.

little_endian = (BYTE(1, 0, 1))[0]
RETURN, little_endian
END
*****************************************************

David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[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: Sun Oct 12 04:42:46 PDT 2025

Total time taken to generate the page: 1.91662 seconds