






      BYTE FUNCTION GVFBMX(BROW,NUM)















      IMPLICIT      NONE
      INTEGER       NUM, I



      BYTE          BROW(NUM)




      GVFBMX=0



      IF (NUM.GT.0) THEN



         GVFBMX=BROW(1)
         DO 10 I=1,NUM
            IF (BROW(I).GT.GVFBMX) GVFBMX=BROW(I)
   10    CONTINUE
         RETURN
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSC84')
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSC85',NUM)
      END IF

      RETURN
      END
      INTEGER FUNCTION GVFBSM(BVEC,NUM)

















      IMPLICIT      NONE
      INTEGER       NUM, I



      BYTE          BVEC(NUM)


      GVFBSM=0
      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            GVFBSM=GVFBSM+BVEC(I)
   10    CONTINUE
         RETURN
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSC86')
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSC87',NUM)
      END IF

      RETURN
      END
      SUBROUTINE GVSB0V (BROW,N,AVE,ADEV,SDEV,VAR,SKEW,CURT,NON0)
























      IMPLICIT      NONE
      INTEGER       N, TEMP, NON0, J



      BYTE          BROW(N)

      REAL         AVE, ADEV, SDEV, VAR, SKEW, CURT, S, P



      IF (N.LE.1) THEN
         CALL GVSTTI ('?TLSC88',N)
         RETURN
      END IF



      ADEV=0.
      VAR=0.
      SKEW=0.
      CURT=0.
      NON0=0



      S=0.0
      DO 10 J=1,N
         IF (BROW(J).NE.0) THEN
            TEMP=BROW(J)
            S=S+FLOAT(TEMP)
            NON0=NON0+1
         END IF
   10 CONTINUE
      AVE=S/NON0



      DO 20 J=1,N
         IF (BROW(J).NE.0) THEN
             TEMP=BROW(J)
             S=FLOAT(TEMP)-AVE
             ADEV=ADEV+ABS(S)
             P=S*S
             VAR=VAR+P
             P=P*S
             SKEW=SKEW+P
             P=P*S
             CURT=CURT+P
         END IF
   20 CONTINUE
      ADEV=ADEV/N
      VAR=VAR/(N-1)
      SDEV=SQRT(VAR)
      IF (VAR.NE.0.) THEN
         SKEW=SKEW/(N*SDEV**3)
         CURT=CURT/(N*VAR**2)-3.
      ELSE
         CALL GVSTT6 ('?TLSC89')
         SKEW=0.0
         CURT=0.0
      END IF

      RETURN
      END
      SUBROUTINE GVSBAV (BROW,N,AVE,ADEV,SDEV,VAR,SKEW,CURT)





















      IMPLICIT      NONE
      INTEGER       N, TEMP, J



      BYTE          BROW(N)

      REAL          AVE, ADEV, SDEV, VAR, SKEW, CURT, S, P



      IF (N.LE.1) THEN
         CALL GVSTTI ('?TLSC90',N)
         RETURN
      END IF



      S=0.0
      DO 10 J=1,N
         TEMP=BROW(J)
         S=S+FLOAT(TEMP)
   10 CONTINUE
      AVE=S/N



      ADEV=0.
      VAR=0.
      SKEW=0.
      CURT=0.
      DO 20 J=1,N
         TEMP=BROW(J)
         S=FLOAT(TEMP)-AVE
         ADEV=ADEV+ABS(S)
         P=S*S
         VAR=VAR+P
         P=P*S
         SKEW=SKEW+P
         P=P*S
         CURT=CURT+P
   20 CONTINUE
      ADEV=ADEV/N
      VAR=VAR/(N-1)
      SDEV=SQRT(VAR)
      IF (VAR.NE.0.) THEN
         SKEW=SKEW/(N*SDEV**3)
         CURT=CURT/(N*VAR**2)-3.
      ELSE
         CALL GVSTT6 ('?TLSC89')
         SKEW=0.0
         CURT=0.0
      END IF

      RETURN
      END
      SUBROUTINE GVSBRT (RA, RB, N)



















      IMPLICIT      NONE
      INTEGER       L, IR, I, J, N



      BYTE          RA(N), RB(N), RRA, RRB




      IF (N.LT.2) THEN
         CALL GVSTTI ('?TLSC91',N)
         RETURN
      END IF



      L=N/2+1
      IR=N
   10 CONTINUE
         IF (L.GT.1) THEN
            L=L-1
            RRA=RA(L)
            RRB=RB(L)
         ELSE
            RRA=RA(IR)
            RRB=RB(IR)
            RA(IR)=RA(1)
            RB(IR)=RB(1)
            IR=IR-1
            IF(IR.EQ.1)THEN
               RA(1)=RRA
               RB(1)=RRB
               RETURN
            END IF
         END IF
         I=L
         J=L+L
   20    IF(J.LE.IR)THEN
            IF(J.LT.IR)THEN
               IF(RA(J).LT.RA(J+1))J=J+1
            END IF
            IF(RRA.LT.RA(J))THEN
               RA(I)=RA(J)
               RB(I)=RB(J)
               I=J
               J=J+J
            ELSE
               J=IR+1
            END IF
            GO TO 20
         END IF
         RA(I)=RRA
         RB(I)=RRB
      GO TO 10

      END
      SUBROUTINE GVSBY0 (BYTES,NUM)















      IMPLICIT      NONE
      INTEGER       NUM, I



      BYTE          BYTES(NUM)


      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            BYTES(I) = 0
   10    CONTINUE
         RETURN
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSC92')
         RETURN
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSC93',NUM)
      END IF

      RETURN
      END
      SUBROUTINE GVSBYC (BROW,ICON,NUM)
















      IMPLICIT      NONE
      INTEGER       NUM, I, ICON



      BYTE          BROW(NUM)

      LOGICAL       GVFIBN



      IF (.NOT.GVFIBN(ICON,-127,128)) THEN
         CALL GVSTTB ('?TLSC96')
         RETURN
      END IF
      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            BROW(I) = ICON
   10    CONTINUE
         RETURN
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSC94')
         RETURN
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSC95',NUM)
      END IF

      RETURN
      END
      SUBROUTINE GVSWBP (BYTE1,BYTE2)











      IMPLICIT      NONE



      BYTE          TEMP, BYTE1, BYTE2


      TEMP=BYTE1
      BYTE1=BYTE2
      BYTE2=TEMP

      RETURN
      END
      SUBROUTINE BYTSWP (K)











      IMPLICIT    NONE
      INTEGER*4 I,K



      BYTE I1(4),J

      EQUIVALENCE(I1,I)
      I=K
      J=I1(1)
      I1(1)=I1(4)
      I1(4)=J
      J=I1(2)
      I1(2)=I1(3)
      I1(3)=J
      K=I
      RETURN
      END
