55 #define CF2_FIXED_EPSILON ( (CF2_Fixed)0x0001 )
56
57 /* in C 89, left and right shift of negative numbers is */
58 /* implementation specific behaviour in the general case */
59
60 #define cf2_intToFixed( i ) \
61 ( (CF2_Fixed)( (FT_UInt32)(i) << 16 ) )
62 #define cf2_fixedToInt( x ) \
63 ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
64 #define cf2_fixedRound( x ) \
65 ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) )
66 #define cf2_doubleToFixed( f ) \
67 ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) )
68 #define cf2_fixedAbs( x ) \
69 ( (x) < 0 ? NEG_INT32( x ) : (x) )
70 #define cf2_fixedFloor( x ) \
71 ( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) )
72 #define cf2_fixedFraction( x ) \
73 ( (x) - cf2_fixedFloor( x ) )
74 #define cf2_fracToFixed( x ) \
75 ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 ) \
76 : ( ( (x) + 0x2000 ) >> 14 ) )
77
78
79 /* signed numeric types */
80 typedef enum CF2_NumberType_
81 {
82 CF2_NumberFixed, /* 16.16 */
83 CF2_NumberFrac, /* 2.30 */
84 CF2_NumberInt /* 32.0 */
85
86 } CF2_NumberType;
87
88
89 FT_END_HEADER
90
91
92 #endif /* PSFIXED_H_ */
93
94
95 /* END */
|
55 #define CF2_FIXED_EPSILON ( (CF2_Fixed)0x0001 )
56
57 /* in C 89, left and right shift of negative numbers is */
58 /* implementation specific behaviour in the general case */
59
60 #define cf2_intToFixed( i ) \
61 ( (CF2_Fixed)( (FT_UInt32)(i) << 16 ) )
62 #define cf2_fixedToInt( x ) \
63 ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
64 #define cf2_fixedRound( x ) \
65 ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) )
66 #define cf2_doubleToFixed( f ) \
67 ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) )
68 #define cf2_fixedAbs( x ) \
69 ( (x) < 0 ? NEG_INT32( x ) : (x) )
70 #define cf2_fixedFloor( x ) \
71 ( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) )
72 #define cf2_fixedFraction( x ) \
73 ( (x) - cf2_fixedFloor( x ) )
74 #define cf2_fracToFixed( x ) \
75 ( ( (x) + 0x2000 - ( (x) < 0 ) ) >> 14 )
76
77
78 /* signed numeric types */
79 typedef enum CF2_NumberType_
80 {
81 CF2_NumberFixed, /* 16.16 */
82 CF2_NumberFrac, /* 2.30 */
83 CF2_NumberInt /* 32.0 */
84
85 } CF2_NumberType;
86
87
88 FT_END_HEADER
89
90
91 #endif /* PSFIXED_H_ */
92
93
94 /* END */
|