From b053edee17e202958cfa2b121080169b304e8f32 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 7 Dec 2012 20:44:09 +0900 Subject: [PATCH] Fix the handling of size in set_expand. It was correct for set_add, but not for other ops :/ (out by 1) --- libs/util/set.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/util/set.c b/libs/util/set.c index 7a5a2b02b..68d4a833a 100644 --- a/libs/util/set.c +++ b/libs/util/set.c @@ -95,7 +95,7 @@ set_expand (set_t *set, unsigned x) unsigned *map = set->map; size_t size; - if (x < set->size) + if (x <= set->size) return; size = (x + BITS) & ~(BITS - 1); @@ -111,7 +111,7 @@ static inline void _set_add (set_t *set, unsigned x) { if (x >= set->size) - set_expand (set, x); + set_expand (set, x + 1); set->map[x / BITS] |= 1 << (x % BITS); }