C---------------------------------------------------------------------- subroutine ftswi4(buffer,npix) C C swap 4 successive bytes in values to convert to/from IEEE. C if the original byte order is: 1 2 3 4 C the output order is: 4 3 2 1 C C buffer i input buffer of bytes to be swapped C npix i number of 4 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 integer buffer(npix) C integer*4 temp1,temp2 C logical*1 l1(4), l2(4) C equivalence (temp1,l1) C equivalence (temp2,l2) C C do 10 i=1,npix C temp1=buffer(i) C l2(4)=l1(1) C l2(3)=l1(2) C l2(2)=l1(3) C l2(1)=l1(4) C buffer(i)=temp2 C10 continue C alternate swapping algorithm, Wm Pence, April 97 integer npix,i4 logical*1 buffer(npix*4),temp do 10 i4=4,npix*4,4 C swap 1st and 4th bytes temp=buffer(i4-3) buffer(i4-3)=buffer(i4) buffer(i4)=temp C swap 2nd and 3rd bytes temp=buffer(i4-2) buffer(i4-2)=buffer(i4-1) buffer(i4-1)=temp 10 continue end