From 49db52abe6e9668a63c0bd6c5ac7c7dfd98751ff Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Fri, 27 Jul 2007 04:45:42 +0000 Subject: [PATCH] Maybe fix #471. Compute the size of bitfields more correctly. Nick, please check. svn:r10941 --- src/common/container.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ba. */