11 lines
574 B
Text
11 lines
574 B
Text
typedef jint32 jfixed;
|
|
|
|
#define J_FIXED_FRACTION_BITS 16
|
|
#define J_FIXED_WHOLE_BITS (32 - J_FIXED_FRACTION_BITS)
|
|
#define jfixedToFloat(F) ((float)((F) * ((float)(1) / (float)(1 << J_FIXED_FRACTION_BITS))))
|
|
#define floatToJfixed(F) ((jfixed)((F) * (1 << J_FIXED_FRACTION_BITS)))
|
|
#define fAdd(A,B) ((A) + (B))
|
|
#define fSub(A,B) ((A) - (B))
|
|
#define fMul(A,B) ((jfixed)(((jfixed)(A) * (jfixed)(B)) >> J_FIXED_FRACTION_BITS))
|
|
#define fDiv(A,B) ((jfixed)(((jfixed)(A) << J_FIXED_FRACTION_BITS) / (jfixed)(B)))
|
|
|