diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/imports.c | 58 | ||||
-rw-r--r-- | src/mesa/main/imports.h | 17 |
2 files changed, 1 insertions, 74 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index fe54109322d..808b8f67302 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -219,64 +219,6 @@ _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize, /*@{*/ -#ifndef HAVE___BUILTIN_FFS -/** - * Find the first bit set in a word. - */ -int -ffs(int i) -{ - register int bit = 0; - if (i != 0) { - if ((i & 0xffff) == 0) { - bit += 16; - i >>= 16; - } - if ((i & 0xff) == 0) { - bit += 8; - i >>= 8; - } - if ((i & 0xf) == 0) { - bit += 4; - i >>= 4; - } - while ((i & 1) == 0) { - bit++; - i >>= 1; - } - bit++; - } - return bit; -} -#endif - -#ifndef HAVE___BUILTIN_FFSLL -/** - * Find position of first bit set in given value. - * XXX Warning: this function can only be used on 64-bit systems! - * \return position of least-significant bit set, starting at 1, return zero - * if no bits set. - */ -int -ffsll(long long int val) -{ - int bit; - - STATIC_ASSERT(sizeof(val) == 8); - - bit = ffs((int) val); - if (bit != 0) - return bit; - - bit = ffs((int) (val >> 32)); - if (bit != 0) - return 32 + bit; - - return 0; -} -#endif - - #ifndef HAVE___BUILTIN_POPCOUNT /** * Return number of bits set in given GLuint. diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index d96d666e15f..4ff5941487f 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -42,6 +42,7 @@ #include "compiler.h" #include "glheader.h" #include "errors.h" +#include "util/bitscan.h" #ifdef __cplusplus extern "C" { @@ -324,22 +325,6 @@ extern void _mesa_exec_free( void *addr ); -#ifndef FFS_DEFINED -#define FFS_DEFINED 1 -#ifdef HAVE___BUILTIN_FFS -#define ffs __builtin_ffs -#else -extern int ffs(int i); -#endif - -#ifdef HAVE___BUILTIN_FFSLL -#define ffsll __builtin_ffsll -#else -extern int ffsll(long long int i); -#endif -#endif /* FFS_DEFINED */ - - #ifdef HAVE___BUILTIN_POPCOUNT #define _mesa_bitcount(i) __builtin_popcount(i) #else |