# fx64 Type Macros

## Description

FX64_SHIFT | Defines the shift number (12) for `fx64` types.
FX64_INT_SIZE | Defines the bit width of the integer portion (51) for `fx64` types.
FX64_DEC_SIZE | Defines the bit width for the decimal portion (12) for `fx64` types.
FX64_INT_MASK | Defines the mask for the integer portion of `fx64` types.
FX64_DEC_MASK | Defines the mask (`0x0fff`) for the decimal portion of `fx64` types.
FX64_SIGN_MASK | Defines the mask for the sign portion of `fx64` types.
FX64_MAX | Defines the maximum value that can be obtained with `fx64` types.
FX64_MIN | Defines the minimum value that can be obtained with `fx64` types.

## Macro Definitions

    #define FX64_SHIFT          12
    #define FX64_INT_SIZE       51
    #define FX64_DEC_SIZE       12

    #define FX64_INT_MASK       ((fx64)0x7ffffffffffff000)
    #define FX64_DEC_MASK       ((fx64)0x0000000000000fff)
    #define FX64_SIGN_MASK      ((fx64)0x8000000000000000)

    #define FX64_MAX            ((fx64)0x7fffffffffffffff)
    #define FX64_MIN            ((fx64)0x8000000000000000)
    #define FX_FX64_TO_F32(x)   ((f32)((x) / (f32)(1 << FX64_SHIFT)))
    #define FX_F32_TO_FX64(x)   ((fx64)(((x) > 0) ? \
                                        ((x) * (1 << FX32_SHIFT) + 0.5f ) : \
                                        ((x) * (1 << FX32_SHIFT) - 0.5f )))

    #define FX64_CONST(x)       FX_F32_TO_FX64(x)

## Revision History

2004/02/25 Initial version.

CONFIDENTIAL