aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichal <michal@michal-laptop.(none)>2007-08-29 21:40:18 +0100
committermichal <michal@michal-laptop.(none)>2007-08-29 22:35:28 +0100
commit5c337508feedfa35ba3f534bf212f08265db2022 (patch)
tree10ceabb98d9e7c9d3070ba0dea2ae8d992780665
parent874b9265601fcc05b1e32e2be029f3ac6a966c97 (diff)
Fix ffs().
-rwxr-xr-x[-rw-r--r--]src/mesa/pipe/p_util.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h
index 3eff3328c78..436bda21393 100644..100755
--- a/src/mesa/pipe/p_util.h
+++ b/src/mesa/pipe/p_util.h
@@ -39,10 +39,10 @@
#define Elements(x) sizeof(x)/sizeof(*(x))
/**
- * Return pointer aligned to next multiple of 16 bytes.
+ * Return a pointer aligned to next multiple of 16 bytes.
*/
static INLINE void *
-align16(void *unaligned)
+align16( void *unaligned )
{
union {
void *p;
@@ -59,7 +59,12 @@ static INLINE unsigned ffs( unsigned u )
{
unsigned i;
+ if( u == 0 ) {
+ return 0;
+ }
+
__asm bsf eax, [u]
+ __asm inc eax
__asm mov [i], eax
return i;