Skip to content

Commit

Permalink
Fixes the missing of copy ctor for bitset (#154)
Browse files Browse the repository at this point in the history
Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
  • Loading branch information
sighingnow committed Sep 6, 2023
1 parent 076f351 commit 53d212b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions grape/utils/bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ limitations under the License.
#include "thread_pool.h"

#define WORD_SIZE(n) (((n) + 63ul) >> 6)
#define BYTE_SIZE(n) (((n) + 63ul) >> 3)

#define WORD_INDEX(i) ((i) >> 6)
#define BIT_OFFSET(i) ((i) &0x3f)
Expand All @@ -45,6 +46,12 @@ class Bitset : public Allocator<uint64_t> {
data_ = this->allocate(size_in_words_);
clear();
}
Bitset(const Bitset& other)
: size_(other.size_),
size_in_words_(other.size_in_words_) {
data_ = this->allocate(size_in_words_);
memcpy(data_, other.data_, BYTE_SIZE(size_));
}
Bitset(Bitset&& other)
: data_(other.data_),
size_(other.size_),
Expand Down Expand Up @@ -348,6 +355,7 @@ class RefBitset {
};

#undef WORD_SIZE
#undef BYTE_SIZE
#undef WORD_INDEX
#undef BIT_OFFSET
#undef ROUND_UP
Expand Down

0 comments on commit 53d212b

Please sign in to comment.