OSDN Git Service

Fix ffs().
authormichal <michal@michal-laptop.(none)>
Wed, 29 Aug 2007 20:40:18 +0000 (21:40 +0100)
committermichal <michal@michal-laptop.(none)>
Wed, 29 Aug 2007 21:35:28 +0000 (22:35 +0100)
src/mesa/pipe/p_util.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 3eff332..436bda2
 #define Elements(x) sizeof(x)/sizeof(*(x))
 
 /**
- * Return pointer aligned to next multiple of 16 bytes.
+ * Return 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;