Werner Lemberg pushed to branch master at FreeType / FreeType
Commits:
-
bec4ef41
by Dominik Röttsches at 2022-07-01T14:01:08+02:00
1 changed file:
Changes:
... | ... | @@ -1091,18 +1091,20 @@ |
1091 | 1091 | FT_UInt count )
|
1092 | 1092 | {
|
1093 | 1093 | FT_UInt i;
|
1094 | - FT_Int64 temp = 0;
|
|
1094 | + FT_Int64 temp;
|
|
1095 | +#ifndef FT_INT64
|
|
1096 | + FT_Int64 halfUnit;
|
|
1097 | +#endif
|
|
1095 | 1098 | |
1096 | 1099 | |
1097 | 1100 | #ifdef FT_INT64
|
1101 | + temp = 0;
|
|
1098 | 1102 | |
1099 | 1103 | for ( i = 0; i < count; ++i )
|
1100 | 1104 | temp += (FT_Int64)s[i] * f[i];
|
1101 | 1105 | |
1102 | - return temp >> 16;
|
|
1103 | - |
|
1106 | + return ( temp + 0x8000 ) >> 16;
|
|
1104 | 1107 | #else
|
1105 | - |
|
1106 | 1108 | temp.hi = 0;
|
1107 | 1109 | temp.lo = 0;
|
1108 | 1110 | |
... | ... | @@ -1137,6 +1139,11 @@ |
1137 | 1139 | FT_Add64( &temp, &multResult, &temp );
|
1138 | 1140 | }
|
1139 | 1141 | |
1142 | + /* Round value. */
|
|
1143 | + halfUnit.hi = 0;
|
|
1144 | + halfUnit.lo = 0x8000;
|
|
1145 | + FT_Add64( &temp, &halfUnit, &temp );
|
|
1146 | + |
|
1140 | 1147 | return (FT_Int32)( ( (FT_Int32)( temp.hi & 0xFFFF ) << 16 ) |
|
1141 | 1148 | ( temp.lo >> 16 ) );
|
1142 | 1149 |