       SUBROUTINE SWAPI2(DATA,N)     
       INTEGER N
       INTEGER*2 DATA(N)
C
C----------------------------------------------------------------------
C
C.IDENTIFICATION: Function   SWAPI2
C.LIBRARY:        GENERAL
C.AUTHOR:         L.Chiappetti - IFCTR Milano
C.VERSIONS:       1.0 -  5 Nov 92 - Original version
C.PURPOSE:        byte-swap an INTEGER*2 array or scalar (N=1)           
C.METHOD:         use an equivalence with a CHARACTER array
C.SYNTAX:         CALL SWAPI2(DATA,N)                   
C.PARAMETERS:     INTEGER*2 DATA    the stuff to be swapped (in and out)
C-                INTEGER   N       number of elements in array
C.RESTRICTIONS:   none 
C.NOTES:          this code should be portable ... though may be slightly
C                 inefficient   
C.FILES:          none
C.REFERENCES:     none
C---------------------------------------------------------------------------
C
       INTEGER*2    WORK
       CHARACTER    C(2),W                   
       EQUIVALENCE  (WORK,C)
       INTEGER      I
C
       IF(N.LE.0)RETURN
       DO 1 I=1,N
       WORK=DATA(I)
       W=C(1)
       C(1)=C(2)
       C(2)=W
       DATA(I)=WORK
 1     CONTINUE
       RETURN
       END
