aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/sparse_vec.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra/sparse_vec.h')
-rw-r--r--src/vppinfra/sparse_vec.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vppinfra/sparse_vec.h b/src/vppinfra/sparse_vec.h
index cfa5778e290..54a92ce7a84 100644
--- a/src/vppinfra/sparse_vec.h
+++ b/src/vppinfra/sparse_vec.h
@@ -115,6 +115,10 @@ sparse_vec_index_internal (void *v,
w = h->is_member_bitmap[i];
+ /* count_trailing_zeros(0) == 0, take care of that case */
+ if (PREDICT_FALSE (maybe_range == 0 && insert == 0 && w == 0))
+ return 0;
+
if (PREDICT_TRUE (maybe_range == 0 && insert == 0 &&
count_trailing_zeros (w) == b))
return h->member_counts[i] + 1;