diff options
Diffstat (limited to 'src/gallium/auxiliary/util/u_math.h')
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 16 |
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 1ecde7a912..9268a9bb7e 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 |