Add more assertions to help scan-build with false positive.

This commit is contained in:
Patrick Pelissier committed 2018-04-20 19:30:15 +02:00
1 parent 131da660c8
commit 8b2993c979
1 file changed
+3
+3
View File
@@ -123,6 +123,7 @@ static inline size_t genint_pop(genint_t s)
while ((master >> GENINT_ABA_CPT) != s->mask_master) {
// Let's get the index i of the first not full limb according to master.
unsigned int i = m_core_clz64(~master);
assert (i < GENINT_LIMBSIZE);
// Let's compute the mask of this limb representing the limb as being full
genint_limb_t mask = s->mask0;
mask = (i == s->max) ? mask : -GENINT_ONE;
@@ -133,8 +134,10 @@ static inline size_t genint_pop(genint_t s)
// If it is now full, we have been preempted by another.
if (M_UNLIKELY (org == mask))
goto next_element;
assert (org != -GENINT_ONE);
// At least one bit is free in the limb. Find one.
bit = GENINT_LIMBSIZE - 1 - m_core_clz64(~org);
assert (bit < GENINT_LIMBSIZE);
assert ((org & (GENINT_ONE<<bit)) == 0);
assert (i * GENINT_LIMBSIZE + GENINT_LIMBSIZE - 1 - bit < s->n);
// Set the integer as being used.