3 #-------------------------------------------------------------------------------
4 # Determine the byte-ordering scheme used by the local machine.
6 cat > endiantest.c
<< ENDIANTEST
11 fill((char *)&x, sizeof(x)); \
12 for (i=1; i<=sizeof(x); i++) { \
13 c=((x>>(byte_size*(sizeof(x)-i)))&mask); \
14 putchar(c==0 ? '?' : (char)c); \
18 void fill(char *p, int size) {
19 char *ab= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
22 for (i=0; i<size; i++) p[i]= ab[i];
25 void endian(int byte_size) {
27 unsigned int mask, i, c;
30 for (i=1; i<=(unsigned)byte_size; i++) mask= (mask<<1)|1;
35 /* Properties of type char */
40 do { c<<=1; byte_size++; } while(c!=0);
54 $CC -o endiantest endiantest.c
56 if [ `./endiantest | cut -c1` = "A" ]
60 byte_order
=LITTLE_ENDIAN
63 rm -f endiantest.c endiantest
66 #-------------------------------------------------------------------------------
67 # Preprocess any Fortran *.F90 files into corresponding *.f files.
71 $CPP $CPPFLAGS -D$byte_order $1 > $bnf
73 #-------------------------------------------------------------------------------