Varie correzioni, completata revisione capitolo sull'I/O su file
[gapil.git] / listati / endian.c
1 int endian(void)
2 {
3 /*
4  * Variables definition
5  */
6     short magic, test;
7     char * ptr;
8    
9     magic = 0xABCD;                     /* endianess magic number */
10     ptr = (char *) &magic;              
11     test = (ptr[1]<<8) + (ptr[0]&0xFF); /* build value byte by byte */
12     return (magic == test);             /* if the same is little endian */ 
13 }