summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2007-07-27 04:45:42 +0000
committerPeter Palfrader <peter@palfrader.org>2007-07-27 04:45:42 +0000
commit49db52abe6e9668a63c0bd6c5ac7c7dfd98751ff (patch)
treeb840af07207484d6fdd531bacf71678f95bf9351
parent1f4275451b08be964b4ec71181d12fa70800ffa4 (diff)
downloadtor-49db52abe6e9668a63c0bd6c5ac7c7dfd98751ff.tar.gz
tor-49db52abe6e9668a63c0bd6c5ac7c7dfd98751ff.zip
Maybe fix #471. Compute the size of bitfields more correctly. Nick, please check.
svn:r10941
-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>. */