Explorar el Código

Maybe fix #471. Compute the size of bitfields more correctly. Nick, please check.

svn:r10941
Peter Palfrader hace 18 años
padre
commit
49db52abe6
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/common/container.h

+ 1 - 1
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>. */