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

Home » Public Forums » archive » Re: Double-Precision Byte Swap
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: Double-Precision Byte Swap [message #11590 is a reply to message #11588] Wed, 29 April 1998 00:00 Go to previous messageGo to previous message
rkj is currently offline  rkj
Messages: 66
Registered: February 1996
Member
: Assuming that the data are IEEE double-precision (almost certainly), yes, you
: just need to reverse the order of each number's 8 bytes.
: (But note that if it's Digital Unix that you're using then you should NOT
: re-order.)

: I don't use PV-Wave, but here's a little IDL routine for the job:
: ;==================================
: ; Reverse the byte order of a whatever
: pro byterev,v
: j=size(v) &nj=n_elements(j) &t=j(nj-2) &n=j(nj-1)
: if (t le 1) or (t ge 7) then return ;undefined, or inappropriate type
: case t of
: 2:byteorder,v,/sswap ;short
: 3:byteorder,v,/lswap ;long
: 4:byteorder,v,/lswap ;float
: 5:begin &for i=0L,n-1L do v(i)=double(rotate(byte(v(i),0,8),2),0) &end ;double
: 6:byteorder,v,/lswap ;complex (it works, too!)
: endcase
: return
: end
: ;==================================


: Peter Mason


Works like a charm! This ought to be in the user library.

Thanks.

Kyle
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Newbie-Questions: PV-WAVE
Next Topic: Re: IDL5 License Manager on DEC UNIX 4.0d

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

Current Time: Sun Oct 12 10:45:34 PDT 2025

Total time taken to generate the page: 0.95870 seconds