Skip to content

Commit 7c8f398

Browse files
js8544pitrouwestonpace
authored
GH-35273: [C++] Add integer round kernels (#36289)
### 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: #35273 Lead-authored-by: Jin Shang <shangjin1997@gmail.com> Co-authored-by: Antoine Pitrou <pitrou@free.fr> Co-authored-by: Weston Pace <weston.pace@gmail.com> Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent 6e6e6f0 commit 7c8f398

File tree

6 files changed

+872
-283
lines changed

6 files changed

+872
-283
lines changed

cpp/src/arrow/compute/kernels/codegen_internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ template <typename T>
199199
using is_signed_integer_value =
200200
std::integral_constant<bool, std::is_integral<T>::value && std::is_signed<T>::value>;
201201

202+
template <typename T>
203+
using is_integer_value =
204+
std::integral_constant<bool, is_signed_integer_value<T>::value ||
205+
is_unsigned_integer_value<T>::value>;
206+
202207
template <typename T, typename R = T>
203208
using enable_if_signed_integer_value = enable_if_t<is_signed_integer_value<T>::value, R>;
204209

0 commit comments

Comments
 (0)