OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftmisc.h */ | 3 /* ftmisc.h */ |
4 /* */ | 4 /* */ |
5 /* Miscellaneous macros for stand-alone rasterizer (specification */ | 5 /* Miscellaneous macros for stand-alone rasterizer (specification */ |
6 /* only). */ | 6 /* only). */ |
7 /* */ | 7 /* */ |
8 /* Copyright 2005, 2009, 2010 by */ | 8 /* Copyright 2005, 2009, 2010 by */ |
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
10 /* */ | 10 /* */ |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if ( a < 0 ) { a = -a; s = -1; } | 108 if ( a < 0 ) { a = -a; s = -1; } |
109 if ( b < 0 ) { b = -b; s = -s; } | 109 if ( b < 0 ) { b = -b; s = -s; } |
110 if ( c < 0 ) { c = -c; s = -s; } | 110 if ( c < 0 ) { c = -c; s = -s; } |
111 | 111 |
112 d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c | 112 d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c |
113 : 0x7FFFFFFFL ); | 113 : 0x7FFFFFFFL ); |
114 | 114 |
115 return ( s > 0 ) ? d : -d; | 115 return ( s > 0 ) ? d : -d; |
116 } | 116 } |
117 | 117 |
| 118 |
| 119 static FT_Long |
| 120 FT_MulDiv_No_Round( FT_Long a, |
| 121 FT_Long b, |
| 122 FT_Long c ) |
| 123 { |
| 124 FT_Int s; |
| 125 FT_Long d; |
| 126 |
| 127 |
| 128 s = 1; |
| 129 if ( a < 0 ) { a = -a; s = -1; } |
| 130 if ( b < 0 ) { b = -b; s = -s; } |
| 131 if ( c < 0 ) { c = -c; s = -s; } |
| 132 |
| 133 d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c |
| 134 : 0x7FFFFFFFL ); |
| 135 |
| 136 return ( s > 0 ) ? d : -d; |
| 137 } |
| 138 |
118 #endif /* __FTMISC_H__ */ | 139 #endif /* __FTMISC_H__ */ |
119 | 140 |
120 | 141 |
121 /* END */ | 142 /* END */ |
OLD | NEW |