summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/imports.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-01-26 19:01:55 -0700
committerBrian <[email protected]>2007-01-26 19:01:55 -0700
commit99c9bc386f54964eea0ed93f6b036477076dae57 (patch)
tree6071d5cc35bb41e2afc78e29efbcc164182d86be /src/mesa/main/imports.c
parent1d74e565dbfc1a69c49fe67eed9c91f10d0ad2fc (diff)
document, re-indent _mesa_ffsll()
Diffstat (limited to 'src/mesa/main/imports.c')
-rw-r--r--src/mesa/main/imports.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index ad77373075b..be2f04c1881 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -574,28 +574,36 @@ _mesa_ffs(int i)
#endif
}
+
+/**
+ * Find position of first bit set in given value.
+ * XXX Warning: this function can only be used on 64-bit systems!
+ * \return position of lest significant bit set, starting at 1, return zero
+ * if no bits set.
+ */
int
_mesa_ffsll(long long val)
{
#ifdef ffsll
- return ffsll(val);
+ return ffsll(val);
#else
- int bit;
+ int bit;
- assert(sizeof(val) == 8);
+ assert(sizeof(val) == 8);
- bit = ffs(val);
- if (bit != 0)
- return bit;
+ bit = ffs(val);
+ if (bit != 0)
+ return bit;
- bit = ffs(val >> 32);
- if (bit != 0)
- return 32 + bit;
+ bit = ffs(val >> 32);
+ if (bit != 0)
+ return 32 + bit;
- return 0;
+ return 0;
#endif
}
+
/**
* Return number of bits set in given GLuint.
*/