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 #44017] Wed, 11 May 2005 15:50 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
<savoie@nsidc.org> wrote in message
news:ywkufywtwmdq.fsf@snowblower.colorado.edu...
> David Fanning <davidf@dfanning.com> writes:
>
>
>
>> What I am still not clear about, however, is whether whatever
>> the hell it is that RSI is doing is done *consistently*
>> across all machine architectures. Anyone have a theory about
>> that? :-)
>
> It seems pretty clear to me what's happening is what lajos previously
> stated. But the more I tried to articulate that, the less sense it made.
> Anyway, on my two machines,
>
>
> Linux little endian:
> ------------------
>
> IDL> tmp = bytarr(20)
> tmp = bytarr(20)
> IDL> tmp[15] = 5
> tmp[15] = 5
> IDL> print, fix(tmp[15]), fix(tmp,15)
> print, fix(tmp[15]), fix(tmp,15)
> 5 5
>
> On a Big Endian IRIX64 machine
> ----------------------------
> IDL> tmp=bytarr(20)
> IDL> tmp[15] = 5
> IDL> print, fix(tmp[15]), fix(tmp,15)
> 5 1280
>
>
> I don't even know if this helps.

I think you are exactly right, but to get David's consistency across
platforms:

IDL> tmp = bytarr(20)
IDL> tmp[15] = 5
IDL> result=fix(tmp,15)
IDL> print,result ; This should vary across platforms
5
IDL> swap_endian_inplace, result, /swap_if_little_endian
IDL> print,result ; This should be consistent across platforms
1280

(the reader will guess I'm on an Intel box, someone please test this
elsewhere!)

Now, there are still two issues that are for David to decide:
- do you really want /swap_if_little_endian or /swap_if_big_endian?
(either will give a consistent result)
- do you really want the bytes starting at an offset that is not a
multiple of the size of the type you're casting it to (Fix: 2 bytes)?

Hope this helps!

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
[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: Sat Oct 11 03:59:49 PDT 2025

Total time taken to generate the page: 1.75796 seconds