Skip to content

Commit

Permalink
resurrect is_unsigned_iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwendt committed Mar 17, 2021
1 parent 019fe2d commit 6163360
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cpp/include/cudf/detail/gather.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ struct gather_bitmask_functor {
auto col = input.column(mask_idx);

if (Op != gather_bitmask_op::DONT_CHECK) {
bool out_of_range = (row_idx < 0 || row_idx >= col.size());
bool out_of_range = is_signed_iterator<MapIterator>() ? (row_idx < 0 || row_idx >= col.size())
: row_idx >= col.size();
if (out_of_range) {
if (Op == gather_bitmask_op::PASSTHROUGH) {
return bit_is_set(masks[mask_idx], bit_idx);
Expand Down
12 changes: 12 additions & 0 deletions cpp/include/cudf/utilities/traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,18 @@ constexpr inline bool is_unsigned(data_type type)
return cudf::type_dispatcher(type, is_unsigned_impl{});
}

/**
* @brief Indicates whether the `Iterator` value type is unsigned.
*
* @tparam Iterator The type to verify
* @return true if the iterator's value type is unsigned
*/
template <typename Iterator>
constexpr inline bool is_signed_iterator()
{
return std::is_signed<typename std::iterator_traits<Iterator>::value_type>::value;
}

/**
* @brief Indicates whether the type `T` is a floating point type.
*
Expand Down

0 comments on commit 6163360

Please sign in to comment.