Classes | Defines | Enumerations | Functions

Platform.h File Reference

#include "RakNetTypes.h"
Include dependency graph for Platform.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  u128
union  catFloat32

Defines

#define STRINGIZE(X)   DO_STRINGIZE(X)
#define DO_STRINGIZE(X)   #X
#define ROL8(n, r)   ( ((uint8_t)(n) << (r)) | ((uint8_t)(n) >> ( 8 - (r))) )
#define ROR8(n, r)   ( ((uint8_t)(n) >> (r)) | ((uint8_t)(n) << ( 8 - (r))) )
#define ROL16(n, r)   ( ((uint16_t)(n) << (r)) | ((uint16_t)(n) >> (16 - (r))) )
#define ROR16(n, r)   ( ((uint16_t)(n) >> (r)) | ((uint16_t)(n) << (16 - (r))) )
#define ROL32(n, r)   ( ((uint32_t)(n) << (r)) | ((uint32_t)(n) >> (32 - (r))) )
#define ROR32(n, r)   ( ((uint32_t)(n) >> (r)) | ((uint32_t)(n) << (32 - (r))) )
#define ROL64(n, r)   ( ((uint64_t)(n) << (r)) | ((uint64_t)(n) >> (64 - (r))) )
#define ROR64(n, r)   ( ((uint64_t)(n) >> (r)) | ((uint64_t)(n) << (64 - (r))) )
#define BOSWAP16(n)   ROL16(n, 8)
#define BOSWAP32(n)   ( (ROL32(n, 8) & 0x00ff00ff) | (ROL32(n, 24) & 0xff00ff00) )
#define BOSWAP64(n)   ( ((uint64_t)BOSWAP32((uint32_t)n) << 32) | BOSWAP32((uint32_t)(n >> 32)) )
#define BITCLRHI8(reg, count)   ((uint8_t)((uint8_t)(reg) << (count)) >> (count))
#define BITCLRLO8(reg, count)   ((uint8_t)((uint8_t)(reg) >> (count)) << (count))
#define BITCLRHI16(reg, count)   ((uint16_t)((uint16_t)(reg) << (count)) >> (count))
#define BITCLRLO16(reg, count)   ((uint16_t)((uint16_t)(reg) >> (count)) << (count))
#define BITCLRHI32(reg, count)   ((uint32_t)((uint32_t)(reg) << (count)) >> (count))
#define BITCLRLO32(reg, count)   ((uint32_t)((uint32_t)(reg) >> (count)) << (count))
#define AT_LEAST_2_BITS(n)   ( (n) & ((n) - 1) )
#define LEAST_SIGNIFICANT_BIT(n)   ( (n) & -(n) )
#define IS_POWER_OF_2(n)   ( n && !AT_LEAST_2_BITS(n) )
#define CEIL_UNIT(n, width)   ( ( (n) + (width) - 1 ) / (width) )
#define CEIL(n, width)   ( CEIL_UNIT(n, width) * (width) )
#define STRNCPY(dest, src, size)   { strncpy(dest, src, size); (dest)[(size)-1] = '\0'; }
#define MEMCLR(dest, size)   memset(dest, 0, size)
#define OBJCLR(object)   memset(&(object), 0, sizeof(object))
#define swapBE(n)
#define getBE(n)   (n)
#define getBE16(n)   (n)
#define getBE32(n)   (n)
#define getBE64(n)   (n)

Enumerations

enum  QuadCoords { QUAD_UL, QUAD_LL, QUAD_LR, QUAD_UR }

Functions

void swapLE (uint16_t &n)
void swapLE (uint32_t &n)
void swapLE (uint64_t &n)
uint16_t getLE (uint16_t n)
uint32_t getLE (uint32_t n)
uint64_t getLE (uint64_t n)
uint16_t getLE16 (uint16_t n)
uint32_t getLE32 (uint32_t n)
uint64_t getLE32 (uint64_t n)
void swapLE (int16_t &n)
void swapLE (int32_t &n)
void swapLE (int64_t &n)
int16_t getLE (int16_t n)
int32_t getLE (int32_t n)
int64_t getLE (int64_t n)
float getLE (float n)

Define Documentation

#define AT_LEAST_2_BITS (   n  )     ( (n) & ((n) - 1) )

Definition at line 150 of file Platform.h.

#define BITCLRHI16 (   reg,
  count 
)    ((uint16_t)((uint16_t)(reg) << (count)) >> (count))

Definition at line 142 of file Platform.h.

#define BITCLRHI32 (   reg,
  count 
)    ((uint32_t)((uint32_t)(reg) << (count)) >> (count))

Definition at line 144 of file Platform.h.

#define BITCLRHI8 (   reg,
  count 
)    ((uint8_t)((uint8_t)(reg) << (count)) >> (count))

Definition at line 140 of file Platform.h.

#define BITCLRLO16 (   reg,
  count 
)    ((uint16_t)((uint16_t)(reg) >> (count)) << (count))

Definition at line 143 of file Platform.h.

#define BITCLRLO32 (   reg,
  count 
)    ((uint32_t)((uint32_t)(reg) >> (count)) << (count))

Definition at line 145 of file Platform.h.

#define BITCLRLO8 (   reg,
  count 
)    ((uint8_t)((uint8_t)(reg) >> (count)) << (count))

Definition at line 141 of file Platform.h.

#define BOSWAP16 (   n  )     ROL16(n, 8)

Definition at line 129 of file Platform.h.

