Skip to content

Commit

Permalink
Rename key_eq to predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
sleeepyjack committed Oct 5, 2023
1 parent c390393 commit 35047c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class open_addressing_ref_impl {
*
* @return The key equality predicate
*/
[[nodiscard]] __device__ constexpr detail::equal_wrapper<key_type, key_equal> const& key_eq()
[[nodiscard]] __device__ constexpr detail::equal_wrapper<key_type, key_equal> const& predicate()
const noexcept
{
return this->predicate_;
Expand Down
7 changes: 4 additions & 3 deletions include/cuco/detail/static_map/static_map_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class operator_impl<
auto const window_slots = storage_ref[*probing_iter];

for (auto& slot_content : window_slots) {
auto const eq_res = ref_.impl_.key_eq()(slot_content.first, key);
auto const eq_res = ref_.impl_.predicate()(slot_content.first, key);

// If the key is already in the container, update the payload and return
if (eq_res == detail::equal_result::EQUAL) {
Expand Down Expand Up @@ -264,7 +264,7 @@ class operator_impl<

auto const [state, intra_window_index] = [&]() {
for (auto i = 0; i < window_size; ++i) {
switch (ref_.impl_.key_eq()(window_slots[i].first, key)) {
switch (ref_.impl_.predicate()(window_slots[i].first, key)) {
case detail::equal_result::EMPTY:
return detail::window_probing_results{detail::equal_result::EMPTY, i};
case detail::equal_result::EQUAL:
Expand Down Expand Up @@ -329,7 +329,8 @@ class operator_impl<

// if key success or key was already present in the map
if (cuco::detail::bitwise_compare(*old_key_ptr, expected_key) or
(ref_.impl_.key_eq().equal_to(*old_key_ptr, value.first) == detail::equal_result::EQUAL)) {
(ref_.impl_.predicate().equal_to(*old_key_ptr, value.first) ==
detail::equal_result::EQUAL)) {
// Update payload
ref_.impl_.atomic_store(&slot->second, value.second);
return true;
Expand Down

0 comments on commit 35047c4

Please sign in to comment.