From ec46b28df763ef3e5cc88c9b22c7cdd7ab5faa8f Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 25 Apr 2001 22:56:30 +0000 Subject: [PATCH] * src/base/ftcalc.c (FT_SqrtFixed): corrected/optimised the 32-bit fixed-point square root. it is now used even with 64-bits ints, as it's simply _much_ faster than calling FT_Sqrt64 :-) * src/base/ftbbox.c : removed invalid "#include FT_BEZIER_H" line --- ChangeLog | 8 ++++++++ include/freetype/config/ftoption.h | 2 +- src/base/ftbbox.c | 8 +++----- src/base/ftcalc.c | 14 +++++++++----- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 141d0c0f2..0722b6a0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-04-26 David Turner + + * src/base/ftcalc.c (FT_SqrtFixed): corrected/optimised the 32-bit + fixed-point square root. it is now used even with 64-bits + ints, as it's simply _much_ faster than calling FT_Sqrt64 :-) + + * src/base/ftbbox.c : removed invalid "#include FT_BEZIER_H" line + 2001-04-25 David Turner * src/base/ftbbox.c (BBox_Cubic_Check): rewrote function to use diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index fa56500f9..4736a36ac 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -154,7 +154,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/ftbbox.c b/src/base/ftbbox.c index 59e382204..2c9e0ff10 100644 --- a/src/base/ftbbox.c +++ b/src/base/ftbbox.c @@ -28,7 +28,6 @@ #include FT_BBOX_H #include FT_IMAGE_H #include FT_OUTLINE_H -#include FT_BEZIER_H typedef struct TBBox_Rec_ @@ -37,7 +36,7 @@ FT_BBox bbox; } TBBox_Rec; - + /*************************************************************************/ /* */ @@ -293,8 +292,8 @@ FT_Pos y; FT_Fixed uu; - /* the polynom is "a*x^3 + 3b*x^2 + 3c*x + d", however, we also */ - /* have dP/dx(u) = 0, which implies that P(t0) = b*t0^2 + 2c*t0 + d */ + /* the polynom is "a*x^3 + 3b*x^2 + 3c*x + d", however, we also */ + /* have dP/dx(u) = 0, which implies that P(u) = b*u^2 + 2c*u + d */ if ( u > 0 && u < 0x10000L ) { uu = FT_MulFix( u, u ); @@ -369,7 +368,6 @@ if ( t1 > 0xFFFFFFL ) { - /* on 64-bit machines .. */ do { shift--; diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index eda214ded..ea486e1de 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -189,6 +189,7 @@ #ifdef FT_CONFIG_OPTION_OLD_CALCS +#if 0 /* a helper function for FT_Sqrt64() */ static @@ -237,6 +238,7 @@ z = (FT_Int64)(x) << 16; return FT_Sqrt64( z ); } +#endif #endif /* FT_CONFIG_OPTION_OLD_CALCS */ @@ -554,6 +556,10 @@ #endif /* FT_CONFIG_OPTION_OLD_CALCS */ + +#endif /* FT_LONG64 */ + + /* a not-so-fast but working 16.16 fixed point square root function */ FT_EXPORT_DEF( FT_Int32 ) FT_SqrtFixed( FT_Int32 x ) { @@ -566,8 +572,8 @@ { rem_hi = 0; rem_lo = x; - count = 32; - do + count = 24; + do { rem_hi = (rem_hi << 2) | (rem_lo >> 30); rem_lo <<= 2; @@ -578,14 +584,12 @@ rem_hi -= test_div; root += 1; } - count--; } + while (--count); } return (FT_Int32)root; } -#endif /* FT_LONG64 */ - /* END */