- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- File List
- File Members

# CEndian.hpp

Go to the documentation of this file.

    00001 #ifndef __CEndian__
    00002 #define __CEndian__
    00003
    00004 //  ===========================================================================
    00005
    00006 namespace Exponent
    00007 {
    00008     namespace Host
    00009     {
    00027         class CEndian
    00028         {
    00029         public:
    00030
    00031 //  ===========================================================================
    00032
    00037             enum EEndian
    00038             {
    00039                 e_littleEndian = 0,
    00040                 e_bigEndian,
    00041             };
    00042
    00043 //  ===========================================================================
    00044
    00049             static CEndian::EEndian getSystemEndianessRunTime();
    00050
    00055             static CEndian::EEndian getSystemEndianessCompileTime();
    00056
    00057 //  ===========================================================================
    00058
    00064             static int convertThreeBytesToTwentyFourBitInt(const char *bytes);
    00065
    00071             static void convertTwentyFourBitIntToThreeBytes(const int value, char *bytes);
    00072
    00078             static unsigned short swapDataBytesIfSystemIsBigEndian(unsigned short bytes);
    00079
    00085             static unsigned int swapDataBytesIfSystemIsBigEndian(unsigned int bytes);
    00086
    00091             static void swap2Bytes(unsigned char *buffer);
    00092
    00097             static void swapFourBytesIfSystemIsLittleEndian(unsigned char *buffer);
    00098
    00099 //  ===========================================================================
    00100         };
    00101     }
    00102 }
    00103 #endif  // End of CEndian.hpp