C     @(#)makei4.f	1.2     03/25/98
C
      integer*4 function makei4 (string)

c Set up a hexadecimal string in a four byte integer

c This routine intended to help with the problem posed by the fact that
c VAX Fortran, Sun Fortran and PC Fortran have different ways of
c initialising integers in hexadecimal.

c  e.g.  iv = makei4('80000000') would set up the most negative possible
c        integer value in iv

      character*(*) string

      lenstr = len(string)
      if (lenstr .ne. 8) call abort ('String must be 8 characters')
      makei4 = 0
      do i = 1, lenstr
        ix = index('0123456789ABCDEF', string(i:i))
        if (ix .eq. 0)
     2    call abort ('Non hexadecimal character in '''//string//'''')
        makei4 = ior(ishft(makei4,4),ix-1)
      end do
      return
      end
