]> Savannah Git Hosting - gnulib.git/commitdiff
bitset: fix iteration over table bitsets
authorAkim Demaille <akim.demaille@gmail.com>
Tue, 17 Nov 2020 07:22:13 +0000 (08:22 +0100)
committerAkim Demaille <akim.demaille@gmail.com>
Wed, 18 Nov 2020 05:56:37 +0000 (06:56 +0100)
* lib/bitset/table.c (tbitset_list): Update bitno when windex is.

ChangeLog
lib/bitset/table.c

index 0f85db66b3b6f8329321f089a5a6cc8410e5f236..1e68878cdd4f69c55028be1094aa48d7c8247103 100644 (file)
--- 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
index b762f5951e33f08003203b5a8742a34a7a67f049..d111e02037b5da08414619947531bef28d762fb8 100644 (file)
@@ -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!  */