From d135e27c23c089c64581065d5af6f962012fdf37 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 5 May 2013 10:44:21 +0200 Subject: [PATCH] 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'. --- ChangeLog | 11 +++++++++++ include/freetype/config/ftconfig.h | 16 ++++++++++++++++ src/base/ftcalc.c | 12 ++++-------- src/base/fttrigon.c | 5 ----- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97bc8a103..06840be86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2013-05-05 Werner Lemberg + + 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 [raster] Fix clang issues. diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 4502fd83d..4aaddffe2 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; + + /*************************************************************************/ + /* */ + /* */ + /* 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 cadbeca34..bdedcc9f1 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 09719ad4d..4ffdcb77f 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