C---------------------------------------------------------------------- subroutine ftswi8(buffer,npix) C C swap 8 successive bytes in values to convert to/from IEEE. C if the original byte order is: 1 2 3 4 5 6 7 8 C the output order is: 8 7 6 5 4 3 2 1 C C buffer i input buffer of bytes to be swapped C npix i number of 8 bytes-words to be swapped C C written by Wm Pence, HEASARC/GSFC, Dec 1996 C The equivalence statements in this algorithm cause errors with C the Linux NAG F90 compiler. C integer npix, i C double precision buffer(npix),temp1,temp2 C logical*1 l1(8), l2(8) C equivalence (temp1,l1) C equivalence (temp2,l2) C C do 10 i=1,npix C temp1=buffer(i) C l2(8)=l1(1) C l2(7)=l1(2) C l2(6)=l1(3) C l2(5)=l1(4) C l2(4)=l1(5) C l2(3)=l1(6) C l2(2)=l1(7) C l2(1)=l1(8) C buffer(i)=temp2 C10 continue C alternate swapping algorithm, Wm Pence, April 97 integer npix,i8 logical*1 buffer(npix*8),temp do 10 i8=8,npix*8,8 C swap 1st and 8th bytes temp=buffer(i8-7) buffer(i8-7)=buffer(i8) buffer(i8)=temp C swap 2nd and 7th bytes temp=buffer(i8-6) buffer(i8-6)=buffer(i8-1) buffer(i8-1)=temp C swap 3rd and 6th bytes temp=buffer(i8-5) buffer(i8-5)=buffer(i8-2) buffer(i8-2)=temp C swap 4th and 5th bytes temp=buffer(i8-4) buffer(i8-4)=buffer(i8-3) buffer(i8-3)=temp 10 continue end