summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_math.h
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-03-25 20:58:38 +0000
committerJosé Fonseca <[email protected]>2009-03-25 21:01:49 +0000
commit8c4bd92b68cf79ff94dc431f78a970bbab7e0d00 (patch)
tree3173686f22623f9a259c28c4fce9de405de41cf6 /src/gallium/auxiliary/util/u_math.h
parent079be0fd3f1d0f52f26a95756809ac4a2325ccb1 (diff)
util: Don't use x86 asm on x86_64.
Diffstat (limited to 'src/gallium/auxiliary/util/u_math.h')
-rw-r--r--src/gallium/auxiliary/util/u_math.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 1ecde7a9125..9268a9bb7ee 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -319,11 +319,21 @@ util_iround(float f)
-#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
/**
* Find first bit set in word. Least significant bit is 1.
* Return 0 if no bits set.
*/
+#if defined(_MSC_VER) && _MSC_VER >= 1300
+static INLINE
+unsigned long ffs( unsigned long u )
+{
+ unsigned long i;
+ if(_BitScanForward(&i, u))
+ return i + 1;
+ else
+ return 0;
+}
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
static INLINE
unsigned ffs( unsigned u )
{
@@ -339,9 +349,7 @@ unsigned ffs( unsigned u )
return i;
}
-#endif
-
-#ifdef __MINGW32__
+#elif defined(__MINGW32__)
#define ffs __builtin_ffs
#endif