[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6] bitset: be sure to always return a value
From: |
Akim Demaille |
Subject: |
[PATCH 1/6] bitset: be sure to always return a value |
Date: |
Thu, 19 Nov 2020 07:01:50 +0100 |
* lib/bitset/array.c (abitset_small_list): Always update *next and
return a value.
---
ChangeLog | 6 ++++++
lib/bitset/array.c | 10 ++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d50f4d1a2..88ae15003 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-11-19 Akim Demaille <akim@lrde.epita.fr>
+
+ bitset: be sure to always return a value
+ * lib/bitset/array.c (abitset_small_list): Always update *next and
+ return a value.
+
2020-11-17 Akim Demaille <akim@lrde.epita.fr>
bitset: strengthen tests
diff --git a/lib/bitset/array.c b/lib/bitset/array.c
index 3f8bcca87..0e90b6b1f 100644
--- a/lib/bitset/array.c
+++ b/lib/bitset/array.c
@@ -65,12 +65,8 @@ abitset_small_list (bitset src, bitset_bindex *list,
bitset_bindex count = 0;
/* Is there enough room to avoid checking in each iteration? */
if (num >= BITSET_WORD_BITS)
- {
- BITSET_FOR_EACH_BIT (pos, word)
- list[count++] = bitno + pos;
- *next = bitno + BITSET_WORD_BITS;
- return count;
- }
+ BITSET_FOR_EACH_BIT (pos, word)
+ list[count++] = bitno + pos;
else
BITSET_FOR_EACH_BIT (pos, word)
{
@@ -81,6 +77,8 @@ abitset_small_list (bitset src, bitset_bindex *list,
return count;
}
}
+ *next = bitno + BITSET_WORD_BITS;
+ return count;
}
--
2.29.2
- [PATCH 0/6] bitset: more conversions to ffs, Akim Demaille, 2020/11/19
- [PATCH 1/6] bitset: be sure to always return a value,
Akim Demaille <=
- [PATCH 2/6] bitset: check empty and full bitsets, Akim Demaille, 2020/11/19
- [PATCH 3/6] bitset: use ffs where possible in the table implementation, Akim Demaille, 2020/11/19
- [PATCH 4/6] bitset: use ffs where possible in the vector implementation, Akim Demaille, 2020/11/19
- [PATCH 5/6] bitset: tests: try harder to break it, Akim Demaille, 2020/11/19
- [PATCH 6/6] bitset: exercise the stats too, Akim Demaille, 2020/11/19
- [PATCH 6/6] bitset: tests: exercise the stats too, Akim Demaille, 2020/11/19
- Re: [PATCH 0/6] bitset: more conversions to ffs, Bruno Haible, 2020/11/19