summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorJonathan Gray <jsg@jsg.id.au>2015-03-17 12:49:39 +1100
committerEmil Velikov <emil.l.velikov@gmail.com>2015-03-24 20:49:32 +0000
commit726d99b19740dca6787ab819ab99bc9d942d80a6 (patch)
treed9eb4da74190c7b2d18348c2c66e74016ba69f77 /src/gallium/auxiliary
parent8cce7b05f19207d331a1abe294c201e0c3ee6ec1 (diff)
downloadexternal_mesa3d-726d99b19740dca6787ab819ab99bc9d942d80a6.zip
external_mesa3d-726d99b19740dca6787ab819ab99bc9d942d80a6.tar.gz
external_mesa3d-726d99b19740dca6787ab819ab99bc9d942d80a6.tar.bz2
gallium/util: Use HAVE___BUILTIN_FFS* macros.
Make use of the builtin ffs macros and split out ffsll to a seperate block. Needed for at least OpenBSD which does not have ffsll in libc. Signed-off-by: Jonathan Gray <jsg@jsg.id.au> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_math.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 8f62cac..3d27a59 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -383,14 +383,28 @@ unsigned ffs( unsigned u )
return i;
}
-#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
+#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID) || \
+ defined(HAVE___BUILTIN_FFS)
#define ffs __builtin_ffs
-#define ffsll __builtin_ffsll
#endif
#endif /* FFS_DEFINED */
/**
+ * Find first bit set in long long. Least significant bit is 1.
+ * Return 0 if no bits set.
+ */
+#ifndef FFSLL_DEFINED
+#define FFSLL_DEFINED 1
+
+#if defined(__MINGW32__) || defined(PIPE_OS_ANDROID) || \
+ defined(HAVE___BUILTIN_FFSLL)
+#define ffsll __builtin_ffsll
+#endif
+
+#endif /* FFSLL_DEFINED */
+
+/**
* Find last bit set in a word. The least significant bit is 1.
* Return 0 if no bits are set.
*/