summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac16
-rw-r--r--pixman/pixman-matrix.c2
2 files changed, 17 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 8a3b622..5ccc267 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1044,6 +1044,22 @@ fi
AC_MSG_RESULT($support_for_float128)
+dnl =====================================
+dnl __builtin_clz
+
+support_for_builtin_clz=no
+
+AC_MSG_CHECKING(for __builtin_clz)
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
+unsigned int x = 11; int main (void) { return __builtin_clz(x); }
+]])], support_for_builtin_clz=yes)
+
+if test x$support_for_builtin_clz = xyes; then
+ AC_DEFINE([HAVE_BUILTIN_CLZ], [], [Whether the compiler supports __builtin_clz])
+fi
+
+AC_MSG_RESULT($support_for_builtin_clz)
+
dnl ==================
dnl libpng
diff --git a/pixman/pixman-matrix.c b/pixman/pixman-matrix.c
index 89b9682..4032c13 100644
--- a/pixman/pixman-matrix.c
+++ b/pixman/pixman-matrix.c
@@ -37,7 +37,7 @@
static force_inline int
count_leading_zeros (uint32_t x)
{
-#ifdef __GNUC__
+#ifdef HAVE_BUILTIN_CLZ
return __builtin_clz (x);
#else
int n = 0;