GET_ENDIAN()

Fortran version:

    INTEGER FUNCTION  GET_ENDIAN()

C version:

    int get_endian() ;

Summary:

Returns byte-order token for the current platform, as defined by token values in PARMS3.EXT or system include-file /usr/include/endian.h:
BIG_ENDIAN
LITTLE_ENDIAN
PDP_ENDIAN

Preconditions:

none

Fortran Usage:

    ...
    INCLUDE 'PARMS3.EXT'
    ...
    INTEGER   GET_ENDIAN
    INTEGER   IBYTEORDER
    ...
    IBYTEORDER = GET_ENDIAN()
    IF ( IBYTEORDER .EQ. LITTLE_ENDIAN ) THEN
        ...  !!  processing for x86-style byte order
    ELSE IF ( IBYTEORDER .EQ. BIG_ENDIAN ) THEN
        ...  !!  processing for Sun/SGI-style byte order
    ELSE IF ( IBYTEORDER .EQ. PDP_ENDIAN ) THEN
        ...  !!  processing for PDP11-style byte order
    ELSE
        ...  !! something really scrambled:  call M3EXIT()?
    END IF
    ...

C Usage:

    ...
    #include "iodecl3.h"                          
    ...
    int  i ;
    ...
    i = get_endian() ; /*  Now i is byte-order value... */
    ...


Previous: GCD

Next: GETDBLE

Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages