Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run CI with gcc and clang on all branches #76

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion include/builders/internal_memory_builder_single_phf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ struct internal_memory_builder_single_phf {
std::swap(m_num_keys, other.m_num_keys);
std::swap(m_num_buckets, other.m_num_buckets);
std::swap(m_table_size, other.m_table_size);
std::swap(m_bucketer, other.m_bucketer);
m_bucketer.swap(other.m_bucketer);
m_pilots.swap(other.m_pilots);
m_free_slots.swap(other.m_free_slots);
}
Expand Down
40 changes: 32 additions & 8 deletions include/utils/bucketers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ struct table_bucketer {
return base.num_buckets() + fulcrums.size() * 64;
}

void swap(table_bucketer& other) {
base.swap(other.base);
std::swap(fulcrums, other.fulcrums);
}

template <typename Visitor>
void visit(Visitor& visitor) const {
visit_impl(visitor, *this);
Expand Down Expand Up @@ -106,6 +111,13 @@ struct opt_bucketer {
8 * sizeof(m_alpha_factor);
}

void swap(opt_bucketer& other) {
std::swap(c, other.c);
std::swap(m_num_buckets, other.m_num_buckets);
std::swap(m_alpha, other.m_alpha);
std::swap(m_alpha_factor, other.m_alpha_factor);
}

template <typename Visitor>
void visit(Visitor& visitor) const {
visit_impl(visitor, *this);
Expand All @@ -124,10 +136,10 @@ struct opt_bucketer {
visitor.visit(t.m_alpha);
visitor.visit(t.m_alpha_factor);
}
double c;
uint64_t m_num_buckets;
double m_alpha;
double m_alpha_factor;
double c = 0;
uint64_t m_num_buckets = 0;
double m_alpha = 0;
double m_alpha_factor = 0;
};

struct skew_bucketer {
Expand Down Expand Up @@ -189,8 +201,10 @@ struct skew_bucketer {
visitor.visit(t.m_M_num_sparse_buckets);
}

uint64_t m_num_dense_buckets, m_num_sparse_buckets;
__uint128_t m_M_num_dense_buckets, m_M_num_sparse_buckets;
uint64_t m_num_dense_buckets = 0;
uint64_t m_num_sparse_buckets = 0;
__uint128_t m_M_num_dense_buckets = 0;
__uint128_t m_M_num_sparse_buckets = 0;
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ByteHamster and @stefanfred:
The classes skew_bucketer and uniform_bucketer are already correctly initialized since they have a default constructor. These initializations are therefore redundant. I would add default constructors to all the others that do not have it already.


struct range_bucketer {
Expand All @@ -212,6 +226,11 @@ struct range_bucketer {
return 8 * (sizeof(m_num_buckets) + sizeof(m_M_num_buckets));
}

void swap(range_bucketer& other) {
std::swap(m_num_buckets, other.m_num_buckets);
std::swap(m_M_num_buckets, other.m_M_num_buckets);
}

template <typename Visitor>
void visit(Visitor& visitor) const {
visit_impl(visitor, *this);
Expand Down Expand Up @@ -254,6 +273,11 @@ struct uniform_bucketer {
return 8 * (sizeof(m_num_buckets) + sizeof(m_M_num_buckets));
}

void swap(uniform_bucketer& other) {
std::swap(m_num_buckets, other.m_num_buckets);
std::swap(m_M_num_buckets, other.m_M_num_buckets);
}

template <typename Visitor>
void visit(Visitor& visitor) const {
visit_impl(visitor, *this);
Expand All @@ -270,8 +294,8 @@ struct uniform_bucketer {
visitor.visit(t.m_num_buckets);
visitor.visit(t.m_M_num_buckets);
}
uint64_t m_num_buckets;
__uint128_t m_M_num_buckets;
uint64_t m_num_buckets = 0;
__uint128_t m_M_num_buckets = 0;
};

} // namespace pthash
Loading