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

Home » Public Forums » archive » Re: Possible Mac OS Bug with FIX.
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: Possible Mac OS Bug with FIX. [message #44030 is a reply to message #44028] Wed, 11 May 2005 11:10 Go to previous messageGo to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
Hi,

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 :-)

regards,
lajos


On Wed, 11 May 2005, David Fanning wrote:

> Kenneth Bowman writes:
>
>> I think perhaps you want fix(tmp, 14)?
>>
>> IDL> tmp = bytarr(20)
>> IDL> tmp[15] = 5
>> IDL> print, fix(tmp[15])
>> 5
>> IDL> print, fix(tmp, 14)
>> 5
>>
>> I think it is not a question of endianess, but of "which 2 bytes belong to the
>> 2-byte integer".
>
> What we are really looking for is consistency across
> architectures. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using IDL variables from ENVI
Next Topic: Widget_Draw scrollebe but not scrollable ??

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

Current Time: Tue Oct 14 19:21:53 PDT 2025

Total time taken to generate the page: 2.08013 seconds