1 #include <simgear/compiler.h>
4 #include "lowlevel.hxx"
6 static const int sgEndianTest = 1;
7 #define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0)
8 #define sgIsBigEndian (*((char *) &sgEndianTest ) == 0)
12 cout << "This machine is ";
13 if ( sgIsLittleEndian ) {
18 cout << "endian" << endl;
21 cout << "short s = " << s << endl;
22 sgEndianSwap((unsigned short *)&s);
23 cout << "short s = " << s << endl;
24 sgEndianSwap((unsigned short *)&s);
25 cout << "short s = " << s << endl;
28 cout << "int i = " << i << endl;
29 sgEndianSwap((unsigned int *)&i);
30 cout << "int i = " << i << endl;
31 sgEndianSwap((unsigned int *)&i);
32 cout << "int i = " << i << endl;
34 double x = 1111111111;
35 cout << "double x = " << x << endl;
36 sgEndianSwap((unsigned long long *)&x);
37 cout << "double x = " << x << endl;
38 sgEndianSwap((unsigned long long *)&x);
39 cout << "double x = " << x << endl;