summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <david@freetype.org>2001-10-18 09:51:09 +0000
committerDavid Turner <david@freetype.org>2001-10-18 09:51:09 +0000
commit1c5802a4b2d0d12634edb1e82420e62a9f7178ea (patch)
treecb3e85b2c0ab4e4e30e45044b9c4a6e489b18085
parentea5a981c7d000b11cf29dd7f1a9cf96defdff059 (diff)
downloadfreetype2-1c5802a4b2d0d12634edb1e82420e62a9f7178ea.tar.gz
updated FT_Div64by32
-rw-r--r--ChangeLog11
-rw-r--r--include/freetype/config/ftoption.h2
-rw-r--r--src/base/ftcalc.c56
3 files changed, 68 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index dac66908e..52f719da2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
+2001-10-18 David Turner <david@freetype.org>
+
+ * src/base/ftcalc.c (FT_Div64by32): changed the implementation
+ slightly since the original code was mis-compiled on Mac machines
+ using the MPW C compiler..
+
+
2001-10-17 David Turner >david@freetype.org>
+ * Version 2.0.4 released.
+ =========================
+
* include/freetype/freetype.h, include/internal/ftobjs.h,
src/base/ftobjs.c, src/sfnt/sfdriver.c, type1/t1driver.c,
cid/cidriver.c: Adding a new function named 'FT_Get_Postscript_Name' to
@@ -8,6 +18,7 @@
* README, docs/CHANGES: updated for 2.0.5 release
+
2001-10-08 David Turner <david@freetype.org>
Fixed a bug in `glnames.py' that prevented it from generating
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index b16331254..b9d0f26cd 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -171,7 +171,7 @@ FT_BEGIN_HEADER
/* file "ftconfig.h" either statically, or through Autoconf */
/* on platforms that support it. */
/* */
-#define FT_CONFIG_OPTION_FORCE_INT64
+#undef FT_CONFIG_OPTION_FORCE_INT64
/*************************************************************************/
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 247ee034c..1201e3b56 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -496,6 +496,61 @@
/* documentation is in ftcalc.h */
+ /* apparently, the second version of this code is not compiled correctly */
+ /* on Mac machines with the MPW C compiler.. tsss, tsss, tss... */
+#if 1
+ FT_EXPORT_DEF( FT_Int32 )
+ FT_Div64by32( FT_Int64* x,
+ FT_Int32 y )
+ {
+ FT_Int32 s;
+ FT_UInt32 q, r, i, lo;
+
+
+ s = x->hi;
+ if ( s < 0 )
+ {
+ x->lo = (FT_UInt32)-(FT_Int32)x->lo;
+ x->hi = ~x->hi + !( x->lo );
+ }
+ s ^= y; y = ABS( y );
+
+ /* Shortcut */
+ if ( x->hi == 0 )
+ {
+ if ( y > 0 )
+ q = x->lo / y;
+ else
+ q = 0x7FFFFFFFL;
+
+ return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
+ }
+
+ r = x->hi;
+ lo = x->lo;
+
+ if ( r >= (FT_UInt32)y ) /* we know y is to be treated as unsigned here */
+ return ( s < 0 ? 0x80000001UL : 0x7FFFFFFFUL );
+ /* Return Max/Min Int32 if division overflow. */
+ /* This includes division by zero! */
+ q = 0;
+ for ( i = 0; i < 32; i++ )
+ {
+ r <<= 1;
+ q <<= 1;
+ r |= lo >> 31;
+
+ if ( r >= (FT_UInt32)y )
+ {
+ r -= y;
+ q |= 1;
+ }
+ lo <<= 1;
+ }
+
+ return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
+ }
+#else
FT_EXPORT_DEF( FT_Int32 )
FT_Div64by32( FT_Int64* x,
FT_Int32 y )
@@ -527,6 +582,7 @@
return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
}
+#endif
#ifdef FT_CONFIG_OPTION_OLD_CALCS