5 #include <simgear/compiler.h>
8 #include "lowlevel.hxx"
10 static const int sgEndianTest = 1;
11 #define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0)
12 #define sgIsBigEndian (*((char *) &sgEndianTest ) == 0)
16 cout << "This machine is ";
17 if ( sgIsLittleEndian ) {
22 cout << "endian" << endl;
25 cout << "short s = " << s << endl;
26 sgEndianSwap((unsigned short *)&s);
27 cout << "short s = " << s << endl;
28 sgEndianSwap((unsigned short *)&s);
29 cout << "short s = " << s << endl;
32 cout << "int i = " << i << endl;
33 sgEndianSwap((unsigned int *)&i);
34 cout << "int i = " << i << endl;
35 sgEndianSwap((unsigned int *)&i);
36 cout << "int i = " << i << endl;
38 double x = 1111111111;
39 cout << "double x = " << x << endl;
40 sgEndianSwap((unsigned long long *)&x);
41 cout << "double x = " << x << endl;
42 sgEndianSwap((unsigned long long *)&x);
43 cout << "double x = " << x << endl;