FX32_SHIFT | Defines the shift number (12) for fx32 types. |
FX32_INT_SIZE | Defines the bit width of the integer portion (19) for fx32 types. |
FX32_DEC_SIZE | Defines the bit width for the decimal portion (12) for fx32 types. |
FX32_INT_MASK | Defines the mask (0x7ffff000 ) for the integer portion of fx32 types. |
FX32_DEC_MASK | Defines the mask (0x0fff ) for the decimal portion of fx32 types. |
FX32_SIGN_MASK | Defines the mask (0x80000000 ) for the sign portion of fx32 types. |
FX32_MAX | Defines the maximum value (0x7fffffff ) that can be obtained with fx32 types. |
FX32_MIN | Defines the minimum value (0x80000000 ) that can be obtained with fx32 types. |
FX_MUL | Multiplies two fx32 types. |
FX_MUL32x64C | Multiplies an fx32 type and an fx64c type. |
FX_FX32_TO_F32 | Converts an fx32 type to an f32 type. |
FX_F32_TO_FX32 FX32_CONST | Converts an f32 type to an fx32 type. |
#define FX32_SHIFT 12 #define FX32_INT_SIZE 19 #define FX32_DEC_SIZE 12 #define FX32_INT_MASK 0x7ffff000 #define FX32_DEC_MASK 0x00000fff #define FX32_SIGN_MASK 0x80000000 #define FX32_MAX (fx32)(0x7fffffff) #define FX32_MIN (fx32)(0x80000000) #define FX_MUL(v1, v2) ((fx32)(((fx64)(v1) * (v2) + 0x800LL) >> FX32_SHIFT)) #define FX_MUL32x64C(v1, v2) ((fx32)(((v2) * (v1) + 0x80000000LL) >> 32)) #define FX_FX32_TO_F32(x) ((f32)((x) / (f32)(1 << FX32_SHIFT))) #define FX_F32_TO_FX32(x) ((fx32)(((x) > 0) ? \ ((x) * (1 << FX32_SHIFT) + 0.5f ) : \ ((x) * (1 << FX32_SHIFT) - 0.5f ))) #define FX32_CONST(x) FX_F32_TO_FX32(x)
02/25/2004 Initial version.