Skip to content

Commit

Permalink
Use offsetalator in strings shift functor (#15870)
Browse files Browse the repository at this point in the history
Replaces hardcoded `size_type` used for offset values in the `shift_chars_fn` functor with offsetalator.
Follow on to #15630

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Paul Mattione (https://github.com/pmattione-nvidia)
  - Yunsong Wang (https://github.com/PointKernel)

URL: #15870
  • Loading branch information
davidwendt authored Jun 3, 2024
1 parent 4a17c45 commit f30ea0a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cpp/src/strings/copying/shift.cu
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ struct shift_chars_fn {
if (offset < 0) {
auto const last_index = -offset;
if (idx < last_index) {
auto const first_index =
offset + d_column.child(strings_column_view::offsets_column_index)
.element<size_type>(d_column.offset() + d_column.size());
auto const offsets = d_column.child(strings_column_view::offsets_column_index);
auto const off_itr = cudf::detail::input_offsetalator(offsets.head(), offsets.type());
auto const first_index = offset + off_itr[d_column.offset() + d_column.size()];
return d_column.head<char>()[idx + first_index];
} else {
auto const char_index = idx - last_index;
Expand All @@ -79,9 +79,9 @@ struct shift_chars_fn {
if (idx < offset) {
return d_filler.data()[idx % d_filler.size_bytes()];
} else {
return d_column.head<char>()[idx - offset +
d_column.child(strings_column_view::offsets_column_index)
.element<size_type>(d_column.offset())];
auto const offsets = d_column.child(strings_column_view::offsets_column_index);
auto const off_itr = cudf::detail::input_offsetalator(offsets.head(), offsets.type());
return d_column.head<char>()[idx - offset + off_itr[d_column.offset()]];
}
}
}
Expand Down

0 comments on commit f30ea0a

Please sign in to comment.