Skip to content

Commit

Permalink
apacheGH-35273: [C++] Add integer round kernels (apache#36289)
Browse files Browse the repository at this point in the history
### Rationale for this change

Currently `round` casts integers to floats which causes undesired behavior.

### What changes are included in this PR?

Add round kernels for integer types.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.

* Closes: apache#35273

Lead-authored-by: Jin Shang <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Co-authored-by: Weston Pace <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
  • Loading branch information
3 people authored Aug 9, 2023
1 parent 6e6e6f0 commit 7c8f398
Show file tree
Hide file tree
Showing 6 changed files with 872 additions and 283 deletions.
5 changes: 5 additions & 0 deletions cpp/src/arrow/compute/kernels/codegen_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ template <typename T>
using is_signed_integer_value =
std::integral_constant<bool, std::is_integral<T>::value && std::is_signed<T>::value>;

template <typename T>
using is_integer_value =
std::integral_constant<bool, is_signed_integer_value<T>::value ||
is_unsigned_integer_value<T>::value>;

template <typename T, typename R = T>
using enable_if_signed_integer_value = enable_if_t<is_signed_integer_value<T>::value, R>;

Expand Down
Loading

0 comments on commit 7c8f398

Please sign in to comment.