## Public API Reference

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

- File List
- File Members

# csutil/csendian.h File Reference

Helpers for dealing with endian conversions. More...

`#include <math.h>`
`#include "cstypes.h"`

Go to the source code of this file.

## Classes

struct | csBigEndian
| Big endian to native conversion routines. More...
struct | csGetFromAddress
| Sized data type access helpers. More...
struct | csIEEEfloat
| Convert IEEE 32-bit floats from or to native machine floats. More...
struct | csLittleEndian
| Little endian to native conversion routines. More...
struct | csSetToAddress
| Sized data type access helpers. More...
struct | csSwapBytes
| Methods to unconditionally swap the byte order of specifically sized types. More...

## Deprecated endian conversion routines

It is recommended to use csLittleEndian, csBigEndian, csIEEEfloat, csGetFromAddress or csSetToAddress for the tasks below.
static float | csBigEndianFloat (float f)
| Convert a big-endian floating-point number to machine format.
static uint32 | csBigEndianLong (uint32 l)
| Convert a long from big-endian to machine format.
static uint64 | csBigEndianLongLong (uint64 l)
| Convert a longlong from big-endian to machine format.
static uint16 | csBigEndianShort (uint16 s)
| Convert a short from big-endian to machine format.
static int64 | csDoubleToLongLong (double d)
| Convert a double to a cross-platform 64-bit format (no endianess adjustments!).
static int32 | csFloatToLong (float f)
| Convert a float to a cross-platform 32-bit format (no endianess adjustments!).
static short | csFloatToShort (float f)
| Convert a float to a cross-platform 16-bit format (no endianess adjustments!).
static float | csLittleEndianFloat (float f)
| Convert a little-endian floating-point number to machine format.
static uint32 | csLittleEndianLong (uint32 l)
| Convert a long from little-endian to machine format.
static uint64 | csLittleEndianLongLong (uint64 l)
| Convert a longlong from little-endian to machine format.
static uint16 | csLittleEndianShort (uint16 s)
| Convert a short from little-endian to machine format.
static double | csLongLongToDouble (int64 i)
| Convert a 64-bit cross-platform double to native format (no endianess adjustments!).
static float | csLongToFloat (int32 l)
| Convert a 32-bit cross-platform float to native format (no endianess adjustments!).
static float | csShortToFloat (short s)
| Convert a 16-bit cross-platform float to native format (no endianess adjustments!).

## Defines

#define | csQroundSure(x) (int ((x) + ((x < 0) ? -0.5 : +0.5)))

## Functions

static float | csConvertEndian (float f)
| Convert bytes in a float value from host byte order to little-endian.
static uint16 | csConvertEndian (uint16 s)
| Convert a uint16 value from host byte order to little-endian.
static int16 | csConvertEndian (int16 s)
| Convert a int16 value from host byte order to little-endian.
static int32 | csConvertEndian (int32 l)
| Convert a int32 value from host byte order to little-endian.
static uint32 | csConvertEndian (uint32 l)
| Convert a uint32 value from host byte order to little-endian.
static int64 | csConvertEndian (int64 l)
| Convert a int64 value from host byte order to little-endian.
static uint64 | csConvertEndian (uint64 l)
| Convert a uint64 value from host byte order to little-endian.
float | csGetLittleEndianFloat16 (const void *buff)
| Read a little-endian 16-bit float from address.
float | csGetLittleEndianFloat32 (const void *buff)
| Read a little-endian 32-bit float from address.
uint32 | csGetLittleEndianLong (const void *buff)
| Read a little-endian long from address.
uint16 | csGetLittleEndianShort (const void *buff)
| Read a little-endian short from address.

## Detailed Description

Helpers for dealing with endian conversions.

Definition in file csendian.h.