Skip to content

Commit

Permalink
fix some variable names and comment formmatting
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwendt committed Mar 1, 2022
1 parent 3015451 commit a3732ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions cpp/src/strings/contains.cu
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ template <int stack_size>
struct contains_fn {
reprog_device prog;
column_device_view const d_strings;
bool const bmatch; // do not make this a template parameter to keep compile times down
bool const beginning_only; // do not make this a template parameter to keep compile times down

__device__ bool operator()(size_type idx)
{
if (d_strings.is_null(idx)) return false;
auto const d_str = d_strings.element<string_view>(idx);
int32_t begin = 0;
int32_t end = bmatch ? 1 // match only the beginning of the string;
: -1; // this handles empty strings too
int32_t end = beginning_only ? 1 // match only the beginning of the string;
: -1; // match anywhere in the string
return static_cast<bool>(prog.find<stack_size>(idx, d_str, begin, end));
}
};

struct contains_dispatch_fn {
reprog_device d_prog;
bool const beginning_only{false};
bool const beginning_only;

template <int stack_size>
std::unique_ptr<column> operator()(strings_column_view const& input,
Expand Down
5 changes: 3 additions & 2 deletions cpp/src/strings/search/findall.cu
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ struct findall_fn {

auto const result = [&] {
if (spos > epos) { return string_index_pair{nullptr, 0}; }
spos = d_str.byte_offset(spos); // convert
epos = d_str.byte_offset(epos); // to bytes
// convert character positions to byte positions
spos = d_str.byte_offset(spos);
epos = d_str.byte_offset(epos);
return string_index_pair{d_str.data() + spos, (epos - spos)};
}();

Expand Down

0 comments on commit a3732ad

Please sign in to comment.