37 #include FT_TRIGONOMETRY_H 38 #include FT_INTERNAL_CALC_H 39 #include FT_INTERNAL_DEBUG_H 40 #include FT_INTERNAL_OBJECTS_H 42 #ifdef FT_MULFIX_INLINED 50 typedef struct FT_Int64_
67 #define FT_COMPONENT trace_calc 78 return ( a >= 0 ) ? ( a + 0x8000L ) & ~0xFFFFL
79 : -((-a + 0x8000L ) & ~0xFFFFL );
88 return (
a >= 0 ) ? (
a + 0xFFFFL ) & ~0xFFFFL
89 : -((-
a + 0xFFFFL ) & ~0xFFFFL );
98 return (
a >= 0 ) ?
a & ~0xFFFFL
99 : -((-
a) & ~0xFFFFL );
109 if (
z >= ( 1L << 16 ) )
114 if (
z >= ( 1L << 8 ) )
119 if (
z >= ( 1L << 4 ) )
124 if (
z >= ( 1L << 2 ) )
129 if (
z >= ( 1L << 1 ) )
155 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 171 newroot = root +
mask;
172 if ( newroot <= val )
175 root = newroot +
mask;
181 }
while ( mask != 0 );
204 if (
a < 0 ) {
a = -
a; s = -1; }
205 if (
b < 0 ) {
b = -
b; s = -
s; }
206 if ( c < 0 ) { c = -
c; s = -
s; }
211 return ( s > 0 ) ? d : -d;
227 if (
a < 0 ) {
a = -
a; s = -1; }
228 if (
b < 0 ) {
b = -
b; s = -
s; }
229 if ( c < 0 ) { c = -
c; s = -
s; }
234 return ( s > 0 ) ? d : -d;
244 #ifdef FT_MULFIX_ASSEMBLER 246 return FT_MULFIX_ASSEMBLER(
a, b );
268 return ( s > 0 ) ?
c : -
c;
315 FT_UInt32 lo1, hi1, lo2, hi2, lo, hi, i1, i2;
318 lo1 =
x & 0x0000FFFFU; hi1 =
x >> 16;
319 lo2 =
y & 0x0000FFFFU; hi2 =
y >> 16;
385 hi =
x->hi +
y->hi + ( lo <
x->lo );
420 if (
a == 0 ||
b ==
c )
428 a = (
a *
b + (
c >> 1 ) ) /
c;
439 FT_Add64( &temp, &temp2, &temp );
440 a = ft_div64by32( temp.hi, temp.lo, (
FT_Int32)
c );
445 return (
s < 0 ? -
a :
a );
457 if (
a == 0 ||
b ==
c )
473 a = ft_div64by32( temp.hi, temp.lo, (
FT_Int32)
c );
478 return (
s < 0 ? -
a :
a );
488 #ifdef FT_MULFIX_ASSEMBLER 490 return FT_MULFIX_ASSEMBLER(
a,
b );
505 if (
a == 0 ||
b == 0x10000L )
526 sa = (
a >> (
sizeof (
a ) * 8 - 1 ) );
528 sb = (
b >> (
sizeof (
b ) * 8 - 1 ) );
534 if ( ua <= 2048 && ub <= 1048576L )
535 ua = ( ua * ub + 0x8000U ) >> 16;
541 ua = ( ua >> 16 ) * ub + al * ( ub >> 16 ) +
542 ( ( al * ( ub & 0xFFFFU ) + 0x8000U ) >> 16 );
556 if (
a == 0 ||
b == 0x10000L )
565 if ( ua <= 2048 && ub <= 1048576L )
566 ua = ( ua * ub + 0x8000UL ) >> 16;
572 ua = ( ua >> 16 ) * ub + al * ( ub >> 16 ) +
573 ( ( al * ( ub & 0xFFFFUL ) + 0x8000UL ) >> 16 );
602 else if ( (
a >> 16 ) == 0 )
617 FT_Add64( &temp, &temp2, &temp );
618 q = ft_div64by32( temp.hi, temp.lo, (
FT_Int32)
b );
640 ft_multo64(
x,
y, z );
645 z->hi = ~z->hi + !( z->lo );
667 x->hi = ~
x->hi + !
x->lo;
686 return ( s < 0 ? 0x80000001UL : 0x7FFFFFFFUL );
690 for ( i = 0; i < 32; i++ )
721 x->hi = ~
x->hi + !
x->lo;
729 q = (
x->lo + ( y >> 1 ) ) /
y;
736 q = ft_div64by32(
x->hi,
x->lo, y );
766 b->xx = xx;
b->xy = xy;
767 b->yx = yx;
b->yy = yy;
780 return FT_THROW( Invalid_Argument );
787 return FT_THROW( Invalid_Argument );
822 b->xx = xx;
b->xy = xy;
823 b->yx = yx;
b->yy = yy;
871 rem_hi = ( rem_hi << 2 ) | ( rem_lo >> 30 );
874 test_div = (
root << 1 ) + 1;
876 if ( rem_hi >= test_div )
907 else if ( in_x == 0 )
914 else if ( out_y == 0 )
921 else if ( out_x == 0 )
938 result = 1 - 2 * ( delta < 0 );
951 else if ( z1.hi < z2.hi )
953 else if ( z1.lo > z2.lo )
955 else if ( z1.lo < z2.lo )
979 FT_Pos d_in, d_out, d_corner;
1004 return ( d_in + d_out - d_corner ) < ( d_corner >> 4 );
FT_Matrix_Multiply_Scaled(const FT_Matrix *a, FT_Matrix *b, FT_Long scaling)
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
FT_DivFix(FT_Long a, FT_Long b)
FT_BEGIN_HEADER typedef signed long FT_Pos
ft_corner_orientation(FT_Pos in_x, FT_Pos in_y, FT_Pos out_x, FT_Pos out_y)
GLboolean GLboolean GLboolean GLboolean a
GLint GLint GLint GLint GLint GLint y
GLdouble GLdouble GLdouble GLdouble q
FT_MulDiv_No_Round(FT_Long a, FT_Long b, FT_Long c)
return FT_THROW(Missing_Property)
GLint GLint GLint GLint GLint x
GLboolean GLboolean GLboolean b
ft_corner_is_flat(FT_Pos in_x, FT_Pos in_y, FT_Pos out_x, FT_Pos out_y)
FT_Vector_Transform_Scaled(FT_Vector *vector, const FT_Matrix *matrix, FT_Long scaling)
GLdouble GLdouble GLdouble r
FT_Matrix_Invert(FT_Matrix *matrix)
FT_Hypot(FT_Fixed x, FT_Fixed y)
FT_Vector_Length(FT_Vector *vec)
GLuint GLuint GLsizei count
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
struct FT_Int64_ FT_Int64
FT_MulFix(FT_Long a, FT_Long b)