[Mesa-dev] [PATCH 6/6] util/bitset: Use a long for bitset words

Jason Ekstrand jason at jlekstrand.net
Sat Aug 15 11:31:27 PDT 2015


This means that it will now be a 64-bit word on 64-bit linux systems but a
32-bit word on 32-bit systems and windows.  This should gain us a little
efficiency on 64-bit systems.
---
 src/util/bitset.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/util/bitset.h b/src/util/bitset.h
index c452819..812cdc4 100644
--- a/src/util/bitset.h
+++ b/src/util/bitset.h
@@ -37,7 +37,7 @@
  * generic bitset implementation
  */
 
-#define BITSET_WORD unsigned int
+#define BITSET_WORD unsigned long
 #define BITSET_WORDBITS (sizeof (BITSET_WORD) * 8)
 
 /* bitset declarations
@@ -119,8 +119,7 @@ __bitset_next_set(unsigned i, BITSET_WORD *tmp,
       *tmp = set[word];
    }
 
-   /* Find the next set bit in the non-zero word */
-   bit = ffs(*tmp) - 1;
+   bit = ffsl(*tmp) - 1;
 
    /* Unset the bit */
    *tmp &= ~(1ull << bit);
-- 
2.4.3



More information about the mesa-dev mailing list