      LOGICAL FUNCTION LENDIAN()
C
C     * MARCH 2003 ALAN W. IRWIN
C     * MARCH 2003 FOUAD MAJAESS MODIFIED TO WORK ON NEC.
C     *
C     * LENDIAN RETURNS "TRUE" IF RUNNING ON LITTLE-ENDIAN HARDWARE.
C     * OTHERWISE FOR BIG-ENDIAN HARDWARE IT RETURNS FALSE.
      IMPLICIT NONE
      INTEGER*4 ENDIAN4
      CHARACTER*1 CENDIAN(4)
      EQUIVALENCE(ENDIAN4, CENDIAN(1))
      DATA ENDIAN4/Z'01020304'/
C    ASSUMING "ASCII" CHARACTERS SET:
C      ON LITTLE-ENDIAN MACHINES CENDIAN(3) WILL BE 2.
C      ON BIG-ENDIAN MACHINES CENDIAN(3) WILL BE 3.
C     write(*,*) endian4
      LENDIAN = ICHAR(CENDIAN(3)).EQ.2
      END
