diff --git a/daemon/util.h b/daemon/util.h index cbc82cc..a20125e 100644 --- a/daemon/util.h +++ b/daemon/util.h @@ -117,13 +117,13 @@ static __inline void bitmap_unset( static __inline void bitmap_intersect( IN bitmap4 *dst, IN const bitmap4 *src) -{ - uint32_t i, count = 0; - for (i = 0; i < 3; i++) { - dst->arr[i] &= src->arr[i]; - if (dst->arr[i]) - count = i+1; - } +{ + uint32_t i, count = 0; + for (i = 0; i < 3; i++) { + dst->arr[i] = ((i < dst->count)?dst->arr[i]:0) & ((i < src->count)?src->arr[i]:0); + if (dst->arr[i]) + count = i+1; + } dst->count = min(dst->count, count); }