Fix bug on bitset_resize function in case of increase of size:
the first limb may not be cleared properly in some cases. (Reported by David M. Lary)
This commit is contained in:
1 parent
cc7fc66899
commit
0b853c6d52
2 files changed
+26
-2
No files matched your search
+2
-2
@@ -268,8 +268,8 @@ m_bitset_resize (m_bitset_t v, size_t size)
|
||||
}
|
||||
} else if (size > old_size) {
|
||||
// Resize up the bitset: set to 0 new bits.
|
||||
const size_t old_offset = old_size / M_B1TSET_LIMB_BIT;
|
||||
for(size_t i = old_offset+1 ; i < offset; i++) {
|
||||
const size_t old_offset = (old_size + M_B1TSET_LIMB_BIT - 1)/ M_B1TSET_LIMB_BIT;
|
||||
for(size_t i = old_offset ; i < offset; i++) {
|
||||
v->ptr[i] = 0;
|
||||
}
|
||||
if (M_LIKELY(index != 0)) {
|
||||
|
||||
Reference in new issue
Block a user