Commit d135e27c23c089c64581065d5af6f962012fdf37

Werner Lemberg 2013-05-05T10:44:21

Fix 64bit compilation issues. * include/freetype/config/ftconfig.h [FT_LONG64]: Typedef `FT_Int64' here. * src/base/ftcalc.c: Remove typedef of `FT_Int64'. (FT_DivFix): Fix cast. * src/base/fttrigon.c: Remove typedef of `FT_Int64'.

diff --git a/ChangeLog b/ChangeLog
index 97bc8a1..06840be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2013-05-05  Werner Lemberg  <wl@gnu.org>
 
+	Fix 64bit compilation issues.
+
+	* include/freetype/config/ftconfig.h [FT_LONG64]: Typedef
+	`FT_Int64' here.
+
+	* src/base/ftcalc.c: Remove typedef of `FT_Int64'.
+	(FT_DivFix): Fix cast.
+	* src/base/fttrigon.c: Remove typedef of `FT_Int64'.
+
+2013-05-05  Werner Lemberg  <wl@gnu.org>
+
 	[raster] Fix clang issues.
 
 	Fix suggested by <octoploid@yandex.com>.
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index 4502fd8..4aaddff 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -200,6 +200,18 @@ FT_BEGIN_HEADER
   /*                                                                       */
   typedef unsigned XXX  FT_UInt32;
 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Type>                                                                */
+  /*    FT_Int64                                                           */
+  /*                                                                       */
+  /*    A typedef for a 64bit signed integer type.  The size depends on    */
+  /*    the configuration.  Only defined if there is real 64bit support;   */
+  /*    otherwise, it gets emulated with a structure (if necessary).       */
+  /*                                                                       */
+  typedef signed XXX  FT_Int64;
+
   /* */
 
 #endif
@@ -293,6 +305,10 @@ FT_BEGIN_HEADER
 
 #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
 
+#ifdef FT_LONG64
+  typedef FT_INT64  FT_Int64;
+#endif
+
 
 #define FT_BEGIN_STMNT  do {
 #define FT_END_STMNT    } while ( 0 )
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index cadbeca..bdedcc9 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -43,13 +43,9 @@
 #undef FT_MulFix
 #endif
 
-/* we need to define a 64-bits data type here */
+/* we need to emulate a 64-bit data type if a real one isn't available */
 
-#ifdef FT_LONG64
-
-  typedef FT_INT64  FT_Int64;
-
-#else
+#ifndef FT_LONG64
 
   typedef struct  FT_Int64_
   {
@@ -58,7 +54,7 @@
 
   } FT_Int64;
 
-#endif /* FT_LONG64 */
+#endif /* !FT_LONG64 */
 
 
   /*************************************************************************/
@@ -302,7 +298,7 @@
       q = 0x7FFFFFFFL;
     else
       /* compute result directly */
-      q = (FT_UInt32)( ( ( (FT_UInt64)a << 16 ) + ( b >> 1 ) ) / b );
+      q = (FT_UInt32)( ( ( (FT_ULong)a << 16 ) + ( b >> 1 ) ) / b );
 
     return ( s < 0 ? -(FT_Long)q : (FT_Long)q );
   }
diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c
index 09719ad..4ffdcb7 100644
--- a/src/base/fttrigon.c
+++ b/src/base/fttrigon.c
@@ -35,11 +35,6 @@
 #include FT_TRIGONOMETRY_H
 
 
-#ifdef FT_LONG64
-  typedef FT_INT64  FT_Int64;
-#endif
-
-
   /* the Cordic shrink factor 0.858785336480436 * 2^32 */
 #define FT_TRIG_SCALE      0xDBD95B16UL