Viewing contents of file '../idllib/uit/pro/byteswap.pro'
PRO byteswap, im
;+
; NAME:
;	BYTESWAP
; CALLING SEQUENCE:
;	byteswap, im
; PURPOSE:
;	To swap the bytes in an image array.
; INPUT/OUTPUT:
;	im  The image array (both input and output).
; COMMON BLOCKS:
;	None
; PROCEDURE:
;	The byteorder procedure is used to perform the conversion.  The
;	form of this conversion depends upon the datatype of the array.
;	If it is of I*2 format, a short integer swap is performed.  If it 
;	is of I*4 format, a long integer swap is performed.  Otherwise, 
;	nothing is done.
; MODIFICATION HISTORY:
;	Written by Michael R. Greason, STX, 30 August 1990.
;-
;			Initialize.
;
s = size(im)
dtype = s(s(0) + 1)			; The datatype.
i2 = 2					; Size type code for I*2.
i4 = 3					; Size type code for I*4.
;
;			If I*2, do a short integer swap.
;
IF (dtype EQ i2) THEN byteorder, im, /sswap ELSE BEGIN
;
;			If I*4, do a long integer swap.
;
	IF (dtype EQ i4) THEN byteorder, im, /lswap
ENDELSE
;
;			Done.
;
RETURN
END