#define BOSWAP32 (   n  )     ( (ROL32(n, 8) & 0x00ff00ff) | (ROL32(n, 24) & 0xff00ff00) )

Definition at line 132 of file Platform.h.

#define BOSWAP64 (   n  )     ( ((uint64_t)BOSWAP32((uint32_t)n) << 32) | BOSWAP32((uint32_t)(n >> 32)) )

Definition at line 135 of file Platform.h.

#define CEIL (   n,
  width 
)    ( CEIL_UNIT(n, width) * (width) )

Definition at line 158 of file Platform.h.

#define CEIL_UNIT (   n,
  width 
)    ( ( (n) + (width) - 1 ) / (width) )

Definition at line 156 of file Platform.h.

#define DO_STRINGIZE (   X  )     #X

Definition at line 71 of file Platform.h.

#define getBE (   n  )     (n)

Definition at line 236 of file Platform.h.

#define getBE16 (   n  )     (n)

Definition at line 237 of file Platform.h.

#define getBE32 (   n  )     (n)

Definition at line 238 of file Platform.h.

#define getBE64 (   n  )     (n)

Definition at line 239 of file Platform.h.

#define IS_POWER_OF_2 (   n  )     ( n && !AT_LEAST_2_BITS(n) )

Definition at line 152 of file Platform.h.

#define LEAST_SIGNIFICANT_BIT (   n  )     ( (n) & -(n) )

Definition at line 151 of file Platform.h.

#define MEMCLR (   dest,
  size 
)    memset(dest, 0, size)

Definition at line 170 of file Platform.h.

#define OBJCLR (   object  )     memset(&(object), 0, sizeof(object))

Definition at line 173 of file Platform.h.

#define ROL16 (   n,
  r 
)    ( ((uint16_t)(n) << (r)) | ((uint16_t)(n) >> (16 - (r))) )

Definition at line 108 of file Platform.h.

#define ROL32 (   n,
  r 
)    ( ((uint32_t)(n) << (r)) | ((uint32_t)(n) >> (32 - (r))) )

Definition at line 114 of file Platform.h.

#define ROL64 (   n,
  r 
)    ( ((uint64_t)(n) << (r)) | ((uint64_t)(n) >> (64 - (r))) )

Definition at line 120 of file Platform.h.

#define ROL8 (   n,
  r 
)    ( ((uint8_t)(n) << (r)) | ((uint8_t)(n) >> ( 8 - (r))) )

Definition at line 102 of file Platform.h.

#define ROR16 (   n,
  r 
)    ( ((uint16_t)(n) >> (r)) | ((uint16_t)(n) << (16 - (r))) )

Definition at line 111 of file Platform.h.

#define ROR32 (   n,
  r 
)    ( ((uint32_t)(n) >> (r)) | ((uint32_t)(n) << (32 - (r))) )

Definition at line 117 of file Platform.h.

#define ROR64 (   n,
  r 
)    ( ((uint64_t)(n) >> (r)) | ((uint64_t)(n) << (64 - (r))) )

Definition at line 123 of file Platform.h.

#define ROR8 (   n,
  r 
)    ( ((uint8_t)(n) >> (r)) | ((uint8_t)(n) << ( 8 - (r))) )

Definition at line 105 of file Platform.h.

#define STRINGIZE (   X  )     DO_STRINGIZE(X)

Definition at line 70 of file Platform.h.

#define STRNCPY (   dest,
  src,
  size 
)    { strncpy(dest, src, size); (dest)[(size)-1] = '\0'; }

Definition at line 166 of file Platform.h.

#define swapBE (   n  ) 

Definition at line 235 of file Platform.h.


Enumeration Type Documentation

enum QuadCoords
Enumerator:
QUAD_UL 
QUAD_LL 
QUAD_LR 
QUAD_UR 

Definition at line 90 of file Platform.h.


Function Documentation

uint16_t getLE ( uint16_t  n  )  [inline]

Definition at line 244 of file Platform.h.

uint32_t getLE ( uint32_t  n  )  [inline]

Definition at line 245 of file Platform.h.

int64_t getLE ( int64_t  n  )  [inline]

Definition at line 255 of file Platform.h.

float getLE ( float  n  )  [inline]

Definition at line 257 of file Platform.h.

uint64_t getLE ( uint64_t  n  )  [inline]

Definition at line 246 of file Platform.h.

int16_t getLE ( int16_t  n  )  [inline]

Definition at line 253 of file Platform.h.

int32_t getLE ( int32_t  n  )  [inline]

Definition at line 254 of file Platform.h.

uint16_t getLE16 ( uint16_t  n  )  [inline]

Definition at line 247 of file Platform.h.

uint32_t getLE32 ( uint32_t  n  )  [inline]

Definition at line 248 of file Platform.h.

uint64_t getLE32 ( uint64_t  n  )  [inline]

Definition at line 249 of file Platform.h.

void swapLE ( int64_t n  )  [inline]

Definition at line 252 of file Platform.h.

void swapLE ( uint64_t n  )  [inline]

Definition at line 243 of file Platform.h.

void swapLE ( uint16_t n  )  [inline]

Definition at line 241 of file Platform.h.

void swapLE ( int16_t n  )  [inline]

Definition at line 250 of file Platform.h.

void swapLE ( int32_t n  )  [inline]

Definition at line 251 of file Platform.h.

void swapLE ( uint32_t n  )  [inline]

Definition at line 242 of file Platform.h.