By default floating point support is enabled, but if you find that this causes problems or is inconvenient and you're not using the support, you can define POSH_NO_FLOAT to disable POSH's use of any floating point types or operations.
Here are some code examples:
//read a little-endian float from disk float LoadFloat( FILE *fp ) { float f; posh_u32_t u32; fread( &u32, sizeof( u32 ), 1, fp ); f = POSH_FloatFromLittleBits( u32 ); return f; } //write a little-endian float to disk void WriteFloat( FILE *fp, float f ) { posh_u32_t u32; u32 = POSH_LittleFloatBits( f ); fwrite( &u32, sizeof( u32 ), 1, fp ); }
Functions | |
| posh_u32_t | POSH_LittleFloatBits (float f) |
| posh_u32_t | POSH_BigFloatBits (float f) |
| Extracts raw big-endian bits from a 32-bit floating point value. | |
| void | POSH_DoubleBits (double d, posh_byte_t dst[8]) |
| Extracts raw, little-endian bit representation from a 64-bit double. | |
| double | POSH_DoubleFromBits (const posh_byte_t src[8]) |
| Creates a double-precision, 64-bit floating point value from a set of raw, little-endian bits. | |
| float | POSH_FloatFromLittleBits (posh_u32_t bits) |
| Creates a floating point number from little endian bits. | |
| float | POSH_FloatFromBigBits (posh_u32_t bits) |
| Creates a floating point number from big-endian bits. | |
|
|
Extracts raw big-endian bits from a 32-bit floating point value.
Definition at line 857 of file posh.c. References POSH_BigU32, and posh_u32_t. |
|
||||||||||||
|
Extracts raw, little-endian bit representation from a 64-bit double.
Definition at line 879 of file posh.c. References posh_byte_t. |
|
|
Creates a double-precision, 64-bit floating point value from a set of raw, little-endian bits.
Definition at line 923 of file posh.c. References posh_byte_t. |
|
|
Creates a floating point number from big-endian bits.
Definition at line 990 of file posh.c. References POSH_SwapU32(), and posh_u32_t. |
|
|
Creates a floating point number from little endian bits.
Definition at line 964 of file posh.c. References POSH_SwapU32(), and posh_u32_t. |
|
|
Definition at line 836 of file posh.c. References POSH_LittleU32, and posh_u32_t. |
1.3.7