forked from minhngoc25a/freetype2
Turn FT_MSB into a macro when using gcc builtins.
* src/base/ftcalc.c, include/internal/ftcalc.h: Updated.
This commit is contained in:
parent
87e56b043a
commit
c7022467d2
|
@ -1,3 +1,9 @@
|
|||
2014-08-13 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
Turn FT_MSB into a macro when using gcc builtins.
|
||||
|
||||
* src/base/ftcalc.c, include/internal/ftcalc.h: Updated.
|
||||
|
||||
2014-08-12 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
[base] Avoid undefined FT_MSB in `BBox_Cubic_Check'.
|
||||
|
|
|
@ -261,22 +261,6 @@ FT_BEGIN_HEADER
|
|||
|
||||
#endif /* __GNUC__ && __x86_64__ */
|
||||
|
||||
#if defined( __GNUC__ )
|
||||
#if ( __GNUC__ > 3 ) || ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 4 ) )
|
||||
|
||||
#if FT_SIZEOF_INT == 4
|
||||
|
||||
#define FT_MSB_BUILTIN( x ) ( 31 - __builtin_clz( x ) )
|
||||
|
||||
#elif FT_SIZEOF_LONG == 4
|
||||
|
||||
#define FT_MSB_BUILTIN( x ) ( 31 - __builtin_clzl( x ) )
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
|
||||
|
||||
|
||||
|
@ -367,9 +351,32 @@ FT_BEGIN_HEADER
|
|||
/*
|
||||
* Return the most significant bit index.
|
||||
*/
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
|
||||
#if defined( __GNUC__ )
|
||||
#if ( __GNUC__ > 3 ) || ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 4 ) )
|
||||
|
||||
#if FT_SIZEOF_INT == 4
|
||||
|
||||
#define FT_MSB( x ) ( 31 - __builtin_clz( x ) )
|
||||
|
||||
#elif FT_SIZEOF_LONG == 4
|
||||
|
||||
#define FT_MSB( x ) ( 31 - __builtin_clzl( x ) )
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
|
||||
|
||||
#ifndef FT_MSB
|
||||
|
||||
FT_BASE( FT_Int )
|
||||
FT_MSB( FT_UInt32 z );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Return sqrt(x*x+y*y), which is the same as `FT_Vector_Length' but uses
|
||||
|
|
|
@ -100,16 +100,11 @@
|
|||
: -((-a) & ~0xFFFFL );
|
||||
}
|
||||
|
||||
#ifndef FT_MSB
|
||||
|
||||
FT_BASE_DEF ( FT_Int )
|
||||
FT_MSB( FT_UInt32 z )
|
||||
{
|
||||
#ifdef FT_MSB_BUILTIN
|
||||
|
||||
return FT_MSB_BUILTIN( z );
|
||||
|
||||
#else
|
||||
|
||||
FT_Int shift = 0;
|
||||
|
||||
/* determine msb bit index in `shift' */
|
||||
|
@ -140,10 +135,10 @@
|
|||
}
|
||||
|
||||
return shift;
|
||||
|
||||
#endif /* FT_MSB_BUILTIN */
|
||||
}
|
||||
|
||||
#endif /* !FT_MSB */
|
||||
|
||||
|
||||
/* documentation is in ftcalc.h */
|
||||
|
||||
|
|
Loading…
Reference in New Issue