* 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
This commit is contained in:
David Turner 2001-04-25 22:56:30 +00:00
parent caf72cd6e5
commit ec46b28df7
4 changed files with 21 additions and 11 deletions

View File

@ -1,3 +1,11 @@
2001-04-26 David Turner <david@freetype.org>
* 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 <david@freetype.org>
* src/base/ftbbox.c (BBox_Cubic_Check): rewrote function to use

View File

@ -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
/*************************************************************************/

View File

@ -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--;

View File

@ -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 */