From 8b2993c979df8e034a36c3aece4c1241173a94ca Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Fri, 20 Apr 2018 19:30:15 +0200 Subject: [PATCH] Add more assertions to help scan-build with false positive. --- m-genint.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/m-genint.h b/m-genint.h index 0194be62..4001913b 100644 --- a/m-genint.h +++ b/m-genint.h @@ -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<n); // Set the integer as being used.