summaryrefslogtreecommitdiff
path: root/src/common/container.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/container.h')
-rw-r--r--src/common/container.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/container.h b/src/common/container.h
index a342b26670..6a73caac0a 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -282,7 +282,7 @@ typedef unsigned int bitarray_t;
static INLINE bitarray_t *
bitarray_init_zero(int n_bits)
{
- size_t sz = (n_bits+BITARRAY_MASK) & BITARRAY_MASK;
+ size_t sz = (n_bits+BITARRAY_MASK) / (1u << BITARRAY_SHIFT);
return tor_malloc_zero(sz*sizeof(unsigned int));
}
/** Free the bit array <b>ba</b>. */