Main Page | Modules | File List | Globals | Related Pages

64-bit Support


Detailed Description

POSH provides a set of 64-bit integer types, macros and functions.

It does not attempt to emulate 64-bit integer support on compilers that do not have this capability natively.

You can test for the presence of 64-bit integer support by checking to see if POSH_64BIT_INTEGER is defined.

Types

POSH exports a signed and unsigned 64-bit type, posh_s64_t and posh_u64_t.

64-bit Constants

Different compilers require different ways to specify a 64-bit constant. POSH solves this by providing the cross-platform macros POSH_U64() and POSH_I64() to define unsigned and signed 64-bit constant values respectively.

Byte Swapping

64-bit version of the standard POSH byte swapping functions are available and documented on this page.

Serialization

64-bit versions of the standard POSH serialization functions are available and documented on this page.


Defines

#define POSH_I64_PRINTF_PREFIX
 Constant string suitable for use as a printf modifier, e.g.

#define POSH_I64(x)
 Macro to make a constant signed 64-bit value.

#define POSH_U64(x)
 Macro to make a constant unsigned 64-bit value.

#define POSH_LittleU64(x)   (x)
 Convert native to 64-bit unsigned little-endian.

#define POSH_LittleI64(x)   (x)
 Convert native to 64-bit signed little-endian.

#define POSH_BigU64(x)   POSH_SwapU64(x)
 Convert native to 64-bit unsigned big-endian.

#define POSH_BigI64(x)   POSH_SwapI64(x)
 Convert native to 64-bit signed big-endian.


Functions

posh_u64_t POSH_SwapU64 (posh_u64_t v)
 Byte swaps a 64-bit unsigned value.

posh_i64_t POSH_SwapI64 (posh_i64_t v)
 Byte swaps a 64-bit signed value.

posh_u64_tPOSH_WriteU64ToLittle (void *dst, posh_u64_t value)
 Writes an unsigned 64-bit value to a little-endian buffer.

posh_i64_tPOSH_WriteI64ToLittle (void *dst, posh_i64_t value)
 Writes a signed 64-bit value to a little-endian buffer.

posh_u64_tPOSH_WriteU64ToBig (void *dst, posh_u64_t value)
 Writes an unsigned 64-bit value to a big-endian buffer.

posh_i64_tPOSH_WriteI64ToBig (void *dst, posh_i64_t value)
 Writes a signed 64-bit value to a big-endian buffer.


Define Documentation

#define POSH_I64  ) 
 

Macro to make a constant signed 64-bit value.

This is a compiler specific type definition for a 64-bit constant value. You can test for the presence of this macro by seeing if POSH_64BIT_INTEGER is defined.

#define POSH_I64_PRINTF_PREFIX
 

Constant string suitable for use as a printf modifier, e.g.

printf( "%"POSH_I64_PRINTF_PREFIX"i
", some_64bit_value );

#define POSH_U64  ) 
 

Macro to make a constant unsigned 64-bit value.

This is a compiler specific type definition for a 64-bit constant value. You can test for the presence of this macro by seeing if POSH_64BIT_INTEGER is defined.


Function Documentation

posh_i64_t POSH_SwapI64 posh_i64_t  v  ) 
 

Byte swaps a 64-bit signed value.

Parameters:
v [in] a 64-bit input value to swap
Returns:
a byte swapped version of v

Definition at line 386 of file posh.c.

References posh_i64_t, POSH_SwapU64(), and posh_u64_t.

posh_u64_t POSH_SwapU64 posh_u64_t  v  ) 
 

Byte swaps a 64-bit unsigned value.

Parameters:
v [in] a 64-bit input value to swap
Returns:
a byte swapped version of v

Definition at line 360 of file posh.c.

References posh_byte_t, and posh_u64_t.

Referenced by POSH_SwapI64().

posh_i64_t* POSH_WriteI64ToBig void *  dst,
posh_i64_t  value
 

Writes a signed 64-bit value to a big-endian buffer.

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

Definition at line 623 of file posh.c.

References posh_i64_t, posh_u64_t, and POSH_WriteU64ToBig().

posh_i64_t* POSH_WriteI64ToLittle void *  dst,
posh_i64_t  value
 

Writes a signed 64-bit value to a little-endian buffer.

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

Definition at line 584 of file posh.c.

References posh_i64_t, posh_u64_t, and POSH_WriteU64ToLittle().

posh_u64_t* POSH_WriteU64ToBig void *  dst,
posh_u64_t  value
 

Writes an unsigned 64-bit value to a big-endian buffer.

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

Definition at line 599 of file posh.c.

References posh_byte_t, and posh_u64_t.

Referenced by POSH_WriteI64ToBig().

posh_u64_t* POSH_WriteU64ToLittle void *  dst,
posh_u64_t  value
 

Writes an unsigned 64-bit value to a little-endian buffer.

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

Definition at line 560 of file posh.c.

References posh_byte_t, and posh_u64_t.

Referenced by POSH_WriteI64ToLittle().


Generated on Tue Jan 31 18:27:36 2006 for POSH by doxygen 1.3.7