ref: c7022467d244f93a0848b39d1eb2c8506b66bc85
parent: 87e56b043a16b3fde6f4d354ba790593a3e4bba2
author: Alexei Podtelezhnikov <[email protected]>
date: Thu Aug 14 19:01:01 EDT 2014
Turn FT_MSB into a macro when using gcc builtins. * src/base/ftcalc.c, include/internal/ftcalc.h: Updated.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-08-13 Alexei Podtelezhnikov <[email protected]>
+
+ Turn FT_MSB into a macro when using gcc builtins.
+
+ * src/base/ftcalc.c, include/internal/ftcalc.h: Updated.
+
2014-08-12 Alexei Podtelezhnikov <[email protected]>
[base] Avoid undefined FT_MSB in `BBox_Cubic_Check'.
--- a/include/internal/ftcalc.h
+++ b/include/internal/ftcalc.h
@@ -261,22 +261,6 @@
#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,8 +351,31 @@
/*
* 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
/*
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -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,9 +135,9 @@
}
return shift;
-
-#endif /* FT_MSB_BUILTIN */
}
+
+#endif /* !FT_MSB */
/* documentation is in ftcalc.h */