alamb commented on code in PR #4494:
URL: https://github.com/apache/arrow-rs/pull/4494#discussion_r1258313081
##########
arrow-arith/src/numeric.rs:
##########
@@ -74,6 +74,97 @@ pub fn rem(lhs: &dyn Datum, rhs: &dyn Datum) ->
Result<ArrayRef, ArrowError> {
arithmetic_op(Op::Rem, lhs, rhs)
}
+macro_rules! neg_checked {
+ ($t:ty, $a:ident) => {{
+ let array = $a
+ .as_primitive::<$t>()
+ .try_unary::<_, $t, _>(|x| x.neg_checked())?;
+ Ok(Arc::new(array))
+ }};
+}
+
+macro_rules! neg_wrapping {
+ ($t:ty, $a:ident) => {{
+ let array = $a.as_primitive::<$t>().unary::<_, $t>(|x|
x.neg_wrapping());
+ Ok(Arc::new(array))
+ }};
+}
+
+/// Perform `!array`, returning an error on overflow
+///
+/// Note: negation of unsigned arrays is not supported and will return in an
error,
+/// for wrapping unsigned negation consider using [`neg_wrapping()`]
Review Comment:
sorry it just looked strange to me
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]