shithub: freetype+ttf2subf

Download patch

ref: e01a41d5ebf2437652b99d20761449030049622a
parent: b5c1a4e5673a7e80abc8b59d7bf87a9b123f5f2a
author: David Turner <[email protected]>
date: Tue Mar 28 06:17:58 EST 2000

fixed a stupid bug in FT_MulFix

git/fs: mount .git/fs: mount/attach disallowed
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -325,8 +325,8 @@
                       FT_Long  b )
   {
     FT_Long   s;
+    FT_ULong  ua, ub;
 
-
     if ( a == 0 || b == 0x10000L )
       return a;
 
@@ -333,19 +333,22 @@
     s  = a; a = ABS(a);
     s ^= b; b = ABS(b);
 
-    if ( a <= 2048 && b <= 1048576L )
+    ua = (FT_ULong)a;
+    ub = (FT_ULong)b;
+
+    if ( ua <= 2048 && ub <= 1048576L )
     {
-      a = ( a*b + 0x8000 ) >> 16;
+      ua = ( ua*ub + 0x8000 ) >> 16;
     }
     else
     {
-      FT_Long  al = a & 0xFFFF;
+      FT_ULong  al = ua & 0xFFFF;
 
 
-      a = (a >> 16)*b + al*(b >> 16) + ( al*(b & 0xFFFF) >> 16 );
+      ua = (ua >> 16)*ub + al*(ub >> 16) + ( al*(ub & 0xFFFF) >> 16 );
     }
 
-    return ( s < 0 ? -a : a );
+    return ( s < 0 ? -(FT_Long)ua : ua );
   }