vegastrike  0.5.1.r1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
In Memory Serialization/Deserialization Functions

Functions

posh_u16_tPOSH_WriteU16ToLittle (void *dst, posh_u16_t value)
 
posh_s16_tPOSH_WriteS16ToLittle (void *dst, posh_s16_t value)
 
posh_u32_tPOSH_WriteU32ToLittle (void *dst, posh_u32_t value)
 
posh_s32_tPOSH_WriteS32ToLittle (void *dst, posh_s32_t value)
 
posh_u16_tPOSH_WriteU16ToBig (void *dst, posh_u16_t value)
 
posh_s16_tPOSH_WriteS16ToBig (void *dst, posh_s16_t value)
 
posh_u32_tPOSH_WriteU32ToBig (void *dst, posh_u32_t value)
 
posh_s32_tPOSH_WriteS32ToBig (void *dst, posh_s32_t value)
 
posh_u16_t POSH_ReadU16FromLittle (const void *src)
 
posh_s16_t POSH_ReadS16FromLittle (const void *src)
 
posh_u32_t POSH_ReadU32FromLittle (const void *src)
 
posh_s32_t POSH_ReadS32FromLittle (const void *src)
 
posh_u16_t POSH_ReadU16FromBig (const void *src)
 
posh_s16_t POSH_ReadS16FromBig (const void *src)
 
posh_u32_t POSH_ReadU32FromBig (const void *src)
 
posh_s32_t POSH_ReadS32FromBig (const void *src)
 

Detailed Description

These functions take host endian values and serialize them into
explicit endianess buffers and vice versa.  The 64-bit versions
of these functions can be found under @ref SixtyFourBit

Here's an example usage that serializes a struct into a big-endian buffer:

*
*  struct mystruct
*  {
*  posh_u16_t u16;
*  posh_s32_t s32;
*  };
*
*  void WriteStruct( void *buffer, const struct mystruct *s )
*  {
*  void *p = buffer;
*
*  //The POSH_Write??? functions return a pointer to the next write address
*  p = POSH_WriteU16ToBig( p, &s->u16 );
*  p = POSH_WriteS32ToBig( p, &s->s32 );
*  }
*
*  

Function Documentation

posh_s16_t POSH_ReadS16FromBig ( const void *  src)

Reads a signed 16-bit value from a big-endian buffer

Parameters
src[in]source buffer
Returns
host-endian signed 16-bit value

Definition at line 562 of file posh.cpp.

posh_s16_t POSH_ReadS16FromLittle ( const void *  src)

Reads a signed 16-bit value from a little-endian buffer

Parameters
src[in]source buffer
Returns
host-endian signed 16-bit value

Definition at line 522 of file posh.cpp.

posh_s32_t POSH_ReadS32FromBig ( const void *  src)

Reads a signed 32-bit value from a big-endian buffer

Parameters
src[in]source buffer
Returns
host-endian signed 32-bit value

Definition at line 582 of file posh.cpp.

posh_s32_t POSH_ReadS32FromLittle ( const void *  src)

Reads a signed 32-bit value from a little-endian buffer

Parameters
src[in]source buffer
Returns
host-endian signed 32-bit value

Definition at line 542 of file posh.cpp.

posh_u16_t POSH_ReadU16FromBig ( const void *  src)

Reads an unsigned 16-bit value from a big-endian buffer

Parameters
src[in]source buffer
Returns
host-endian unsigned 16-bit value

Definition at line 552 of file posh.cpp.

posh_u16_t POSH_ReadU16FromLittle ( const void *  src)

Reads an unsigned 16-bit value from a little-endian buffer

Parameters
src[in]source buffer
Returns
host-endian unsigned 16-bit value

Definition at line 512 of file posh.cpp.

posh_u32_t POSH_ReadU32FromBig ( const void *  src)

Reads an unsigned 32-bit value from a big-endian buffer

Parameters
src[in]source buffer
Returns
host-endian unsigned 32-bit value

