aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexei Podtelezhnikov <apodtele@gmail.com>2023-08-25 17:57:47 +0000
committerAlexei Podtelezhnikov <apodtele@gmail.com>2023-08-25 17:57:47 +0000
commit0c817334b708a83425ce5b86448c4d6a26ebbc76 (patch)
tree1c5b9eaf5bb877a659d756c08fe754835cf5a651
parentd42679b93d5e77fe769591cd1d04522225940556 (diff)
downloadfreetype-0c817334b708a83425ce5b86448c4d6a26ebbc76.tar.gz
* src/base/ftcalc.c (FT_MulAddFix): Simplify 32-bit rounding.
-rw-r--r--src/base/ftcalc.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 9e87abd09..c5bc7e3b1 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -1070,9 +1070,6 @@
{
FT_UInt i;
FT_Int64 temp;
-#ifndef FT_INT64
- FT_Int64 halfUnit;
-#endif
#ifdef FT_INT64
@@ -1117,13 +1114,10 @@
FT_Add64( &temp, &multResult, &temp );
}
- /* Round value. */
- halfUnit.hi = 0;
- halfUnit.lo = 0x8000;
- FT_Add64( &temp, &halfUnit, &temp );
+ /* Shift and round value. */
+ return (FT_Int32)( ( ( temp.hi << 16 ) | ( temp.lo >> 16 ) )
+ + ( 1 & ( temp.lo >> 15 ) ) );
- return (FT_Int32)( ( (FT_Int32)( temp.hi & 0xFFFF ) << 16 ) |
- ( temp.lo >> 16 ) );
#endif /* !FT_INT64 */