summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/imports.c
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2016-06-09 06:35:34 +0200
committerMathias Fröhlich <[email protected]>2016-06-14 05:19:10 +0200
commitc3b66566760dd44eaeed9e4df13687dc3ee69bd9 (patch)
treebf72312b4b8cf9e9c5b31909c5a866b8a3c08343 /src/mesa/main/imports.c
parentfafe026dbe0680c971bf3ba2452954eea84287f2 (diff)
mesa/gallium: Move u_bit_scan{,64} from gallium to util.
The functions are also useful for mesa. Introduce src/util/bitscan.{h,c}. Move ffs function implementations from src/mesa/main/imports.{h,c}. Move bit scan related functions from src/gallium/auxiliary/util/u_math.h. Merge platform handling with what is available from within mesa. v2: Try to fix MSVC compile. Reviewed-by: Brian Paul <[email protected]> Tested-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa/main/imports.c')
-rw-r--r--src/mesa/main/imports.c58
1 files changed, 0 insertions, 58 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.