Re: Routine for converting 80x87 doubles to XDR (IEEE) format? [message #1169] |
Wed, 07 July 1993 12:53  |
ryba
Messages: 33 Registered: October 1992
|
Member |
|
|
In article <1993Jul6.212653.13279@ll.mit.edu>, ryba@ll.mit.edu (Marty Ryba) writes:
|> I'd like to read in some data dumped from a PC that includes some
|> 8-byte reals. BYTEORDER only does byte swaps for shorts (2 bytes) and
|> longs (4 bytes). If I recall, the 80x87 uses IEEE format, but with the
|> "little endian" format of the Intel chip. Is that correct? If so, I just
|> need an extended byte-order to do an 8-byte swap. If not, a canned routine
|> to do the conversion would be nice.
Thanks to Bill Thompson and some other reading, here's the result:
pro dblswap,arr
; Procedure to byte-swap 8-byte reals
sa = size(arr)
atype = sa(sa(0)+1)
if atype ne 5 then message,'Only for double precision numbers!'
npts = sa(sa(0)+2)
temp = byte(arr,0,8,npts) ; Convert to bytes
temp = rotate(temporary(temp),5) ; Matrix rotation
arr(0) = double(temp,0,npts) ; Convert back to double
return
end
--
Dr. Marty Ryba | Generation X:
MIT Lincoln Laboratory | Too young to be cynical,
ryba@ll.mit.edu | too old to be optimistic.
Of course nothing I say here is official policy!!!!
|
|
|