Skip to content

Commit

Permalink
Guard division with ceil
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed Sep 27, 2023
1 parent 30788cb commit 0297657
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/cuco/detail/open_addressing_impl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

#include <cuda/atomic>

#include <cmath>

namespace cuco {
namespace experimental {
namespace detail {
Expand Down Expand Up @@ -175,7 +177,7 @@ class open_addressing_impl {
predicate_{pred},
probing_scheme_{probing_scheme},
storage_{make_window_extent<open_addressing_impl>(
static_cast<size_type>(static_cast<double>(n) / desired_load_factor)),
static_cast<size_type>(std::ceil(static_cast<double>(n) / desired_load_factor))),
alloc}
{
CUCO_EXPECTS(desired_load_factor > 0., "Desired occupancy must be larger than zero");
Expand Down

0 comments on commit 0297657

Please sign in to comment.