[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 0c817334b: * src/base/ftcalc.c (FT_MulAddFix): Simpli
From: |
Werner Lemberg |
Subject: |
[freetype2] master 0c817334b: * src/base/ftcalc.c (FT_MulAddFix): Simplify 32-bit rounding. |
Date: |
Fri, 25 Aug 2023 13:57:57 -0400 (EDT) |
branch: master
commit 0c817334b708a83425ce5b86448c4d6a26ebbc76
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftcalc.c (FT_MulAddFix): Simplify 32-bit rounding.
---
src/base/ftcalc.c | 12 +++---------
1 file 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 */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 0c817334b: * src/base/ftcalc.c (FT_MulAddFix): Simplify 32-bit rounding.,
Werner Lemberg <=