diff --git a/storage/tianmu/util/bitset.h b/storage/tianmu/util/bitset.h index 9a08e1d8bb..34f7b539f2 100644 --- a/storage/tianmu/util/bitset.h +++ b/storage/tianmu/util/bitset.h @@ -18,6 +18,7 @@ #define TIANMU_UTIL_BITSET_H_ #pragma once +#include namespace Tianmu { namespace utils { @@ -32,6 +33,7 @@ class BitSet { ptr_ = new char[(sz + NO_OF_BITS - 1) / NO_OF_BITS](); allocated_ = true; } + memset(ptr_, 0, (sz + NO_OF_BITS - 1) / NO_OF_BITS); } ~BitSet() { @@ -50,6 +52,7 @@ class BitSet { ptr_ = new char[(sz + NO_OF_BITS - 1) / NO_OF_BITS](); allocated_ = true; } + memset(ptr_, 0, (sz + NO_OF_BITS - 1) / NO_OF_BITS); } bool operator[](size_t pos) const { return ptr_[pos / NO_OF_BITS] & (1U << (pos % NO_OF_BITS)); }