summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/imports.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-01-12 07:30:48 -0700
committerBrian Paul <brianp@vmware.com>2012-01-12 07:30:58 -0700
commit9a548c27aa704236cc1d8a5d4ebf68cea9c5c99c (patch)
treecdb18d78dd7dc3724d183361618212f274acb675 /src/mesa/main/imports.c
parent87118d84ff11c040f677c7506afb813def1b9ff9 (diff)
downloadexternal_mesa3d-9a548c27aa704236cc1d8a5d4ebf68cea9c5c99c.zip
external_mesa3d-9a548c27aa704236cc1d8a5d4ebf68cea9c5c99c.tar.gz
external_mesa3d-9a548c27aa704236cc1d8a5d4ebf68cea9c5c99c.tar.bz2
mesa: remove _mesa_ffs(), implement ffs() for non-GNU platforms
Call ffs() and ffsll() everywhere. Define our own ffs(), ffsll() functions when the platform doesn't have them. v2: remove #ifdef _WIN32, __IBMC__, __IBMCPP_ tests inside ffs() implementation. The #else clause was recursive. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Tested-by: Alexander von Gluck <kallisti5@unixzen.com>
Diffstat (limited to 'src/mesa/main/imports.c')
-rw-r--r--src/mesa/main/imports.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 2469e42..bbc6ac6 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -458,9 +458,8 @@ _mesa_inv_sqrtf(float n)
* Find the first bit set in a word.
*/
int
-_mesa_ffs(int32_t i)
+ffs(int i)
{
-#if (defined(_WIN32) ) || defined(__IBMC__) || defined(__IBMCPP__)
register int bit = 0;
if (i != 0) {
if ((i & 0xffff) == 0) {
@@ -482,9 +481,6 @@ _mesa_ffs(int32_t i)
bit++;
}
return bit;
-#else
- return ffs(i);
-#endif
}
@@ -495,23 +491,24 @@ _mesa_ffs(int32_t i)
* if no bits set.
*/
int
-_mesa_ffsll(int64_t val)
+ffsll(long long int val)
{
int bit;
assert(sizeof(val) == 8);
- bit = _mesa_ffs((int32_t)val);
+ bit = ffs((int) val);
if (bit != 0)
return bit;
- bit = _mesa_ffs((int32_t)(val >> 32));
+ bit = ffs((int) (val >> 32));
if (bit != 0)
return 32 + bit;
return 0;
}
-#endif
+#endif /* __GNUC__ */
+
#if !defined(__GNUC__) ||\
((__GNUC__ * 100 + __GNUC_MINOR__) < 304) /* Not gcc 3.4 or later */