Skip to content

Commit

Permalink
Correct bitset support in pyknowhere (#165)
Browse files Browse the repository at this point in the history
Signed-off-by: Yudong Cai <[email protected]>
  • Loading branch information
cydrain authored Oct 31, 2023
1 parent a77c18c commit 4bb26ec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/knowhere/knowhere.i
Original file line number Diff line number Diff line change
Expand Up @@ -226,21 +226,21 @@ class IndexWrap {
class BitSet {
public:
BitSet(const int num_bits) : num_bits_(num_bits) {
bit_set_.resize(num_bits_ / 8, 0);
bitset_.resize((num_bits_ + 7) / 8, 0);
}

void
SetBit(const int idx) {
bit_set_[idx >> 3] |= 0x1 << (idx & 0x7);
bitset_[idx >> 3] |= 0x1 << (idx & 0x7);
}

knowhere::BitsetView
GetBitSetView() {
return knowhere::BitsetView(bit_set_.data(), num_bits_);
return knowhere::BitsetView(bitset_.data(), num_bits_);
}

private:
std::vector<uint8_t> bit_set_;
std::vector<uint8_t> bitset_;
int num_bits_ = 0;
};

Expand Down

0 comments on commit 4bb26ec

Please sign in to comment.