CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csendian.h File Reference

Helpers for dealing with endian conversions. More...

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

Go to the source code of this file.

Floating point conversions.

The following routines are used for converting floating-point numbers into 16-bit shorts and back.

This is useful for low-precision data. They use the 1.4.12 format. The range of numbers that can be represented in this format is from 2^-8 to 2^7. The precision for numbers near to 2^-8 (0.00390625) is near 0.000001, for numbers near 2^7 (128) is near 0.03.

short csFloatToShort (float f)
 Convert a float to a cross-platform 16-bit format (no endianess adjustments!).
float csShortToFloat (short s)
 Convert a 16-bit cross-platform float to native format (no endianess adjustments!).

Functions

uint64 csBigEndianLongLong (uint64 l)
 Convert a longlong from big-endian to machine format.
uint32 csBigEndianLong (uint32 l)
 Convert a long from big-endian to machine format.
uint16 csBigEndianShort (uint16 s)
 Convert a short from big-endian to machine format.
float csBigEndianFloat (float f)
 Convert a big-endian floating-point number to machine format.
uint64 csLittleEndianLongLong (uint64 l)
 Convert a longlong from little-endian to machine format.
uint32 csLittleEndianLong (uint32 l)
 Convert a long from little-endian to machine format.
uint16 csLittleEndianShort (uint16 s)
 Convert a short from little-endian to machine format.
float csLittleEndianFloat (float f)
 Convert a little-endian floating-point number to machine format.
int32 csFloatToLong (float f)
 Convert a float to a cross-platform 32-bit format (no endianess adjustments!).
float csLongToFloat (int32 l)
 Convert a 32-bit cross-platform float to native format (no endianess adjustments!).
int64 csDoubleToLongLong (double d)
 Convert a double to a cross-platform 64-bit format (no endianess adjustments!).
double csLongLongToDouble (int64 i)
 Convert a 64-bit cross-platform double to native format (no endianess adjustments!).
uint64 csConvertEndian (uint64 l)
 Swap the bytes in a uint64 value.
int64 csConvertEndian (int64 l)
 Swap the bytes in a int64 value.
uint32 csConvertEndian (uint32 l)
 Swap the bytes in a uint32 value.
int32 csConvertEndian (int32 l)
 Swap the bytes in a int32 value.
int16 csConvertEndian (int16 s)
 Swap the bytes in a int16 value.
uint16 csConvertEndian (uint16 s)
 Swap the bytes in a uint16 value.
float csConvertEndian (float f)
 Swap the bytes in a float value.
uint16 csGetLittleEndianShort (const void *buff)
 Read a little-endian short from address.
uint32 csGetLittleEndianLong (const void *buff)
 Read a little-endian long from address.
float csGetLittleEndianFloat32 (const void *buff)
 Read a little-endian 32-bit float from address.
float csGetLittleEndianFloat16 (const void *buff)
 Read a little-endian 16-bit float from address.
void csSetLittleEndianShort (void *buff, uint16 s)
 Set a little-endian short on a address.
void csSetLittleEndianLong (void *buff, uint32 l)
 Set a little-endian long on a address.
void csSetLittleEndianFloat32 (void *buff, float f)
 Set a little-endian 32-bit float on a address.
void csSetLittleEndianFloat16 (void *buff, float f)
 Set a little-endian 16-bit float on a address.
uint16 csGetBigEndianShort (const void *buff)
 Read a big-endian short from address.
uint32 csGetBigEndianLong (const void *buff)
 Read a big-endian long from address.
float csGetBigEndianFloat32 (const void *buff)
 Read a big-endian 32-bit float from address.
float csGetBigEndianFloat16 (const void *buff)
 Read a big-endian 16-bit float from address.
void csSetBigEndianShort (void *buff, uint16 s)
 Set a big-endian short on a address.
void csSetBigEndianLong (void *buff, uint32 l)
 Set a big-endian long on a address.
void csSetBigEndianFloat32 (void *buff, float f)
 Set a big-endian 32-bit float on a address.
void csSetBigEndianFloat16 (void *buff, float f)
 Set a big-endian 16-bit float on a address.


Detailed Description

Helpers for dealing with endian conversions.

Definition in file csendian.h.


Generated for Crystal Space by doxygen 1.3.9.1