Skip to content

Commit

Permalink
unsigned difference is always positive: > 0 should be != 0 instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jermp committed Jan 14, 2025
1 parent b6622ca commit 47f7d9b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions include/utils/dense_encoders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ struct dense_interleaved : dense_encoder {
static void visit_impl(Visitor& visitor, T&& t) {
visitor.visit(t.m_encoders);
}

std::vector<Encoder> m_encoders;
};

Expand All @@ -191,20 +192,20 @@ struct dense_dual : dense_encoder {
{
m_front_size = num_buckets_per_partition * (static_cast<double>(numerator) / denominator);
if (num_threads == 1) {
if (m_front_size > 0) m_front.encode(begin, num_partitions, m_front_size, 1);
if (num_buckets_per_partition - m_front_size > 0)
if (m_front_size != 0) m_front.encode(begin, num_partitions, m_front_size, 1);
if (num_buckets_per_partition - m_front_size != 0)
m_back.encode(begin + m_front_size * num_partitions, num_partitions,
num_buckets_per_partition - m_front_size, 1);
} else {
uint64_t m_front_threads =
(num_threads * m_front_size + num_buckets_per_partition - 1) /
num_buckets_per_partition;
auto exe = [&]() {
if (m_front_size > 0)
if (m_front_size != 0)
m_front.encode(begin, num_partitions, m_front_size, m_front_threads);
};
std::thread frontThread = std::thread(exe);
if (num_buckets_per_partition - m_front_size > 0)
if (num_buckets_per_partition - m_front_size != 0)
m_back.encode(begin + m_front_size * num_partitions, num_partitions,
num_buckets_per_partition - m_front_size,
num_threads - m_front_threads);
Expand Down Expand Up @@ -248,6 +249,7 @@ struct dense_dual : dense_encoder {
visitor.visit(t.m_front);
visitor.visit(t.m_back);
}

uint64_t m_front_size;
Front m_front;
Back m_back;
Expand Down

0 comments on commit 47f7d9b

Please sign in to comment.