[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 3ea0d2c: * src/base/ftcalc.c (FT_MulFix) [FT_LONG64]:
From: |
Alexei Podtelezhnikov |
Subject: |
[freetype2] master 3ea0d2c: * src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Improve. |
Date: |
Mon, 14 Sep 2015 03:23:03 +0000 |
branch: master
commit 3ea0d2c65a931e721aaf732c17765968bfe755d2
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>
* src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Improve.
---
ChangeLog | 4 ++++
src/base/ftcalc.c | 18 +++---------------
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index be16ae0..cd4fe58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-14 Alexei Podtelezhnikov <address@hidden>
+
+ * src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Improve.
+
2015-09-14 Werner Lemberg <address@hidden>
[type1] Fix another potential buffer overflow (#45955).
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index dbddeda..619a08b 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -237,22 +237,10 @@
#else
- FT_Int s = 1;
- FT_UInt64 a, b, c;
- FT_Long c_;
-
-
- FT_MOVE_SIGN( a_, s );
- FT_MOVE_SIGN( b_, s );
-
- a = (FT_UInt64)a_;
- b = (FT_UInt64)b_;
-
- c = ( a * b + 0x8000UL ) >> 16;
-
- c_ = (FT_Long)c;
+ FT_Int64 ab = (FT_Int64)a_ * (FT_Int64)b_;
- return s < 0 ? -c_ : c_;
+ /* this requires arithmetic right shift of signed numbers */
+ return (FT_Long)( ( ab + 0x8000L - ( ab < 0 ) ) >> 16 );
#endif /* FT_MULFIX_ASSEMBLER */
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 3ea0d2c: * src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Improve.,
Alexei Podtelezhnikov <=