fx64c Type Macros

Description

FX64C_SHIFT Defines the shift number (32) for fx64c types.
FX64C_INT_SIZE Defines the bit width of the integer portion (31) for fx64c types.
FX64C_DEC_SIZE Defines the bit width for the decimal portion (32) for fx64c types.
FX64C_INT_MASK Defines the mask (0x7fffffff00000000) for the integer portion of fx64c types.
FX64C_DEC_MASK Defines the mask (0x00000000ffffffff) for the decimal portion of fx64c types.
FX64C_SIGN_MASK Defines the mask (0x8000000000000000) for the sign portion of fx64c types.
FX64C_MAX Defines the maximum value that can be obtained with fx64c types.
FX64C_MIN Defines the minimum value that can be obtained with fx64c types.
FX_FX64C_TO_F32 Converts an fx64c type to an f32 type.
FX_F32_TO_FX64C FX64C_CONST Converts an f32 type to an fx64 type.

Macro Definitions

#define FX64C_SHIFT          32
#define FX64C_INT_SIZE       31
#define FX64C_DEC_SIZE       32

#define FX64C_INT_MASK       ((fx64c)0x7fffffff00000000)
#define FX64C_DEC_MASK       ((fx64c)0x00000000ffffffff)
#define FX64C_SIGN_MASK      ((fx64c)0x8000000000000000)

#define FX64C_MAX            ((fx64c)0x7fffffffffffffff)
#define FX64C_MIN            ((fx64c)0x8000000000000000)
#define FX_FX64C_TO_F32(x)   ((f32)((x) / (f32)(1 << FX64C_SHIFT)))
#define FX_F32_TO_FX64C(x)   ((fx64c)(((x) > 0) ? \
((x) * ((fx64c)1 << FX64C_SHIFT) + 0.5f ) : \
((x) * ((fx64c)1 << FX64C_SHIFT) - 0.5f )))

#define FX64C_CONST(x)      FX_F32_TO_FX64C(x)

Revision History

02/25/2004 Initial version.