SUBROUTINE GB_IBYT ( ibyt, n, sign, int, iret ) C************************************************************************ C* GB_IBYT * C* * C* This subroutine returns the integer value represented by N bytes, * C* the integer values of which are stored in IBYT. IBYT (1) is the * C* most significant byte. If SIGN is .TRUE., the first bit of * C* IBYT (1) is taken as a sign bit. * C* * C* GB_IBYT ( IBYT, N, SIGN, INT, IRET ) * C* * C* Input parameters: * C* IBYT (N) INTEGER Array of byte values * C* N INTEGER Number of byte values * C* SIGN LOGICAL Flag for sign bit * C* * C* Output parameters: * C* INT INTEGER Integer value * C* IRET INTEGER Return code * C* 0 = normal return * C** * C* Log: * C* K. Brill/NMC 5/91 * C************************************************************************ INTEGER ibyt (*) LOGICAL sign C* C----------------------------------------------------------------------- iret = 0 C C* Get the integer value represented by the bytes. C int = 0 IF ( n .gt. 1 ) THEN DO i = 1, n-1 int = ( int + ibyt (i) ) * 256 END DO END IF int = int + ibyt (n) C* IF ( sign ) THEN itop = ( 256 ** n ) / 2 IF ( int .ge. itop ) int = itop - int END IF C* RETURN C* END