summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_math.h
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-01-12 08:41:24 -0700
committerBrian Paul <brianp@vmware.com>2012-01-12 09:18:34 -0700
commiteab036a6eaebd532f88c49bd26550c6225f96005 (patch)
tree65d15be2efd4fd2cbb31f3c35aae425d74a6d4df /src/gallium/auxiliary/util/u_math.h
parent8cfaab59e0875bff92179aacfffd690c805906ef (diff)
downloadexternal_mesa3d-eab036a6eaebd532f88c49bd26550c6225f96005.zip
external_mesa3d-eab036a6eaebd532f88c49bd26550c6225f96005.tar.gz
external_mesa3d-eab036a6eaebd532f88c49bd26550c6225f96005.tar.bz2
mesa/gallium: add FFS_DEFINED to protect ffs() from multiple definitions
We include both imports.h and u_math.h in the state tracker. This leads to multiple, conflicting definitions of ffs() with MSVC. Use FFS_DEFINED to skip the ffs() in u_math.h. Reviewed-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/util/u_math.h')
-rw-r--r--src/gallium/auxiliary/util/u_math.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 404bd21..f619666 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -340,6 +340,9 @@ util_is_inf_or_nan(float x)
* Find first bit set in word. Least significant bit is 1.
* Return 0 if no bits set.
*/
+#ifndef FFS_DEFINED
+#define FFS_DEFINED 1
+
#if defined(_MSC_VER) && _MSC_VER >= 1300 && (_M_IX86 || _M_AMD64 || _M_IA64)
unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask);
#pragma intrinsic(_BitScanForward)
@@ -372,6 +375,8 @@ unsigned ffs( unsigned u )
#define ffs __builtin_ffs
#endif
+#endif /* FFS_DEFINED */
+
/* Destructively loop over all of the bits in a mask as in:
*