bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 6/6] bitset: fix iteration over table bitsets


From: Akim Demaille
Subject: [PATCH 6/6] bitset: fix iteration over table bitsets
Date: Tue, 17 Nov 2020 18:59:29 +0100

* lib/bitset/table.c (tbitset_list): Update bitno when windex is.
---
 ChangeLog          | 5 +++++
 lib/bitset/table.c | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f3df478d1..1aa7317a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-11-17  Akim Demaille  <akim@lrde.epita.fr>
+
+       bitset: fix iteration over table bitsets
+       * lib/bitset/table.c (tbitset_list): Update bitno when windex is.
+
 2020-11-17  Akim Demaille  <akim@lrde.epita.fr>
 
        bitset: rename internal details for consistency
diff --git a/lib/bitset/table.c b/lib/bitset/table.c
index b762f5951..d111e0203 100644
--- a/lib/bitset/table.c
+++ b/lib/bitset/table.c
@@ -649,15 +649,16 @@ tbitset_list (bitset bset, bitset_bindex *list,
 
   for (; eindex < size; eindex++)
     {
-      bitset_word *srcp;
 
       tbitset_elt *elt = elts[eindex];
       if (!elt)
         continue;
 
-      srcp = TBITSET_WORDS (elt);
+      bitset_word *srcp = TBITSET_WORDS (elt);
       bitset_windex windex = eindex * TBITSET_ELT_WORDS;
+      bitno = windex * BITSET_WORD_BITS;
 
+      /* Is there enough room to avoid checking in each iteration? */
       if ((count + TBITSET_ELT_BITS) < num)
         {
           /* The coast is clear, plant boot!  */
-- 
2.29.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]