head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.38; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.55; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.54.01; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.21.57; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# lowtest.cxx

    00001 #include <simgear/compiler.h>
    00002
    00003 #include STL_IOSTREAM
    00004 #include "lowlevel.hxx"
    00005
    00006 #if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
    00007 SG_USING_STD(cout);
    00008 SG_USING_STD(endl);
    00009 #endif
    00010
    00011
    00012 static const int sgEndianTest = 1;
    00013 #define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0)
    00014 #define sgIsBigEndian    (*((char *) &sgEndianTest ) == 0)
    00015
    00016
    00017 int main() {
    00018     cout << "This machine is ";
    00019     if ( sgIsLittleEndian ) {
    00020         cout << "little ";
    00021     } else {
    00022         cout << "big ";
    00023     }
    00024     cout << "endian" << endl;
    00025
    00026     cout << "sizeof(short) = " << sizeof(short) << endl;
    00027
    00028     short s = 1111;
    00029     cout << "short s = " << s << endl;
    00030     sgEndianSwap((unsigned short *)&s);
    00031     cout << "short s = " << s << endl;
    00032     sgEndianSwap((unsigned short *)&s);
    00033     cout << "short s = " << s << endl;
    00034
    00035     int i = 1111111;
    00036     cout << "int i = " << i << endl;
    00037     sgEndianSwap((unsigned int *)&i);
    00038     cout << "int i = " << i << endl;
    00039     sgEndianSwap((unsigned int *)&i);
    00040     cout << "int i = " << i << endl;
    00041
    00042     double x = 1111111111;
    00043     cout << "double x = " << x << endl;
    00044     sgEndianSwap((unsigned long long *)&x);
    00045     cout << "double x = " << x << endl;
    00046     sgEndianSwap((unsigned long long *)&x);
    00047     cout << "double x = " << x << endl;
    00048 }

@ 1.3 log @Oops, try again. @ text @d57 1 a57 1