C---------------------------------------------------------------------- subroutine ftgi2b(iunit,nvals,incre,i2vals,status) C Read an array of Integer*2 bytes from the input FITS file. C Does any required translation from FITS to internal machine format integer nvals,iunit,incre,status,offset integer*2 i2vals(nvals) C iunit i fortran unit number C nvals i number of pixels to read C incre i byte increment between values C i2vals i*2 output array of integer*2 values C status i output error status integer compid common/ftcpid/compid integer ierr,ieg2cray,i,nloop,fpixel,ntodo integer*2 temp(4) character ctemp*1 if (incre .le. 2)then call ftgbyt(iunit,nvals*2,i2vals,status) else C offset is the number of bytes to move between each value offset=incre-2 call ftgbyo(iunit,2,nvals,offset,i2vals,status) end if if (compid .eq. 0)then C big endian machine (e.g., SUN) doesn't need byte swapping else if (compid .eq. -1)then C SUN F90 compiler maps I*2 -> I*4; have to unpack bytes call ftupi2(i2vals,nvals,ctemp) else if (compid .ge. 1)then C little endian machine (e.g. DEC, VAX, or PC) must be byte swapped call ftswby(i2vals,nvals) else C must be a CRAY C convert from IEEE I*2 to cray I*8 C have to use a temporary array if nvals = 2 or 3 if (nvals .le. 3)then ierr=ieg2cray(7,nvals,i2vals,0,temp,1,' ') do 5 i=1,nvals i2vals(i)=temp(i) 5 continue else C have to work backwards, so as to not overwrite the input data nloop=(nvals-1)/4+1 fpixel = (nloop*4)-3 ntodo=nvals-(nloop-1)*4 do 10 i=nloop,1,-1 ierr=ieg2cray(7,ntodo,i2vals(i),0,i2vals(fpixel),1,' ') fpixel=fpixel-4 ntodo=4 10 continue end if end if end