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

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::Host::CEndian Class Reference

List of all members.

## Detailed Description

Endian conversion routines and byte swapping.

Date:
  09/04/2006

Author:
  Paul Chana

Version:
  1.0.0 Initial version

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  CEndian.hpp,v 1.5 2007/02/08 21:06:44 paul Exp

Definition at line 27 of file CEndian.hpp.

## Public Types

- enum EEndian {
  e_littleEndian = 0,
  e_bigEndian
  }
    Enurmeration of endianess. More...

## Static Public Member Functions

- static int convertThreeBytesToTwentyFourBitInt (const char *bytes)
- static void convertTwentyFourBitIntToThreeBytes (const int value, char *bytes)
- static CEndian::EEndian getSystemEndianessCompileTime ()
- static CEndian::EEndian getSystemEndianessRunTime ()
- static void swap2Bytes (unsigned char *buffer)
- static unsigned int swapDataBytesIfSystemIsBigEndian (unsigned int bytes)
- static unsigned short swapDataBytesIfSystemIsBigEndian (unsigned short bytes)
- static void swapFourBytesIfSystemIsLittleEndian (unsigned char *buffer)

## Member Enumeration Documentation

enum Exponent::Host::CEndian::EEndian

Enurmeration of endianess.

Enumerator:

  e_littleEndian | Little endian systems, INTEL WIN32 MACOSX_UNIBIN
  e_bigEndian | Big endian, MACOSX

Definition at line 37 of file CEndian.hpp.

## Member Function Documentation

static int Exponent::Host::CEndian::convertThreeBytesToTwentyFourBitInt | ( | const char * | bytes | ) | `[static]`

Convert three bytes to a 24 bit int, uses full 32 bit integer range

Parameters:

  | bytes | The three data bytes

Return values:

  | int | The 24 bit int value, in range -0x80000000 to 0x7fffffff

static void Exponent::Host::CEndian::convertTwentyFourBitIntToThreeBytes | ( | const int | value,
|  | char * | bytes |
| ) |  |  | `[static]`

Convert three bytes to a 24 bit int, uses full 32 bit integer range

Parameters:

  | value | The value to convert in range -0x80000000 to 0x7fffffff
  | bytes | The three data bytes

static CEndian::EEndian Exponent::Host::CEndian::getSystemEndianessCompileTime | ( |  | ) | `[static]`

Get the endianness of a system at compile time

Return values:

  | EEndian | The endianess of the system

static CEndian::EEndian Exponent::Host::CEndian::getSystemEndianessRunTime | ( |  | ) | `[static]`

Get the endianness of a system at run time

Return values:

  | EEndian | The endianess of the system

static void Exponent::Host::CEndian::swap2Bytes | ( | unsigned char * | buffer | ) | `[static]`

Swap 2 bytes

Parameters:

  | buffer | Pointer to two chars that is swapped

static unsigned int Exponent::Host::CEndian::swapDataBytesIfSystemIsBigEndian | ( | unsigned int | bytes | ) | `[static]`

Swap the bytes if we are a big endian system

Parameters:

  | bytes | The data bytes

Return values:

  | unsigned | int The data bytes swap if big endian

static unsigned short Exponent::Host::CEndian::swapDataBytesIfSystemIsBigEndian | ( | unsigned short | bytes | ) | `[static]`

Swap the bytes if we are a big endian system

Parameters:

  | bytes | The data bytes

Return values:

  | unsigned | short The data bytes swap if big endian

static void Exponent::Host::CEndian::swapFourBytesIfSystemIsLittleEndian | ( | unsigned char * | buffer | ) | `[static]`

Swap four bytes if system is little endian

Parameters:

  | buffer | Pointer to two chars that is swapped, expected to be 4 bytes long