shithub: freetype+ttf2subf

Download patch

ref: 5ef2023c45f91f90b6d26fa2f81c8f93bc8b5e90
parent: c7022467d244f93a0848b39d1eb2c8506b66bc85
author: Alexei Podtelezhnikov <[email protected]>
date: Thu Aug 14 19:21:46 EDT 2014

Minor refactoring.

* src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round): Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
-2014-08-13  Alexei Podtelezhnikov  <[email protected]>
+2014-08-14  Alexei Podtelezhnikov  <[email protected]>
+
+	Minor refactoring.
+
+	* src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round): Updated.
+
+2014-08-14  Alexei Podtelezhnikov  <[email protected]>
 
 	Turn FT_MSB into a macro when using gcc builtins.
 
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -400,10 +400,13 @@
     s ^= b; b = FT_ABS( b );
     s ^= c; c = FT_ABS( c );
 
-    if ( (FT_ULong)a + (FT_ULong)b <= 92681UL - ( c >> 16 ) && c > 0 )
+    if ( c == 0 )
+      a = 0x7FFFFFFFL;
+
+    else if ( (FT_ULong)a + (FT_ULong)b <= 92681UL - ( c >> 16 ) )
       a = ( a * b + ( c >> 1 ) ) / c;
 
-    else if ( (FT_Int32)c > 0 )
+    else
     {
       FT_Int64  temp, temp2;
 
@@ -415,8 +418,6 @@
       FT_Add64( &temp, &temp2, &temp );
       a = ft_div64by32( temp.hi, temp.lo, (FT_Int32)c );
     }
-    else
-      a = 0x7FFFFFFFL;
 
     return ( s < 0 ? -a : a );
   }
@@ -437,10 +438,13 @@
     s ^= b; b = FT_ABS( b );
     s ^= c; c = FT_ABS( c );
 
-    if ( (FT_ULong)a + (FT_ULong)b <= 92681UL && c > 0 )
+    if ( c == 0 )
+      a = 0x7FFFFFFFL;
+
+    else if ( (FT_ULong)a + (FT_ULong)b <= 92681UL )
       a = a * b / c;
 
-    else if ( (FT_Int32)c > 0 )
+    else
     {
       FT_Int64  temp;
 
@@ -448,8 +452,6 @@
       ft_multo64( (FT_Int32)a, (FT_Int32)b, &temp );
       a = ft_div64by32( temp.hi, temp.lo, (FT_Int32)c );
     }
-    else
-      a = 0x7FFFFFFFL;
 
     return ( s < 0 ? -a : a );
   }