Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions include/rabitqlib/core/query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ class SplitSingleQuery {

public:
static constexpr size_t kNumBits = 4;

SplitSingleQuery(const SplitSingleQuery&) = default;
SplitSingleQuery(SplitSingleQuery&&) noexcept = default;
SplitSingleQuery& operator=(SplitSingleQuery&&) noexcept = default;

SplitSingleQuery& operator=(const SplitSingleQuery& other) {
// Copy owned codes before changing their borrowed query and corrections.
query_bin_ = other.query_bin_;
rotated_query_ = other.rotated_query_;
G_add_ = other.G_add_;
G_k1xSumq_ = other.G_k1xSumq_;
G_kbaseSumq_ = other.G_kbaseSumq_;
G_kbxSumq_ = other.G_kbxSumq_;
G_error_ = other.G_error_;
delta_ = other.delta_;
vl_ = other.vl_;
metric_type_ = other.metric_type_;
return *this;
}

explicit SplitSingleQuery(
const T* rotated_query,
size_t padded_dim,
Expand Down
12 changes: 11 additions & 1 deletion include/rabitqlib/core/rotator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,17 @@ class FhtKacRotator : public Rotator<float> {

size_t dump_bytes() const override { return sizeof(uint8_t) * flip_.size(); }

FhtKacRotator& operator=(const FhtKacRotator&) = default;
FhtKacRotator(const FhtKacRotator&) = default;

FhtKacRotator& operator=(const FhtKacRotator& other) {
// Preserve the old dimensions if copying the sign storage fails.
flip_ = other.flip_;
this->dim_ = other.dim_;
this->padded_dim_ = other.padded_dim_;
trunc_dim_ = other.trunc_dim_;
fac_ = other.fac_;
return *this;
}

static void kacs_walk(float* data, size_t len) { simd::kacs_walk(data, len); }

Expand Down
8 changes: 7 additions & 1 deletion include/rabitqlib/index/detail/visited_set_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ class HashBasedVisitedSet {
~HashBasedVisitedSet() = default;

HashBasedVisitedSet(const HashBasedVisitedSet&) = default;
HashBasedVisitedSet& operator=(const HashBasedVisitedSet&) = default;
HashBasedVisitedSet& operator=(const HashBasedVisitedSet& other) {
if (this != &other) {
// Both containers may allocate; publish only a complete replacement.
*this = HashBasedVisitedSet(other);
}
return *this;
}
HashBasedVisitedSet(HashBasedVisitedSet&&) noexcept = default;
HashBasedVisitedSet& operator=(HashBasedVisitedSet&&) noexcept = default;

Expand Down
Loading