Definition at line 572 of file posh.cpp.

posh_u32_t POSH_ReadU32FromLittle ( const void *  src)

Reads an unsigned 32-bit value from a little-endian buffer

Parameters
src[in]source buffer
Returns
host-endian unsigned 32-bit value

Definition at line 532 of file posh.cpp.

posh_s16_t* POSH_WriteS16ToBig ( void *  dst,
posh_s16_t  value 
)

Writes a signed 16-bit value to a big endian buffer

Parameters
dst[out]pointer to the destination buffer, may not be NULL
value[in]host-endian signed 16-bit value
Returns
a pointer to the location two bytes after dst
Remarks
does no validation of the inputs. This simply calls POSH_WriteU16ToLittle() with appropriate casting.

Definition at line 398 of file posh.cpp.

posh_s16_t* POSH_WriteS16ToLittle ( void *  dst,
posh_s16_t  value 
)

Writes a signed 16-bit value to a little endian buffer

Parameters
dst[out]pointer to the destination buffer, may not be NULL
value[in]host-endian signed 16-bit value
Returns
a pointer to the location two bytes after dst
Remarks
does no validation of the inputs. This simply calls POSH_WriteU16ToLittle() with appropriate casting.

Definition at line 336 of file posh.cpp.

posh_s32_t* POSH_WriteS32ToBig ( void *  dst,
posh_s32_t  value 
)

Writes a signed 32-bit value to a big endian buffer

Parameters
dst[out]pointer to the destination buffer, may not be NULL
value[in]host-endian signed 32-bit value
Returns
a pointer to the location four bytes after dst
Remarks
does no validation of the inputs. This simply calls POSH_WriteU32ToBig() with appropriate casting.

Definition at line 429 of file posh.cpp.

posh_s32_t* POSH_WriteS32ToLittle ( void *  dst,
posh_s32_t  value 
)

Writes a signed 32-bit value to a little endian buffer

Parameters
dst[out]pointer to the destination buffer, may not be NULL
value[in]host-endian signed 32-bit value
Returns
a pointer to the location four bytes after dst
Remarks
does no validation of the inputs. This simply calls POSH_WriteU32ToLittle() with appropriate casting.

Definition at line 367 of file posh.cpp.

posh_u16_t* POSH_WriteU16ToBig ( void *  dst,
posh_u16_t  value 
)

Writes an unsigned 16-bit value to a big endian buffer

Parameters
dst[out]pointer to the destination buffer, may not be NULL
value[in]host-endian unsigned 16-bit value
Returns
a pointer to the location two bytes after dst
Remarks
does no validation of the inputs

Definition at line 380 of file posh.cpp.

posh_u16_t* POSH_WriteU16ToLittle ( void *  dst,
posh_u16_t  value 
)

Writes an unsigned 16-bit value to a little endian buffer

Parameters
dst[out]pointer to the destination buffer, may not be NULL
value[in]host-endian unsigned 16-bit value
Returns
a pointer to the location two bytes after dst
Remarks
does no validation of the inputs

Definition at line 318 of file posh.cpp.

posh_u32_t* POSH_WriteU32ToBig ( void *  dst,
posh_u32_t  value 
)

Writes an unsigned 32-bit value to a big endian buffer

Parameters
dst[out]pointer to the destination buffer, may not be NULL
value[in]host-endian unsigned 32-bit value
Returns
a pointer to the location four bytes after dst
Remarks
does no validation of the inputs.

Definition at line 411 of file posh.cpp.

posh_u32_t* POSH_WriteU32ToLittle ( void *  dst,
posh_u32_t  value 
)

Writes an unsigned 32-bit value to a little endian buffer

Parameters
dst[out]pointer to the destination buffer, may not be NULL
value[in]host-endian signed 32-bit value
Returns
a pointer to the location four bytes after dst
Remarks
does no validation of the inputs.

Definition at line 349 of file posh.cpp.