1 #include <simgear/compiler.h>
4 #include "lowlevel.hxx"
6 #if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
12 static const int sgEndianTest = 1;
13 #define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0)
14 #define sgIsBigEndian (*((char *) &sgEndianTest ) == 0)
18 cout << "This machine is ";
19 if ( sgIsLittleEndian ) {
24 cout << "endian" << endl;
27 cout << "short s = " << s << endl;
28 sgEndianSwap((unsigned short *)&s);
29 cout << "short s = " << s << endl;
30 sgEndianSwap((unsigned short *)&s);
31 cout << "short s = " << s << endl;
34 cout << "int i = " << i << endl;
35 sgEndianSwap((unsigned int *)&i);
36 cout << "int i = " << i << endl;
37 sgEndianSwap((unsigned int *)&i);
38 cout << "int i = " << i << endl;
40 double x = 1111111111;
41 cout << "double x = " << x << endl;
42 sgEndianSwap((unsigned long long *)&x);
43 cout << "double x = " << x << endl;
44 sgEndianSwap((unsigned long long *)&x);
45 cout << "double x = " << x << endl;