diff options
author | Brian Paul <[email protected]> | 2012-01-12 07:30:48 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-01-12 07:30:58 -0700 |
commit | 9a548c27aa704236cc1d8a5d4ebf68cea9c5c99c (patch) | |
tree | cdb18d78dd7dc3724d183361618212f274acb675 /src/mesa/main/imports.c | |
parent | 87118d84ff11c040f677c7506afb813def1b9ff9 (diff) |
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 <[email protected]>
Tested-by: Alexander von Gluck <[email protected]>
Diffstat (limited to 'src/mesa/main/imports.c')
-rw-r--r-- | src/mesa/main/imports.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 2469e426595..bbc6ac6e240 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 */ |