Skip to content

Commit

Permalink
fix implicit cast
Browse files Browse the repository at this point in the history
  • Loading branch information
js8544 committed Dec 16, 2023
1 parent ddcaaeb commit 6a2d89e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cpp/src/arrow/compute/kernels/scalar_string_ascii.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2582,19 +2582,19 @@ struct SliceBytesTransform : StringSliceTransformBase {
auto input_width = static_cast<int64_t>(input_width_32);

if (start < 0) {
start = std::max(0L, start + input_width);
start = std::max(static_cast<int64_t>(0), start + input_width);
}
if (stop < 0) {
stop = std::max(0L, stop + input_width);
stop = std::max(static_cast<int64_t>(0), stop + input_width);
}
start = std::min(start, input_width);
stop = std::min(stop, input_width);

if ((start >= stop and step > 0) || (start <= stop and step < 0) || start == stop) {
return 0;
}
return static_cast<int32_t>(
std::max(0L, (stop - start + (step - (step > 0 ? 1 : -1))) / step));
return static_cast<int32_t>(std::max(
static_cast<int64_t>(0), (stop - start + (step - (step > 0 ? 1 : -1))) / step));
}
};

Expand Down

0 comments on commit 6a2d89e

Please sign in to comment.