Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
sleeepyjack committed Oct 4, 2023
1 parent 4062a73 commit 5917786
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
83 changes: 42 additions & 41 deletions include/cuco/detail/open_addressing/open_addressing_ref_impl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,47 @@ class open_addressing_ref_impl {
return this->predicate_.empty_sentinel_;
}

/**
* @brief Gets the sentinel used to represent an empty slot.
*
* @return The sentinel value used to represent an empty slot
*/
[[nodiscard]] __device__ constexpr value_type empty_slot_sentinel() const noexcept
{
return empty_slot_sentinel_;
}

/**
* @brief Returns the function that compares keys for equality.
*
* @return The key equality predicate
*/
[[nodiscard]] __host__ __device__ constexpr auto key_eq() const noexcept
[[nodiscard]] __host__ __device__ constexpr detail::equal_wrapper<key_type, key_equal> key_eq()
const noexcept
{
return this->predicate_;
}

/**
* @brief Gets the probing scheme.
*
* @return The probing scheme used for the container
*/
[[nodiscard]] __device__ constexpr probing_scheme_type const& probing_scheme() const noexcept
{
return probing_scheme_;
}

/**
* @brief Gets the non-owning storage ref.
*
* @return The non-owning storage ref of the container
*/
[[nodiscard]] __device__ constexpr storage_ref_type storage_ref() const noexcept
{
return storage_ref_;
}

/**
* @brief Gets the maximum number of elements the container can hold.
*
Expand Down Expand Up @@ -186,21 +217,6 @@ class open_addressing_ref_impl {
*/
[[nodiscard]] __host__ __device__ constexpr iterator end() noexcept { return storage_ref_.end(); }

/**
* @brief Extracts the key from a given value type.
*
* @return The key
*/
template <typename Value>
[[nodiscard]] __host__ __device__ constexpr auto extract_key(Value const& value) const noexcept
{
if constexpr (this->has_payload) {
return value.first;
} else {
return value;
}
}

/**
* @brief Inserts an element.
*
Expand Down Expand Up @@ -675,37 +691,22 @@ class open_addressing_ref_impl {
}
}

private:
/**
* @brief Gets the sentinel used to represent an empty slot.
*
* @return The sentinel value used to represent an empty slot
*/
[[nodiscard]] __device__ constexpr value_type empty_slot_sentinel() const noexcept
{
return empty_slot_sentinel_;
}

/**
* @brief Gets the probing scheme.
*
* @return The probing scheme used for the container
*/
[[nodiscard]] __device__ constexpr probing_scheme_type const& probing_scheme() const noexcept
{
return probing_scheme_;
}

/**
* @brief Gets the non-owning storage ref.
* @brief Extracts the key from a given value type.
*
* @return The non-owning storage ref of the container
* @return The key
*/
[[nodiscard]] __device__ constexpr storage_ref_type storage_ref() const noexcept
template <typename Value>
[[nodiscard]] __host__ __device__ constexpr auto extract_key(Value const& value) const noexcept
{
return storage_ref_;
if constexpr (this->has_payload) {
return value.first;
} else {
return value;
}
}

private:
/**
* @brief Inserts the specified element with one single CAS operation.
*
Expand Down
1 change: 0 additions & 1 deletion include/cuco/static_set_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class static_set_ref
detail::open_addressing_ref_impl<Key, Scope, KeyEqual, ProbingScheme, StorageRef>;

public:
// TODO use impl_type::* aliases
using key_type = Key; ///< Key Type
using probing_scheme_type = ProbingScheme; ///< Type of probing scheme
using storage_ref_type = StorageRef; ///< Type of storage ref
Expand Down

0 comments on commit 5917786

Please sign in to comment.