From f30ea0a7d12625a755bb5726e7514dfdf12094d6 Mon Sep 17 00:00:00 2001 From: David Wendt <45795991+davidwendt@users.noreply.github.com> Date: Mon, 3 Jun 2024 17:37:56 -0400 Subject: [PATCH] Use offsetalator in strings shift functor (#15870) 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: https://github.com/rapidsai/cudf/pull/15870 --- cpp/src/strings/copying/shift.cu | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/src/strings/copying/shift.cu b/cpp/src/strings/copying/shift.cu index 5bba4855390..b386c0860d1 100644 --- a/cpp/src/strings/copying/shift.cu +++ b/cpp/src/strings/copying/shift.cu @@ -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(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()[idx + first_index]; } else { auto const char_index = idx - last_index; @@ -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()[idx - offset + - d_column.child(strings_column_view::offsets_column_index) - .element(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()[idx - offset + off_itr[d_column.offset()]]; } } }