theirix commented on code in PR #9418:
URL: https://github.com/apache/arrow-rs/pull/9418#discussion_r2930567422


##########
arrow-buffer/src/bigint/mod.rs:
##########
@@ -807,6 +807,46 @@ impl Shr<u8> for i256 {
     }
 }
 
+impl WrappingShl for i256 {
+    #[inline]
+    fn wrapping_shl(&self, rhs: u32) -> i256 {
+        (*self).shl(rhs)
+    }
+}
+
+impl WrappingShr for i256 {
+    #[inline]
+    fn wrapping_shr(&self, rhs: u32) -> i256 {
+        (*self).shr(rhs)
+    }
+}
+
+// Define Shr<T> and Shl<T> for specified integer types
+macro_rules! define_wrapping_shift {

Review Comment:
   The behaviour for num_traits and core Shl is different
   - [core Shl](https://doc.rust-lang.org/nightly/core/ops/trait.Shl.html) 
panics 
   - [num_traits 
WrappingShl](https://docs.rs/num-traits/latest/num_traits/ops/wrapping/trait.WrappingShl.html)
 doesn't panic
   
   At the same time, WrappingShl requires Shl<usize> to be satisfied. I guess 
we can implement a panicking core Shl (to be consistent with core trait), and 
provide a non-panicking wrapping `WrappingShl::wrapping_shl` behaviour instead 
of delegating to `Shl::shl` as you suggested in 
https://github.com/apache/arrow-rs/pull/9418/changes#r2928017509



-- 
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]

Reply via email to