36#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
40#if defined( __CC_ARM ) || defined( __ARMCC__ )
42#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
46 static __inline FT_Int32
47 FT_MulFix_arm( FT_Int32 a,
71#if defined( __arm__ ) && \
72 ( !defined( __thumb__ ) || defined( __thumb2__ ) ) && \
73 !( defined( __CC_ARM ) || defined( __ARMCC__ ) )
75#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
79 static __inline__ FT_Int32
80 FT_MulFix_arm( FT_Int32 a,
86 __asm__ __volatile__ (
87 "smull %1, %2, %4, %3\n\t"
88 "mov %0, %2, asr #31\n\t"
89#
if defined( __clang__ ) && defined( __thumb2__ )
90 "add.w %0, %0, #0x8000\n\t"
92 "add %0, %0, #0x8000\n\t"
96 "mov %0, %1, lsr #16\n\t"
97 "orr %0, %0, %2, lsl #16\n\t"
98 :
"=r"(a),
"=&r"(t2),
"=&r"(
t)
109#if defined( __i386__ )
111#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
115 static __inline__ FT_Int32
116 FT_MulFix_i386( FT_Int32 a,
122 __asm__ __volatile__ (
124 "movl %%edx, %%ecx\n"
126 "addl $0x8000, %%ecx\n"
127 "addl %%ecx, %%eax\n"
131 "addl %%edx, %%eax\n"
132 :
"=a"(result),
"=d"(b)
147#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
151 static __inline FT_Int32
152 FT_MulFix_i386( FT_Int32 a,
180#if defined( __GNUC__ ) && defined( __x86_64__ )
182#define FT_MULFIX_ASSEMBLER FT_MulFix_x86_64
184 static __inline__ FT_Int32
185 FT_MulFix_x86_64( FT_Int32 a,
190#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 )
191#pragma GCC diagnostic push
192#pragma GCC diagnostic ignored "-Wlong-long"
201 ret = (
long long)a * b;
205 return (FT_Int32)( ret >> 16 );
214 long long wide_a = (
long long)a;
215 long long wide_b = (
long long)b;
219 __asm__ __volatile__ (
223 "lea 0x8000(%1, %0), %0\n"
225 :
"=&r"(result),
"=&r"(wide_a)
229 return (FT_Int32)result;
232#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 )
233#pragma GCC diagnostic pop
242#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
243#ifdef FT_MULFIX_ASSEMBLER
244#define FT_MulFix( a, b ) FT_MULFIX_ASSEMBLER( (FT_Int32)(a), (FT_Int32)(b) )
360#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
362#if defined( __GNUC__ ) && \
363 ( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4 ) )
365#if FT_SIZEOF_INT == 4
367#define FT_MSB( x ) ( 31 - __builtin_clz( x ) )
369#elif FT_SIZEOF_LONG == 4
371#define FT_MSB( x ) ( 31 - __builtin_clzl( x ) )
376#elif defined( _MSC_VER ) && ( _MSC_VER >= 1400 )
378#if FT_SIZEOF_INT == 4
382 static __inline FT_Int32
383 FT_MSB_i386( FT_UInt32 x )
391 return (FT_Int32)where;
394#define FT_MSB( x ) ( FT_MSB_i386( x ) )
441 FT_SqrtFixed( FT_Int32 x );
446#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) * 64 )
447#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) * 16384 )
448#define INT_TO_FIXED( x ) ( (FT_Long)(x) * 65536 )
449#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) * 4 )
450#define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 )
452#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \
453 : ( -( ( 32 - (x) ) & -64 ) ) )
464#define ADD_INT( a, b ) \
465 (FT_Int)( (FT_UInt)(a) + (FT_UInt)(b) )
466#define SUB_INT( a, b ) \
467 (FT_Int)( (FT_UInt)(a) - (FT_UInt)(b) )
468#define MUL_INT( a, b ) \
469 (FT_Int)( (FT_UInt)(a) * (FT_UInt)(b) )
470#define NEG_INT( a ) \
471 (FT_Int)( (FT_UInt)0 - (FT_UInt)(a) )
473#define ADD_LONG( a, b ) \
474 (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) )
475#define SUB_LONG( a, b ) \
476 (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) )
477#define MUL_LONG( a, b ) \
478 (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) )
479#define NEG_LONG( a ) \
480 (FT_Long)( (FT_ULong)0 - (FT_ULong)(a) )
482#define ADD_INT32( a, b ) \
483 (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) )
484#define SUB_INT32( a, b ) \
485 (FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) )
486#define MUL_INT32( a, b ) \
487 (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) )
488#define NEG_INT32( a ) \
489 (FT_Int32)( (FT_UInt32)0 - (FT_UInt32)(a) )
493#define ADD_INT64( a, b ) \
494 (FT_Int64)( (FT_UInt64)(a) + (FT_UInt64)(b) )
495#define SUB_INT64( a, b ) \
496 (FT_Int64)( (FT_UInt64)(a) - (FT_UInt64)(b) )
497#define MUL_INT64( a, b ) \
498 (FT_Int64)( (FT_UInt64)(a) * (FT_UInt64)(b) )
499#define NEG_INT64( a ) \
500 (FT_Int64)( (FT_UInt64)0 - (FT_UInt64)(a) )
XETime t
Definition main.cpp:53
ft_corner_is_flat(FT_Pos in_x, FT_Pos in_y, FT_Pos out_x, FT_Pos out_y)
FT_BEGIN_HEADER FT_MulDiv_No_Round(FT_Long a, FT_Long b, FT_Long c)
FT_Vector_NormLen(FT_Vector *vector)
FT_Vector_Transform_Scaled(FT_Vector *vector, const FT_Matrix *matrix, FT_Long scaling)
FT_Matrix_Multiply_Scaled(const FT_Matrix *a, FT_Matrix *b, FT_Long scaling)
FT_Matrix_Check(const FT_Matrix *matrix)
FT_Hypot(FT_Fixed x, FT_Fixed y)
ft_corner_orientation(FT_Pos in_x, FT_Pos in_y, FT_Pos out_x, FT_Pos out_y)
#define FT_BASE(x)
Definition ftconfig.h:407
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition ftimage.h:58
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition fttypes.h:108
signed long FT_Fixed
Definition fttypes.h:287
signed long FT_Long
Definition fttypes.h:242
signed int FT_Int
Definition fttypes.h:220