Re: Possible Mac OS Bug with FIX. [message #44029 is a reply to message #44028] |
Wed, 11 May 2005 11:31   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
=?ISO-8859-2?Q?F=F6ldy_Lajos?= writes:
> my guess is that the two fix() calls do different things:
>
> - fix(tmp[15]) does convert a 1-byte integer to a 2-byte integer, using
> a conversion instruction in the CPU. The result is the same on all
> architectures.
>
> - fix(tmp, 15) does read memory from the address of tmp[15] as a 2-byte
> integer. No conversion instruction is used, only write (as type A) and
> read (as type B). It is the good old EQUIVALENCE statement from Fortran,
> and is architecture-dependent. Perhaps this should be mentioned in the
> IDL docs :-)
Well, as I say, I understand the problem (and can even
appreciate it), but what I am after is consistency. So,
how architecture-dependent *is* it? Does the same thing
happen on Linux machines? I'm just trying to get a feel
for when I should put the fix in. :-)
One of my sources points out that the procedure
SWAP_ENDIAN_INPLACE is useful, with one of the SWAP_IF_****
keywords is used. I just want to know if I have to use
it only on Macs, or on UNIX machines, or when!?
Is a Macintosh a big or little endian machine?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|